Loading Linux on a Mac-Mini

In the intel mac era this has become fairly easy and you can use standard linux Distros.  There are a few little tweaks which I will mention.  I am using Ubuntu 14.04 LTS 64bit for this example.

You will need to acquire a standard (non-mac) iso from, and write that to a usb key using dd on a Linux or OS X machine, or Universal USB Installer on a windows machine.

*** You should also make an OS X Installer USB key incase you wish to restore your mac mini to normal at a later date ***

Once you have your bootable usb, plug it in to the mac mini and power up holding the Option / Alt key until you see the boot choices screen.  One of the options will be UEFI – this will be your USB key.

From there on, install Ubuntu as normal.   It is safe to remove all partitions – you don’t need to keep any for the mac to boot to Linux.

Once finished, reboot the machine & boot to your USB key as before.  This will present you with an option to Rescue your system.  Follow those prompts, eventually choosing to boot in to a shell.

At the shell you should be able to run the following:

efibootmgr -bootorder 0000

This tells the efi firmware to look for Linux before OS X.  Exit the shell and reboot without holding any keys, and you should finally be in your working Linux system.  Enjoy!

Just incase, if you want to remove Linux and put OS X back later on, run the following from your soon-to-be-removed Linux install:

efibootmgr -bootorder 0080

Configuring phpmyadmin with nginx

Install the php dependencies

apt-get install phpmyadmin php5-fpm

Modify /etc/nginx/sites-available/default and add the following at the end of the server section

location ^~ /phpmyadmin {
    alias /usr/share/phpmyadmin/;
    index index.php index.html index.htm;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

To restrict access to a certain IP, add the following just below the index line that you have just added…

deny all;

enable mcrypt extension

php5enmod mcrypt

restart nginx & php5

service restart nginx
service restart php5-fpm

Installing HHVM on Amazon Linux (AWS)


Alternative to PHP, said to increase speed by up to 40%.  Works similar to java in that it pre-compiles PHP automatically to speed up execution time.  Used by facebook.

cd /etc/yum.repos.d
echo 'priority=9' >> hop5.repo
echo 'includepkgs=glog,tbb' >> hop5.repo
yum install hhvm



Usernames for Amazon Linux (AWS) and Ubuntu AMI

For Amazon Linux, the username is “ec2-user”, for ubuntu it is simply “ubuntu”.

To connect to them you need the key file that was generated when the instance was created, and the public DNS address.  Use a command like:

ssh -i myinstance.pem ec2-user@

Note: Make sure you have opened up ssh (port 22) access to your instance from your IP address.