test

Once you have a Digitalocean account, this page will explain how to:

  • Create a basic Ubuntu server
  • Add domain name entries for common url’s for a gitlab install
  • Set up the Ubuntu server with a code user
  • Configure the firewall
  • Copy the root public SSH keys to the code user’s directory

First, click Create in the top right, and click the first item Droplets

do create droplet

Leave it as an Ubuntu 20.04 server, and change the server type to the $20/mo shared 2vCPU 4GB memory option.

do 20 droplet

Scroll down, and select where you want your datacenter region. The closer to you, the better.

do 20 droplet 2

Scroll down again, and make sure that your SSH key is selected.

  • You can also choose to give your server a hostname.

do 20 droplet 2

You can also choose to add backups.

do backups

Now that you have everything selected, you can click Create Droplet.

We can see our domain, and our Droplet being created in our Digitalocean dashboard.

do drop create

Once our droplet has been created, let’s click our 80pxtesting.com domain and add some settings to point to our new Gitlab server.

We’re going to tell our domain settings to point to the gitlab, registry, and mattermost subdomains (code.80pxtutorial.com, registry.80pxtutorial.com, and chat.80pxtutorial.com) we’re going to use to the server we just created.

We’re going to use simple DNS A records, so you just have to click on the domain, then you are presented with what you want to change in the box.

Here is an example of saying we want a subdomain of code and we want to point it to the droplet we just made (there is only one server available to choose)

do dns 1

We hit create record, and this domain setting will now point code.80pxtesting.com to this server’s IP address. (128.199.2.115).

We do this again for our registry, and chat subdomains, and here’s what our entire DNS settings look like at this point.

do dns settings

OK, now we want to log into our server, create a safe user that isn’t root, and install and configure gitlab.

Once your DNS settings have propagated, you should be able to open up a terminal and connect to your server by typing this:

ssh root@code.80pxtesting.com

You will be asked to add this server to your list of known servers. You can type yes and hit enter to continue.

add known ssh server

Awesome, now we’re in the server.

add known ssh server

You can tell the terminal we’re in now is the server because the title is no longer pxtesting@pxtesting-VirtualBox: ~. It changed to our new user and host root@code.

We’re going to reference this tutorial from Digitalocean: Initial Server Setup with Ubuntu 20.04.

  1. First, add a new user named code

    adduser code

  2. You just need a password, the rest can be left blank. Make sure to use a strong password!

add code user

  1. Give the user sudo (administrator) access

    usermod -aG sudo code

    sudo

  2. Enable the firewall so only the SSH protocol is allowed for now

    ufw allow OpenSSH

    ufw enable

    ufw

  3. Copy your public ssh key to the new code user, and use that user from now on.

    rsync --archive --chown=code:code ~/.ssh /home/code

    rsync

  4. Switch to the code user

    exit

    exit

    ssh code@code.80pxtesting.com

    codeuser

Now that you have an Ubuntu server with some good Gitlab subdomains pointing to it, let’s install Gitlab.