Setting up a VPS for website hosting - Part 1

Creating the server

I rent my server from Linode. Other similar cloud hosting solutions are DigitalOcean and Amazon Web Services. Once I setup an account with Linode, I created a new VPS, chose the computational capability (the lowest specs), and the location of the server. You always want your server to be closest to your audience since then it will be faster for their browser to download the website pages.

Once the type of VPS is chosen, you’ll be asked which operating system you want and be prompted to create a root password. This root password is incredibly important, but it will rarely be used. We don’t want to login and use the server as root since it would be very easy to accidentally break things. I choose Ubuntu since that’s the Linux distro that I’m most familiar with. I will use Ubuntu for the rest of this guide as well.

Once that’s done, Linode will freshly image the computer to your distro and send you an email you’re your VPS’s IP Address.

Logging into your server

If you’re on MacOS, open Terminal. If you’re on Windows, I highly suggest Windows Subsystem for Linux (WSL).

Grab your IP Address that they gave you, and in terminal, type:

ssh root@123.456.789
and replace 123.456.789 with your unique IP Address. It will prompt you for the root password. Enter that in.

Now your terminal will no longer send commands to your own computer. All commands in your terminal will be sent to your VPS

Initial server updates

The first thing to do is update your new VPS. Run these commands:

sudo apt update && sudo apt upgrade

The first command, sudo apt update is really the command apt update. This tells the VPS to search and download any necessary updates. Sudo in front means run as root, since updates are only allowed to be performed by admin level accounts. Most of the commands that we will use are prefaced with sudo

The second command, sudo apt upgrade takes those downloaded updates and installs them.

(Optional) Change the hostname

Changing the hostname:

hostnamectl set-hostname example_hostname
The hostname is the part after your username. I typically name all my computers some variant of cindy@bui

Update hosts file

There is a file on your server in /etc/hosts that stores your server's IP Address, domain name, and hostname. This is so the server knows what its own name is.

I use vim to open files in a command line interface. Quick tip: hit i to insert text and :wq to write and exit. Nano is easier to use at first for beginners, but vim is incredibly extensible and fast.

Open the file:

vim /etc/hosts
In the first line, put your IP Address, hostname, and Fully Qualified Domain Name (FQDN). A FQDN is something like The format is hostname.domain_name.

The first few lines of my file are:       localhost bui  
2600:3c01::f03c:91ff:fe02:0dc0 bui

(Optional) Setting the timezone

Setting the timezone:

timedatectl set-timezone 'America/New_York'
If you're not in NYC, use timedatectl list-timezones to find the exact string for your timezone. Use
to confirm that it worked.