# Switching from macOS to Linux/Printable version

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/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.

## Installing
### 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.
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.

## Software Update
### Finding your version

You can find out the current version of your OS with this command.
This is what it printed.
You can also view the version of the Linux kernel by running this command.
This is what it printed.
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.

## Getting new software
### 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.
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.

# System Preferences (Desktop)

The following is a list of some of Apple's System Preference Panes and where you will be able to find the same settings in Ubuntu Desktop. Most of them are self explanatory and are available in Ubuntu Desktop "System Settings" application, which is found in the Dock or in the Gear menu at the top right of the screen.

## Desktop
### Desktop Background

"System Settings", "Appearance" to set the background image.

### Screensaver

"System Settings", "Brightness & Lock" to set the lock time and password requirements.
Ubuntu's ships with only one basic screensaver that locks the screen. If you want a more screensaver follow these screensaver installation instructions.

## Displays
### Resolution

"System Settings", "Display" to change resolution. The big difference between this and Mac is that you have to click "Apply" to actually change the resolution. This won't be obvious if you install Ubuntu in a VM that has a very small screen size (800 x 600) because you won't be able to see the "Apply" button.

### Night Shift

Read about it here.

## Dock

The Ubuntu Dock is called the Launcher.
"System Settings", "Appearance", "Look" tab allows you set it's size. The "Behavior" tab allows you to Auto-hide the Launcher. There are other ways to configure the Launcher appearance.

## Energy Saver
### Sleep display

"System Settings", "Brightness & Lock" to set the lock time.

### Sleep computer

"System Settings", "Power" allows you to suspend the computer, but I'm not sure what that means.

### Sleep hard drives

I don't see settings for this.

### Wake for Network Access

Read about it here.

### Power Off/Sleep
## Extensions
## General
### Default Web browser

"System Settings", "Details" pane, "Default Applications" tab allows you to change the default web browser, email, calendar, music, video, and photo applications.

## Keyboard
### Key Repeat & Delay Until Repeat

"System Settings", "Keyboard"

### Shortcuts

"System Settings", "Keyboard"

### Input Sources

"System Settings", "Text Entry"

### Add bluetooth device
## Mouse & Trackpad
### Scroll Direction

This seems to be a grey area. You can read about it here and here

### Tracking Speed

"System Settings", "Mouse & Trackpad"

### Add bluetooth device
## Printers & Scanners

"System Settings", "Printers".
For scanners, see this, this or this.

## Security & Privacy
### Screensaver Password

"System Settings", "Brightness & Lock"

### Privacy
## Sharing
## Users & Groups
# System Preferences
## Energy Saver
### Sleep display

"System Settings", "Brightness & Lock" to set the lock time.

### Sleep computer

"System Settings", "Power" allows you to suspend the computer, but I'm not sure what that means.

### Sleep hard drives

I don't see settings for this.

### Wake for Network Access

Read about it here.