Tag Archives: ubuntu

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 ubuntu.com, 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

Hosting multiple sites/domains on nginx

Create a folder for your new domain within nginx

mkdir -p /var/www/yourdomain.com/public_html

Fix up the permissions

chown -R www-data:www-data /var/www/yourdomain.com/public_html
chmod 755 /var/www

Create a simple page to serve

Add the following to /var/www/yourdomain.com/public_html/index.html

<html>
  <head>
    <title>www.yourdomain.com</title>
  </head>
  <body>
    <h1>Success: You Have Set Up a Virtual Host</h1>
  </body>
</html>

Create and modify the new virtual host config

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/yourdomain.com

Edit the new file and modify the following areas in the server section

listen 80;
#listen [::]:80 default_server ipv6only=on;
root /var/www/yourdomain.com/public_html;
index index.php index.html index.htm;
server_name yourdomain.com;

Enable the virtual host

ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/yourdomain.com

Restart nginx

service nginx restart

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@12.34.56.789

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