Ubuntu 16.04 / 17.10 Initial Server Setup

Last updated on

In this guide we will configure your new Ubuntu 16.04 / 17.10 server.

Prerequisites

If you don’t know how to access terminal via SSH, please see one of the following guides:

1. Create User with Sudo Privileges

Firstly, log in to terminal as root.

The root user is the administrative user in a Linux environment that has heightened privileges and you are discouraged from using it on a regular basis. It is recommended that you set up an alternative superuser account. In this example we are going to add a new user called john.

adduser john

You will be prompted to enter a new password. Generate a complex password and keep it safe. Once you’ve entered your new password, you will also be asked to enter contact details, just press ENTER for defaults.

Once user is created, give it superuser privileges.

usermod -aG sudo john

From now on, you should only log into your Linux box using this new user.

Finally, log out of the root account.

logout

Now log in again with your new user account and continue with this guide.

3. Set up SSH Key-Based Authentication (optional)

You may skip this step but it is recommend for added security.

As well as offering additional security, SSH key authentication can be more convenient than the more traditional password authentication. Please see one of the following guides:

4. Set Up Firewall

It’s always a good idea to set up a firewall to make sure only connections to certain services are allowed.

Allow OpenSSH so we don’t get locked out.

sudo ufw allow OpenSSH

Enable Firewall and press y and ENTER when prompted with a warning.

sudo ufw enable

To check the status of the firewall, run:

sudo ufw status

Here we can see the OpenSSH rule we just added.

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

5. Check the Timezone

To check if the server time and timezone are correct for your region, run:

date

If the date, time or timezone are incorrect, please see article: Change Timezones and Set Up Time Synchronization

6. Update Ubuntu

Run the following commands to download and install the latest packages.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Once updated, reboot:

sudo reboot

For more information, see: How to update Ubuntu in terminal

7. Begin Configuring a Web Server

Now that you’ve completed the Ubuntu initial server setup, have a look at our other guides for configuring a LAMP or LEMP web server.

LAMP (Linux, Apache, MySQL, PHP)

LEMP (Linux, Nginx, MySQL, PHP)

phpMyAdmin

FTP Server

SSL Certs

PHP mail() and Postfix

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

Leave a reply

Your email address will not be published. Required fields are marked *