Configuring a fresh server
Step by step guide on setting up a server.
- example
- markdown
Setting up a new server
Please choose the latest Ubuntu LTS version. At the time of writing it is version 26.x.
When ordering the server, please already provide your public SSH key. Then when the server is setup you can access it using ssh root@<server_ip>.
To configure a newly acquired server, follow the following steps.
First things first - disabling root access
apt update
apt full-upgrade
apt install -y ca-certificates curl gnupg git unzip rsync htop ufw make
hostnamectl set-hostname staging # or any other hostnameCreate a normal server user
adduser dev
usermod -aG sudo devCreate a SSH directory
mkdir -p /home/dev/.ssh
chmod 700 /home/dev/.ssh
chown -R dev:dev /home/dev/.sshPut your public SSH key into
Copy your and the other existing SSH public keys (from other server) into /home/dev/.ssh/authorized_keys.
chmod 600 /home/dev/.ssh/authorized_keys
chown dev:dev /home/dev/.ssh/authorized_keysPlease test by SSH-ing into staging by using user account dev
ssh dev@<staging_ip_address>
If all works, then we can disable root access using the firewall.
Disable root access
sudo nano /etc/ssh/sshd_config
# Then set the following properties:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yesValidate the configuration
sudo sshd -tIf that gives no output, the configuration syntax is valid. Then reload SSH:
sudo systemctl reload sshOne additional Ubuntu step is to lock the root password:
sudo passwd -l rootCreate SSH public key
ssh-keygen -t ed25519 -C "your_email@example.com"Install docker
https://docs.docker.com/engine/install/ubuntu/
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt updateInstall the docker packages
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginVerify that the installation is successful by running the hello-world image:
sudo docker run hello-worldLinux post installation steps.
sudo groupadd docker
sudo usermod -aG docker $USERLog out and log back in so that your group membership is re-evaluated.
Getting started with portal
Add the created public key to gitlab so that production server can access repositories.
Run git clone.
Install Volta
Volta must be installed before running the portal server. It provides Node at the version pinned
in the portal's package.json (the volta field), so the server always runs the intended Node
version. Install it as the user that runs the portal:
curl https://get.volta.sh | bashOpen a new shell (or source ~/.bashrc) so volta is on the PATH. Volta automatically fetches
the pinned Node version the first time you run node or npm inside the portal checkout.