Building a Ubuntu Linux Server for projects
You will need:
- Virtual Box or other Virtualisation product
- UBuntu 14.04 LTS (http://www.ubuntu.com/download/server)
Setup a new virtual machine with a single CPU and memory to run Ubuntu (1Gb should be sufficient). You will need to configure the network adapter so that it is on the same network as other machines in the network. In Virtual Box, this is known as Bridged Mode.
Insert the downloaded ISO image into the Virtual Machine and boot up.
Select your preferred language and press Enter
Then select the “Install Ubuntu Server” option to begin the installation
Once again, choose your preferred language and press Enter
Configure the Keyboard – I usually choose the No option and manually select the keyboard.
Once you’ve selected the keyboard layouts, Ubuntu will start gathering information about the hardware and attempt to configure the server with an IP address. If it has problems getting an IP Address from DHCP, you will be prompted to enter an IP address.
Next you will need to enter a Host name, in our example we will enter “filter”
Next you will need to Enter the full name of the administrator account. It’s usually best practice to enter this as the “school” or “organisation” rather than you as an individual.
Next specify the “Username”. It’s a good idea to choose a username that is short. You won’t be able to use names like root, administrator or admin.
Next enter a password for the account. A strong password is recommended, for security reasons this should not be the same as your regular Windows account.
Next you will be given the option to encrypt the home directory. If this was a laptop or portable device then it might be a good idea to do this, but in our case this is not relevant since no personal data will be stored in these folders.
Ubuntu will automatically assume a time zone, if the time zone is correct, then choose Yes, otherwise choose No to select a time zone that better matches your location.
The Installer will now prompt how to configure the disks. Choose the option “Guided – use entire disk and setup LVM”
Select the disk to partition – Note that any data on the disk will be deleted.
The final stage of partitioning the disks is to confirm that you want to erase any previous configuration. Confirm that you are happy to loose anything that is on the disk by choosing the Yes option to write the changes to disk.
When prompted for the amount of space to use, enter “max” and then continue.
You are then once again prompted to confirm changes to the disks, choose Yes to continue.
Ubuntu will now be installed to the disk
Ubuntu will need to connect to the internet during the next stages so that updated software can be downloaded. If you are required to access the internet through an upstream proxy server, enter this now.
Ubuntu installation packages will be downloaded.
Automatic Update: Choose the option that you want for updating Ubuntu. Choose “Install Security Updates automatically”. You can choose the “Landscape” option but you will need to register with Ubuntu to take advantage of that.
The Wizard will finally show the software selection screen. Choose the “OpenSSH Server” and then continue. Whilst we can use the console to configure the Ubuntu server, its much easier to use a terminal window as this will allow copy and paste ability.
The Wizard will download further software packages and apply them.
Towards the end of the installation, we now need to install the boot loader. Choose the default option – Yes.
At the end of the installation a reboot is required.
Allow the server to reboot, the logon prompt will then be displayed once ready.
Login using the User ID and password from earlier in the installation.
Ubuntu is now ready to use and configure, but first things first. Whilst the console of the virtual machine is easy to use, you will find accessing using a Terminal Window much easier and more flexible. In order to connect to the new Ubuntu Server we will need to find its IP address (we can also use the host name if the workstation is able to resolve it).
Getting the Ubuntu Server IP Address
At the command prompt, enter ifconfig, then press enter. Note that this command is nearly identical to the Windows IPConfig. The IP address will be displayed usually on the second line.
Now that you have the IP address of the server you can use a Terminal Program to connect to the server remotely. A free Windows SSH (Secure Session Host) Terminal Emulator is called Putty. Download Putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Once installed, simply run Putty, enter the IP address of the Ubuntu Server, then click the Open Button.
The first time that you connect to the remote server, you will see a warning similar to below. Since this is a new Server, click Yes to accept and store the encryption keys from the new server.
Enter your User ID and Password that you specified when installing Ubuntu
Getting to grips with SUDO
The user account that you created when setting up the Ubuntu Server doesn’t have any permissions to alter files in the system, so just like UAC on Windows, you need to elevate the user permissions. In the Ubuntu world, this is done by typing the command SUDO followed by the command that you wish to run. When using SUDO, you will be prompted to enter an account password – don’t worry, this is the password that you used to login to the server – also SUDO won’t prompt you to enter the password again for 10 minutes of so.
There is another useful command called SU, this is used to switch the context of the user to a different account. So for example to save you having to type the word SUDO before every command, you could run the command SUDO SU to switch the context to the root (super user) account.
Ubuntu has an update system like Windows does, although the system does far more than simple updates. The tools also allow you to install new software packages, but well cover that later. For now we’ll stick with applying the software and security updates.
Updating the software definitions list
sudo apt-get update
Upgrading the software to the latest versions
sudo apt-get upgrade
Upgrading the underlying OS kernel
sudo apt-get dist-upgrade
Rebooting at the End
If you are using Putty, you can copy the line from above and then right click in the putty window to paste – saves an awful lot of typing.
If you aren’t quite so keen on using the command line to work with Ubuntu, you can download and install Webmin which provides a Web interface to perform many different tasks in Ubuntu. See the following blog for instructions for installing Webmin – http://ubuntuhandbook.org/index.php/2013/12/install-webmin-official-repository-ubuntu/