I am a danish programmer living in Bangkok.
Read more about me @ rasmus.rummel.dk.
Webmodelling Home > How to install Ubuntu server
Do good

How to install Ubuntu server

Updated 14 Mar 2013. This tutorial is a step-by-step guide how to install an Ubuntu server and take a few baby steps.

Install Ubuntu server

First off : installing an Ubuntu server is extremely easy and barely needs a tutorial, anyway it can be nice to have someone to hold your hand first time you go somewhere.

  1. Prepare your physical server machine and your Ubuntu install media (eg. CD or USB) :
    1. Download Ubuntu
    2. Create a USB installer :
  2. Boot your server machine on your Ubuntu install media.
  3. You are presented with a language selection for your installation session.
  4. Install media options - select "Install Ubuntu Server".
  5. Select default system language.
  6. Select your location, eg. for me I would select "Other" and then find Thailand.
  7. I want to select my keyboard layout from a list, so I press the "No" button (dependent on your location select before, there may be more screens before you arrive at this screen).
  8. I want a US based keyboard layout,
  9. of which I choose the standard US layout (it even fits my key prints on my current keyboard).
  10. ... some components are loaded ...
  11. Hostname : whatever gives meaning, I call my machine for s1, for shared-1, since it is the first in an array of Favourite Design shared servers.
  12. I install on a machine connected to the internet, so the Ubuntu installer got my time zone correct.
  13. I don't want to use LVM since I will only have one (raid virtual) disk.
  14. And here is the disk (for purposes of creating screen shots, I test install Ubuntu server on a VirtualBox).
  15. Accept the partitioning by selecting yes (all content on the selected disk will be erased).
  16. ... installing ...
  17. Creating user 1 : write your real name.
  18. Creating user 2 : write a username (note that the default username based on your name is all in lower case).
  19. Creating user 3 : write a password for the new username.
  20. Creating user 4 : write the same password a second time.
  21. Creating user 5 : I don't like to encrypt my home directory, I like to be able to investigate the content.
  22. I am not using no proxy, so I just press Enter.
  23. ... installing some more ...
  24. Update method : I like to do my updates manually, I fear that automatic updates can break the system.
  25. Select software to start with (use spacebar to select, arrows to move and Enter to finish) : the single most important option is OpenSSH as it is necessary for remote control, recommended for virtual machine installation and works as a built-in SFTP server (works out of the box). In my opinion all the other options are better ignored.
  26. ... installing some more ...
  27. Accept to install the GRUB boot loader.
  28. Installing is complete - press enter to boot.
  29. After booting, you will be presented with a login prompt.
  30. Login using the username created earlier. After login you are presented with your first system prompt.
  31. The first thing I always do is to activate the root account by giving the root account a password (many Ubuntu users will automatically start to call me bad names for this).
  32. Logout
  33. Login as root and you get a root prompt.
  34. shell> apt-get update : this will update Ubuntu repository based source .list files to reflect the latest Ubuntu updates.
  35. shell> apt-get upgrade : this will upgrade the system based on the .source files.
  36. Congratulation - you are finished installing Ubuntu server.

Ubuntu basic commands

This is an Ubuntu server without any desktop or other GUI, so everything have to be handled using the command line. Here is a few commands to get you started :

  • shell> pwd : get your current location in the folder tree.
  • Navigate the folder tree :
    1. shell> cd / : go to the root folder.
    2. shell> cd /var : go to the /var folder.
    3. shell> cd www : go to the www subfolder of the current folder (notice the missing slash).
    4. shell> cd .. : go to the parent folder of the current folder (you are now back at the /var folder).
    5. shell> pwd : check that you are actually back at the /var folder.
  • shell> ls -l : list the content of your current folder.
  • System information :
    • shell> cat /etc/lsb-release : get your Ubuntu OS version.
  • See Ubuntu top management commands for a fast command reference

Bonus : Configure network

  • shell> ifconfig : display the actual network interfaces configuration, eg. your IP address.
  • shell> sudo nano /etc/network/interfaces : in the interfaces file you configure your machines network interfaces.
    • nameserver
  • shell> sudo nano /etc/resolv.conf : in resolv.conf you specify nameservers for name resolution, eg. what name server to give you the IP address of google.com.
    • DNS & resolv.conf HAVE CHANGED in 12.04, see here
  • shell> sudo nano /etc/hosts : open your hosts file in the nano editor and add the following
    • localhost
    • web1.example.com web1 : specify your fully qualified domain name and the hostname part.
  • shell> hostname : get your hostname.
  • shell> hostname -f : get your fully qualified domain name (FQDN).

Access your Ubuntu server using SFTP

SFTP is a subprotocol of SSH and is more secure and more easy than FTP to setup and use.

Bridged network (advanced)

A bridged network is ....

A bridged network is used for :

  • Allowing network access to virtual machines on your Ubuntu server, eg. if you have a virtual machine and installed an Ubuntu OS with Apache2 on it, that Ubuntu OS need to bind an external accessible IP address to it's virtual network adapter, otherwise people will not be able to browse the Apache webserver - the host servers bridged network allows virtual network adapters to bind on the host servers physical network adapter.

Bonus : a few enhancements

  • root user : it is believed that if there is no root user on your Ubuntu, then it will be more difficult for hackers to gain root access. The believe comes from the fact that not only do you need to guess the password, you also need to guess the username. I myself though don't like to write sudo before every command I execute, so I live with the percived security risk and make a root user :
    • shell> sudo passwd root : this will start the creation of the root user, you will be prompted for your own password and for the new password for the root user.
  • Firewall : all linux comes with netfilter that decides the fate of all network traffic (allow, modify or delete) and a difficult to use netfilter rule creator called iptables. Ubuntu comes with an easier to use frontend to iptables called ufw (Uncomplicated FireWall) :
    1. shell> ufw status : default ufw is disabled and all traffic is therefore allowed.
    2. shell> ufw allow 22 : create a rule that allows all traffic on port 22 (so that then enabling the firewall, you will have SSH access).
    3. shell> ufw enable : enables the firewall.
    4. shell> ufw allow 80 : allow traffic on port 80 so that a webserver can function.
    5. shell> ufw status verbose : you should now see that the firewall is enabled, that all incoming traffic are default deleted and that traffic on port 22 & port 80 are allowed.
    6. shell> ufw delete allow 80 : delete the rule that traffic is allowed on port 80. Your Ubuntu server can now not function as a webserver (on the default http port).
    7. See Ubuntu top management commands - ufw to learn more about the ufw firewall frontend.

Bonus : navigate your Ubuntu server

/var/log : many programs will put their log files here /var/www : default web root /var/spool : contain files that is considered temporarily and that should not be edited by hand (eg. the crontab files are here)

Upgrade your Ubuntu version

  1. shell> apt-get update : update your package information to get the latest packages then installing.
  2. shell> apt-get install screen : if you get disconnected, screen allows you to login to the same session you got disconnected from.
  3. shell> screen : start a screen session. If disconnected you can now reconnect to the same session by shell> screen -Dr
  4. shell> apt-get install update-manager-core
  5. shell> do-release-upgrade
  6. shell> reboot now : after the upgrade is finished it is best to boot the system to be sure the system can boot.
  7. shell> cat /etc/lsb-release : check your Ubuntu version.

Ubuntu versions

  • Ubuntu Server 12.04 Precise Pangolin : Precise Pangolin release notes
  • Ubuntu Server 11.10 Oneiric Ocelot
  • Ubuntu Server 11.04 Natty Narwhal
  • Ubuntu Server 10.10 Maverick Meerkat
  • Ubuntu Server 10.04.1 LTS (Long Term Service) Lycid Lynx
  • Ubuntu Server 9.10 Karmic Koala
  • Ubuntu Server 9.04 Jaunty Jackalope
  • Ubuntu Server 8.04 Hardy Heron


You can comment without logging in
 B  U  I  S 
Words: Chars: Chars left: 
      report  reply  
thanks for this article...
I really love it !!
keep it up good work !! :)
<a href="http://explorequotes.com/friendship-sms/">Friendship SMS</a></br>