It might be the first server of many in a growing database or an additional workhorse being set up to work as part of an existing infrastructure; whatever the case, there are a number of important points to consider to make sure you get the most out of your servers, and that you've covered all your bases for best practice setup protocol.

We've built this checklist to carry you through the server setup process and make your life a lot easier. Just follow the instructions in each task and rest assured that most of the hard work has already been done for you.

Let's get started!

Getting started:

Record server setup details

Before you busy yourself with the installation specifics, take some time to record a few basic details about the setup process.

These logs are useful in the future in case you ever need to check accountability, and some fields even trigger conditional logic further on in the checklist to make your job that little bit easier.

Fill in all of the form fields before moving on to the next task.

First name of server setup technician

Last name of server setup technician

Date of server setup

What operating system is running on the computer used to prepare the boot image?

Initial setup:

Download Ubuntu Server

To start things off, you'll need to get yourself a copy of a bootable ISO image to load onto a USB stick in the upcoming tasks.

First, make a backup copy of /etc/default/grub. In case something goes wrong, you can easily revert to the known-good copy:

sudo cp /etc/default/grub /etc/default/grub.bak

1

Backup made of default grub configuration

Then edit the file using the "gedit" command or whatever text editor you use:

sudo gedit /etc/default/grub

Once inside, find this parameter:

GRUB_DEFAULT=0

and change it to:

GRUB_DEFAULT=x

where "x"is the index number of grub menu item to which you would like to boot to by default, starting at 0 (first item).

If you forgot the order of the items, take a look at/boot/grub/grub.cfg.

menuentry 'Ubuntu Server 16.8' [options] {

You can also chose the default by the name instead of index, e.g.:

GRUB_DEFAULT='Ubuntu Server 16.8'

if there was amenuentry 'Ubuntu'line on/boot/grub/grub.cfg.

FInally, build the updated grub menu and you should be ready to restart into the installer:

sudo update-grub

Boot up the Ubuntu installer

If you did everything correctly up to this point, the next task should be as easy as restarting your computer and watching the boot medium load up the installer.

Did the Ubuntu Server installer boot successfully?

Restart the checklist

Since the bootable medium didn't work, something went wrong during the process of configuring the USB drive.

Try restarting this checklistwith another ISO image or USB drive; or perhaps try preparing the bootable USB from a different operating system.

Install Ubuntu Server

Installing Ubuntu Server is now as simple as following through the installer menu's choices. Follow the steps in the sub-checklist below to make sure that everything's set up correctly.

1

Check "Download updates while installing"

2

Check "Install third-party software"

3

Erase everything else and install Ubuntu

4

Enter your user details

5

Wait for the install to complete

Ubuntu server setup:

Unlock the root user

Open the terminal window and run the following command, inputting your user password when prompted:

sudo passwd root

You will then be prompted to create a new password for the root user account. Once you've entered that twice, type this command into the terminal:

su -

and input your new password as requested.

You should now have access to the root account, and will be able to grant root privileges to newly created user accounts.

Create a new user account

This new account will be granted with root powers privileges viasudo commandand will be used to perform administrative tasks in the system. Make sure you setup a strong password to protect this account. Follow theadduserprompt to setup the user details and password.

sudo adduser ubuntu_user

By default, as a security measure, the root account is completely disabled in Ubuntu. In order to create a new account on the system, log in to the system with the account user with root privileges and create a new account with the below command.

For now, the new added user cannot perform administrative tasks via sudo utility. To grant this new user account with administrative privileges you should add the user to “sudo” system group by issuing the below command.

sudo usermod -a -G sudo ubuntu_user

By default, all users belonging to the “sudo” group are allowed to execute commands with root privileges viasudo utility. Sudo command must be used before writing the command needed for execution, as shown in the below example.

sudo apt install package_name

Test if the new user has the root privileges granted, by logging in to the system and run theapt update command prefixed with sudo.

su - ubuntu_user
sudo apt update

Give the new account root privileges

Next it is a good idea to give the new account admin privileges. This essentially means that the new user will be able to enter commands with admin privileges by putting "sudo" before the command.

As the rootuser, enter the following command, once again with "username" replaced with the name of the new user:

# gpasswd -a username sudo

This will save you a huge amount of time and effort in the long run, as you will now not have to log back into the root user account to perform administrative commands.

Linux, Apache, MySQL, PHP (LAMP):

Install Apache

We're getting somewhere! It's time to install the first of the web server softwares; Apache.

There's a reason that Apache is the most popular web server in the world, and so it's time to join the ranks by installing Apache onto our server. Start off by entering the following commands:

sudo apt-get update
sudo apt-get install apache2

You will be asked to verify your user's password, which you should obviously oblige with. Now do a spot check by entering the following address into your web browser.

http://your_server_IP_address

Once again "your_server_IP_address" should be replaced with the actual IP address, and if you see the default Ubuntu Apache web page (above), then congratulations! The installation succeeded.

Install MySQL

Now it's time to set up your server with a database management system, which is where MySQL comes in.

Once again, you need to enter a command to get the installation going, this time being:

sudo apt-get install mysql-server php5-mysql

You will also need to select and confirm a password to be used for the MySQL root user - for obvious reasons, it shouldn't be the same password as your server's root user. This will essentially be a second root user account on the server, but it will be specific to MySQL.

Set up MySQL

Now that it has been downloaded and installed, you need to enter some additional commands to set up the MySQL environment securely.

First, you need to create a database directory structure where MySQL will store its information, and then run a security script to tighten up access. This can be achieved with the following commands:

sudo mysql_install_db

sudo mysql_secure_installation

Enter the password you just selected for your MySQL account and hit "n" to decline the offer to change it. All other prompts should be cycled through by hitting "Enter".

Install PHP

You're on the final package of LAMP installation now; you need to install PHP. This will perform a number of incredibly useful tasks, such as processing code and passing it to your web server to display.

You guessed it; time for more commands! Much like with the MySQL command, we've included some really nifty helper packages, so don't worry about setting up a server with limited resources.

This time, the command is as follows:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Whilst we're here, you also need to integrate PHP into the Apache server so that PHP files will be prioritized. To do this, first open "dir.conf" in your text editor with this command:

Save your changes and exit the editor (remember to also confirm the save once the document is closed).

Restart the Apache server

Due to the PHP configuration with your Apache server, you now need to restart the server to ensure that the changes take effect.

Nothing convoluted or complicated in this step; all you need to do is enter this command:

sudo service apache2 restart

Install any optional PHP packages

PHP is installed and ready to use; the next step is to take a look at the additional PHP modules and install any that take your fancy.

To start off, you'll need a list of all of the optional components for PHP which you can install. You can get this up by entering (surprise, surprise) the following command:

apt-cache search php5-

The list returned to you will include all of the modules' names and a brief description. Use this command to focus down on a particular component:

apt-cache show package_name

You will need to replace "package_name" with the name of the package you want to examine, such as "php5-cli". Amongst the mass of data returned to you when examining a component, the in-depth description will appear under the "Description-en" field.

If, after doing a little research you want to install a module, enter the following command:

sudo apt-get install package1

Replace "package1" with the name of the module you wish to install, and if you want to install multiple, just put a space between each module name.