HOWTO Ubuntu 16.04 LTS Base Server Setup


All of our servers will start with this install. This base server is based on Ubuntu 16.04 LTS Server.  I don’t explain much in the howto so if you have a question leave a comment or use Google.

Downloading the ISO

Visit the Ubuntu website and download the ubuntu 16.04 server ISO.

Initial Install

The install screens are straight forward.  I’m not going to cover them in much detail.  I will cover areas that have settings that are important.  Boot the install DVD.

When you get to the software selection screen select the following software packages.
– DNS Server
– LAMP Server
– standard system utilities
– OpenSSH Server

Click ‘Reboot’ when it appears.

First boot

Reboot the machine when the install finishes.
The OS will boot. Log in. All the commands need to be run as root so lets start a shell with root privilleges.
> sudo bash

Get everything updated and install a couple of items.
> sudo apt-get update
> sudo apt-get install nano net-tools
> sudo apt-get upgrade

WARNING: My server isn’t directly connected to the internet. The firewall is disabled to help with installation, configuration and testing easier. Once everything is working, turn on the firewall and configure it. I wil remind you to secure your server at the end of this howto.

now reboot the server.

The Second Boot – Installing Additional Packages

We need quite a few other packages. In this howto I’m installing packages regardless if they were already installed by another dependency. This guards against package changes that could cause a package to not be installed. Once again log in to your server.

We need the webmin repo. Create webmin.repo with the text below.
> sudo nano -w /etc/apt/sources.list.d/webmin.list

deb sarge contrib

Install the webmin key.
> wget
> sudo apt-key add jcameron-key.asc

Now bring everything up to date.
> sudo apt-get update

Install the following packages. Multiple lines to make cut and paste easier.
> sudo apt-get install make screen snmp composer libcurl3 unzip
> sudo apt-get install libapache2-mod-fastcgi php7.0-fpm

Install some extra PHP libraries.
> sudo apt-get install php7.0-gd php7.0-snmp php7.0-mbstring php7.0-mysql
> sudo apt-get install php7.0-odbc php7.0-imap
> sudo apt-get install php7.0-xmlrpc php7.0-dba php7.0-mcrypt
> sudo apt-get install php7.0-soap php7.0-zip php7.0-intl php7.0-curl

Now lets install webmin.
> sudo apt-get install webmin
> sudo systemctl enable webmin
> sudo service webmin start

Configure Apache and PHP

Enable the rewrite module.
> sudo a2enmod rewrite

Enable mcrypt in php.
> sudo phpenmod mcrypt

Reload apache.
> sudo systemctl restart apache2.service

Installing and Configuring phpMyAdmin

I prefer to phpMyAdmin to manage my MySQL databases.

Now install phpMyAdmin.
> sudo apt-get install phpmyadmin

Restart Apache.
> sudo systemctl restart apache2.service

Installing Postfix

Lets install postfix.
> sudo apt-get install postfix

When prompted select internet site. Next set the mail server name.

Installing cockpit

I’m trying cockpit as my server admin tool.  Do the following to set it up.
> sudo apt-get install cockpit
> sudo systemctl start cockpit
> sudo systemctl enable cockpit.socket

You can now login to https://yourserver.tld:9090 to administer your server.

Getting root’s and other’s mail

You need to get some local system user’s mail. We’ll use postfix’s virtual file to get the emails to the right place.

Add the following to /etc/postfix/virtual

root admin@yourdomain.tld
postmaster admin@yourdomain.tld
abuse admin@yourdomain.tld

Now add the configuration option to
> sudo postconf -e “virtual_alias_maps = hash:/etc/postfix/virtual”
Just a couple commands to wrap everything up.
> sudo postmap /etc/postfix/virtual
> sudo systemctl restart postfix

Final Settings

You may want to enable the linux firewall.
Set your timezone in /etc/php.ini


That’s it for the basic server setup. This is an example of a standard linux server setup. Be sure to use setup or webmin to set which services you want to start at boot time. See the other pages for info on configuring servers for virtual webhosting or virtual email hosting. Remember to configure the firewall on the server.

Notify of
Inline Feedbacks
View all comments