Switching from macOS to Linux/Installing

Downloading
To install Ubuntu, first get it from Ubuntu's download page. You have the choice between Desktop and Server versions. If you are familiar with the command line and intend to run Ubuntu as a server, download the server version first. If you are unfamiliar with the command line, you can install the GUI while you learn it. Instructions to do that appear later.

Ubuntu is released twice a year, once in April, once in October. These versions are supported for 9 months. Every 2 years, Ubuntu releases a "Long Term Support" (LTS) version that is supported for 5 years.

The version matches the year, month, and day. Ubuntu 16.04.03 means it was released in on April 3rd, 2016. Ubuntu 17.10.1 was released on October 1st, 2017.

Virtual Machines
VirtualBox is free so you can get started with this right now. There are many instructions online that discusses how to do this. The steps are basically as follows.


 * Create a new VM
 * Attach the downloaded iso
 * Start the VM
 * Run the installer

VMware Fusion is easier. Just select "Install from disc or image" and drag the iso on top of it.

Boot Camp
Installing Ubuntu on a Mac

Non-Mac Hardware
Ubuntu's desktop tutorial. Ubuntu's server tutorial. Ubuntu's server installation guide.

Forgotten Password
If you forget your password you must reboot and enter Recovery Mode. If you are at the login screen you can reboot by pressing control-alt-delete (control-option-delete). Hold down the shift key as soon as the computer restarts. Almost immediately you will enter the GNU GRUB menu. If the computer wont even boot to the GRUB menu, you must boot to a CD's GRUB menu.

Once booted to the GRUB menu, choose "Advanced options for Ubuntu", then "recovery mode", then "Drop to root shell prompt". Type these commands to make the disk writable.

mount -o remount,rw / mount --all

Then you can change a password using passwd. User information is stored in /etc/passwd and passwords are stored in /etc/shadow. /etc/passwd needs to have 644 permissions and /etc/shadow must have 640 permissions. Home folders are in /home/. Group information is stored in /etc/groups.

Finding your version
You can find out the current version of your OS with this command.

This is what it printed.

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"

You can also view the version of the Linux kernel by running this command.

This is what it printed.

Linux ubuntu 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

According to the Linux Kernel Archives the latest version at the time of writing is 4.15.

Update
The first thing you want to do after installing (assuming your networking is working) is to update. To update run these commands.

This command updates your local copy of available software that you can install. Run this command periodically to make sure your source list is up-to-date.

When I first installed 16.04 and ran apt-get update I got an error that said the following.

It's pretty annoying when an error appears right out of the box, but don't let it stop you. I fixed it by searching for the error on the internet and I found this page that says to edit /etc/apt/sources.list and comment out lines that began with "deb cdrom". That fixed the problem for me.

Upgrade
Next, run this command to upgrade the packages already installed on your computer.

The Ubuntu server guide says to run this command to upgrade Ubuntu server.

On other Linux versions you would run this command instead.

Viewing what you have installed
This will print a long list of all of the software installed on your computer.

SSH
I setup SSH first because I'm most familiar with the Mac, so I prefer to work from a Mac, so I prefer to login to Linux using Mac's Terminal.app.

SSH isn't installed by default. You can install it using the following command.

You could also install it using the tasksel command (see below).

To check it's status run this command.

Once it's running you can ssh into your Linux box by first getting the IP of your Linux computer by running this command.

Then on a different computer (like your Mac), you can ssh in by running this command.

If you are using a virtual machine, now would be a good time to make a snapshot.

Virtualmin
Virtualmin GPL is an extension of the Webmin web console that is used to configure a Unix based server using a web browser. I intend on using a web console as a crutch so that I can get up and running as quickly as possible. I intend on learning how to configure everything using the command line, but getting a production server running will give me a reason to learn the command line.

I choose Virtualmin for one reason, it safely backs up MySQL databases. I didn't see any other free web consoles. I don't have my own scripts to do this, so I'm relying on this product to do it for me. Virtualmin also installs Webmin and LAMP, which I also plan to install. So this just does it all for me.

To find the latest instructions see the Virtualmin instructions.

At the time of this writing, the instructions were to run these commands.

Webmin
Virtualmin will install Webmin. If you don't want Virtualmin but do want Webmin, you can install it with the following commands.

Add the webmin source.

Add this line.

deb http://download.webmin.com/download/repository sarge contrib

Then run these commands

Then you can login and configure your server using a web browser at https://yourip:10000.

tasksel
This command is a short cut to installing many things, based on the task. Run it without any arguments for a list.

In my case I selected "Samba file server".

To see what a task is actually installing, look at /usr/share/tasksel/descs/ubuntu-tasks.desc.

I could also install a specific task by naming it.

And I could remove it using the remove command.

After installing LAMP, it is recommended that you secure it.

Desktop GUI
If you really want to install the GUI on Ubuntu Server type one of the following.

For only the desktop and not the extras.

To remove:

To install the desktop and all of the extras (Firefox, LibreOffice, mp3 player).

To remove:

The rest of this book is going to assume you don't have Desktop installed.

Listing software
For an absolutely gigantic list of software that you can install run this command.

You can also substitute a keyword to find software with that keyword.

Ironically, this doesn't list Apache, MySQL, or PHP. Even more ironically a web search led to old documentation that didn't work either. I had to go to the Official Ubuntu Documentation, find the latest Server documentation (16.04 LTS), and look for "LAMP" there. The page there said to use tasksel.