Disclaimer
This little tutorial is by no way exhaustively complete, but it provides a simple step-by-step guide on how to install a generic Ubuntu server. This article was written while working on the Active Directory, Samba Edition series, as I decided that such “generic” servers will be required in future tutorials.
It is presumed that you are able to use a command-line based text editor, such as vi or nano. If you don’t feel you’d be able to do that, read this article about the nano text editor first.
First things first
The hostnames and IP addresses of the Ubuntu Server we are going to install in this tutorial are as required for the Active Directory, Samba Series article series. NOTE: these series are still a work in progress, so please be patient. I will update this article as soon as the series are published.
To be more elaborate:
- The hostname of the server is
dc01.raginagi.local
- The IP address is
10.5.5.10
, with the netmask of/24
(255.255.255.0
) - Default route (some might know this as “default gateway”) is
10.5.5.1
. - For now, we are going to have only one DNS server specified, that is
8.8.8.8
. - We are going to install everything on a single hard drive which has a size of 10 GiB (do not laugh here, this is a virtual machine ;))
In fact, the only way how this might differ from a “real iron” is MDRAID Linux software RAID configuration. And even then, if you have a supported hardware RAID controller, this is not something that you need. I promise to write a separate article on MDRAID later. ๐
Off we go
First, you need to download the Ubuntu Server 16.04 LTS ISO image from Ubuntu’s website and burn it to a DVD (burning is not required, of course, if you are installing a virtual machine). I am not going to elaborate on this here – just google it (or click here). ๐ As to edition which you should choose – if you are low on memory (less than 2 gigabytes), choose 32 bit, otherwise 64 bit is almost always preferred. In fact, if you are going to upgrade memory in the future, I highly recommend choosing a 64 bit edition in any case, as it is not possible to change over to 64 bits later – this requires a complete reinstall.
Then, boot your server from the install image.
First, the bootloader will allow you to choose the desired language. As to servers, I personally choose to select English regardless of the fact that my mothertongue, Latvian, is also available. If there are any error messages, it’s way easier to search them up in Google if they are in English. I am not so sure about other “large” languages, but this tutorial is for the English edition anyway. You are free to choose what you wish, though.
Next, you have several options to choose from:
Normally, you would choose “Install Ubuntu Server“. As to the second option, “Multiple server install with MAAS” – I will probably cover this in a future tutorial, but for now, just forget this. If you are using a physical DVD that you just burned, and not an ISO image that is mounted to a virtual machine, it might be a good idea to use the third option first, which will check whether your DVD reads well and without any errors. As to the fourth option, “Test memory” – it’s a good idea to run this tool, Memtest86+, on any physical machine prior to its deployment in production. Even if your server’s memory seems to be working at first, it may hide some treacherous problems that may surface later and create all kinds of stability issues with your server. As to the last 2 items, you do not need them to install your Ubuntu Server. You might need the last one, “Rescue a broken system“, if your installation has gone nuts, though, but this requires considerable amount of expertise anyway, and, should you be using this option, you probably do not need this tutorial at all.
Once the setup has booted (it’s pretty fast), you choose the installation language again. Choose whatever you wish, but please take into account the notice I gave previously. I would choose English.
Then, you may choose your country, i.e. your geographical location. If your country is not in this short list, choose “other” here. Afterwards, you will be able to choose your region (Europe in my case) and country (Latvia in my case).
While you chose your geographical location previously, now you have to choose your locale settings. They are also known as regional settings. Ehmm, this is all about how dates, time and numbers are displayed.
In the next screen, you are asked if you would like Ubuntu setup to detect your keyboard layout automatically or would like to select a default keyboard layout from a list. Normally, just choose “No” and select whatever you like. Note that this is a server, and you probably do not want anything else than English (US) keyboard. Should keyboards in your country have keys mapped in a different way, choose your country’s keyboard afterwards.
After a quick hardware detection procedure that follows, setup will try to bring up your networking. If you have multiple network cards, you will be asked which one will be used for now. First, autoconfiguration using DHCP will be attempted but, should you not have a DHCP server in your network, you will be presented with an opportunity to configure your network settings manually.
First of all, you will have to enter your server’s desired IP address:
Then, the netmask:
Default gateway, of course:
And name (DNS) servers, of course. If you happen to have multiple name servers, enter them all in that single line, separated by spaces.
The next thing is setting the hostname. For our example, we will be installing the first domain controller of our Samba domain, so let the hostname be “dc01
“:
Then, the domain has to be entered. We will be provisioning the “raginagi.local” Active Directory domain later, so let’s use the same one here.
After that, you will have to enter the full name of the administrative local user. In UNIX-type systems, historically the “root” user has been the one which can do everything, including wiping out the system without any confirmations. Ubuntu has the root user disabled by default (it can be enabled later, when the system is installed), so let’s create a user called “administrator”.
We entered the user’s full name previously, so now let’s enter its username:
Obviously, a password has to be set as well. Choose a decent one.
It is possible to encrypt the user’s home directory (user profiles are called their home directories in UNIX type systems). Let’s choose “No” for now when asked.
Now, we have arrived at one of the most funny parts – disk partitioning. As this is a good topic by itself, and to make it easier to write and publish additions to this article later, this is a separate chapter.
Disk partitioning
While Ubuntu setup offers you to partition your disks automatically, I usually choose “manual” just to have some more granular control over the process. In some situations, it might not be easy to change this configuration later, so it’s better to do things well since the very start.
So, let’s choose “Manual”.
Given that your hard drives are fresh and contain no partitions on them, you will see all of them in this list.
Highlight and press Enter on each to create an empty partition table on the drive you are going to install the system to. They are actually not yet written to the disks, but this operation is neccessary to be able to create the partitions themselves.
After the partitions are created, you will see “free space” under each disk drive.
As we have only one hard drive in our current configuration, we want to create two partitions on it. One would be used for the swap file, the other for the system itself.
Highlight the “free space” line and press Enter on it do open the partition creation dialog.
After you choose “Create a new partition”, you will be asked for its size. As the first partition will be used for swap, let’s enter 1 GB here. Yes, just type in “1 GB” and press Enter. As to swap size, the rule of thumb, at least in the good old days, was to create swap 2 time the size of RAM, but in my experience, these days, if you have enough RAM, you can live with a very small swap partition or even without it.
After that, you will be asked about the partition’s type. For the good old MBR partitions, you can have just 4 of them. To work around this, one of those 4 can be created as a “extended” partition and host some more partitions. As we are going to use just 2 partitions on our hard drive, let’s choose “Primary” here.
Location? Beginning of the free space, obviously.
Now it’s getting interesting. “Use as” allows us to choose what we are going to use this partition for. Choose “swap area” here. While Linux systems do allow to use a swap file instead of a swap partition, partition will be faster due to lack of file system overhead. After you are done, navigate to “Done setting up the partition” and press Enter.
As you see, now we have a single partition created, as well as some free space left over. Highlight “free space” again and press Enter on it to create another partition.
As to size, leave whatever it offers – that’s the remaining amount of free space on this disk. You may enter your own amount here, should you wish to do so.
Primary, again.
Partition settings:
I suppose I need to elaborate on this a little bit. “Use as” is set to “btrfs journaling file system“. It’s the brand new, glossy & shiny filesystem for Linux with an aim to replace the previous ext4. While ext4 works pretty well, I personally miss the ability to create volume snapshots on it to be able to take “frozen”, consistent backups. btrfs has lots and lots of more interesting features. You MAY choose “ext4 journaling file system” here, but I’d choose BTRFS. You can read more about it on Wikipedia.
As to mount point, choose “/
” here. See, UNIX systems do not have drive letters like Windows does. Instead, you have some kind of a “root” or “/
“, as it is called, file system, and “mount” all other devices in empty directories withing the “root” or any previously mounted file systems. Such empty directories are called mount points. The “root” file system has the mount point called “/
“. Also note that UNIX systems, including Ubuntu, use “/
” as a directory separator, unlike Microsoft Windows, which uses “\
“.
Otherwise than setting these who items, you’re done. Press “Done setting up the partition“. Alternatively, for instance if you are using SSD, you may wish to select “Mount options” and select “noatime
” and “nodiratime
“. This means the file system will not write information about the last access time of files (noatime
) and directories (nodiratime
). This will reduce the amount of disk writes and thus lengthen the lifespan of your SSD.
When you’re done, choose “Finish partitioning and write changes to disk“.
You will be asked for a confirmation.
Finishing the installation
The next thing you need to choose is whether your network requires a proxy to access the Internet. If you haven’t heard this word before or are unsure, just leave this blank. ๐
Next, you need to choose what to install. As we can (and will) install all the necessary packages after the system is up, choose “OpenSSH server” to be able to access the machine via SSH later, using PuTTY on Windows, OpenSSH client on Linux or any other SSH client application.
After that, the actual installation will take place.
The GRUB boot loader is a tiny program which starts up before the Linux is loaded and its task is, ehmm, to start up your Ubuntu Linux system. So, yes, you want to install it.
Seems that we are done. Press “Finish” to reboot. Your DVD will be ejected and your server (or virtual machine) will reboot into the brand new Ubuntu Server operating system.
While some might think this doesn’t look very shiny, this is how an Ubuntu Server looks like:
Type in the username (administrator
) and password you entered during the installation process. Please note that, while you type in your password, no placeholder characters such as “*
” will be typed. For novices, this may lead to an impression that something is not working as it should. It does work, though. Just type in your password and press Enter.
Once you are logged in, type this command:
sudo apt-get update
What it does is it updates the software information in the software repositories. Such repositories are something akin to Apple’s AppStore or Google Play. Updating repositories is similar to checking for updates in Windows systems.
Once you press Enter, you will be asked for your password again. See, I wrote about the root
user previously. Our user, administrator
, is not as powerful and can’t do system-related tasks without the sudo
command. sudo
means “Super User DO“, and allows, after confirming this with your password, to perform administrative activities. Think of it as something similar as Windows UAC, although it must be admitted that sudo
existed before Windows was even conceived. ๐
Once the repositories have been updated, type another command:
sudo apt-get dist-upgrade
This will update your system.
When the upgrade tool asks whether you want to download and update the specified packages, type Y
and press Enter.
When the packages are updated, you might also wish to reboot the server, using this command:
sudo reboot
Should you wish to shut it down, type in this:
sudo shutdown -h now
Now you know some of the most basic commands as well, and they will be used in other tutorials in this blog. ๐
Enabling the root user (purely optional)
There are actually two steps you might want to perform. One of them is enabling console login and another is allowing root
to log in via SSH, which also requires the first step to be done. While this may reduce the security of your server, should you wish to enable root
, do this:
- Log in as administrator user
- Type in this command:
sudo su -
As explained previously, sudo
means execution of a command with superuser (root
) privileges. su -
, on the other hand, changes the user (Switch User). As we are executing it with superuser privileges, in this particular case we will get switched over to root
user.
3. Type in this command:
passwd root
This command will ask you to enter a password for the root
user. Choose a good, secure password for this and enter it here. Afterwards, you will have to re-enter it again.
4. Type “exit
“, then press Enter, then “exit
” again, then Enter, to log out from the system.
5. Log in as the “root
” user.
To enable remote access via SSH using the root
credentials, you will also have to edit the /etc/ssh/sshd_config
file, find the line called “PermitRootLogin
” and replace “WithoutPassword
” with “yes
“. Then, restart the SSH daemon or reboot your server.
Congratulations! Now you have a generic Ubuntu server running and can proceed with other tutorials that refer to this one.