I have been a fan of Ubuntu for a long time and their server addition is excellent. Today I am going to show you how to set-up your own Ubuntu Server and get it ready for whatever you plan on using it for. Once you have completed these steps you can move onto building an Apache server, or a Version Control Server and even a Mail server.
Boot up your pc/server/virtual machine with the ISO file you downloaded earlier. I will not be covering how to burn the image to disc or flash drive. Make sure you have told the BIOS to boot from CD or USB. Now boot up your machine.
As soon as the disc boots up you will have to choose the language for the installer. Go ahead and select the language you want.
You will be presented with a few options but the one you need is Install Ubuntu Server. Go ahead and hit enter.
Choose your main language
Choose your region
Select No for Detect keyboard layout. You can choose yes and follow the on screen instructions to automatically detect your keyboard layout. If you do this then skip ahead to step 9.
Choose keyboard layout
Choose local keyboard layout
Enter the hostname for this server – A hostname is a name assigned to a device on a network and is used to identify it in various forms, like DNS for example. This will save you having to use the IP address all the time.
Select yes if the time zone is correct.
I choose to use the entire disk, but if you know what you are doing with Logical Volume Management and Encryption then carry on.
Select the hard disk you wish to format. You may have multiple drives if using a physical machine so make sure you select the correct drive.
Confirm and write the changes to disk. be warned, this is the actual part where the drive gets formatted so make sure you chose the right disk in the previous step. If not, then just go back and check.
Now sit back for a few minutes while the disk is formatted and the base system gets installed.
Enter your full name – I usually use a nickname here but you can type your full name in if you wish.
Enter your password twice to confirm it.
Choose whether you want to encrypt your home folders. For security it is usually a good idea.
Set up your proxy information. Usually you will not be behind a proxy so just hit enter without putting any information in. If you are behind a proxy then make sure you enter the correct details. The system will configure apt and install the software.
I choose to install all security updates automatically, saves me having to remember.
In the initial software selection you only need SSH at the moment. Press the spacebar to tick the box next to OpenSSH Server, then press tab to jump down to continue and hit enter. The boot loader will now install. When asked, choose yes to install GRUB into the master boot record.
The Grub boot loader will continue to install and when it is finished you are all done. If you are on a physical machine then remember to take out the CD or flash drive and hit enter to reboot. VM’s need not take the drive out, the VM will sort it out for you.
Once the server reboots and you have logged back in you will need to update it so you have the current versions of all the installed software.
sudo apt-get update && sudo apt-get upgrade -y
This command will update the system then grab all the available updates and install them. The -y tag just tells the terminal to say yes when asked if it is OK to go ahead and install the updates.
It is likely that the update came with a new kernel image so you will have to reboot and log back in.
Now you are logged back in you need to enable the root account. Once you are finished with the root account you will disable it again. Type the following to enable to root account and give it a password.
sudo passwd root
You will be asked for your sudo password (that’s the password for your user account), then you will enter the new root password twice.
Now for the network, you are going to give the server a static IP address so it is easier to log into via SSH and Git later on.
sudo nano /etc/network/interfaces
Enter your password if it asks. The interfaces file will look similar to this:
The main network adapter is eth0, so that is the only one we be configuring. You need to make this file look like the following. Make sure you remember to use your own network information in place of what I have written.
To save the file once you are finished press ctrl-x, type the letter y and hit enter. That basically tells nano that you want to quit and yes, save the changes. Networking will now need to be restarted for the changes to take effect.
sudo /etc/init.d/networking restart
Once the network has restarted issue this command to check that the changes have taken effect. This is similar to ipconfig on a windows machine. It shows you the details for each network interface on your machine.
The 2nd line of the output should be something similar to the following:
inet addr:10.100.1.10 Bcast:10.100.1.255 Mask:255.255.255.0
I have highlighted the information you need to check. Once you are satisfied with the result reboot the server and you are finished.