New server primary configuration

Here is what to know about new server configuration.

Server update

As root, run the following commands to get your server up to date:

ubuntu@mylinuxserver:~# sudo apt update
ubuntu@mylinuxserver:~# sudo apt upgrade

Fail2Ban installation

Fail2Ban will check periodically logs to detect unsuccessful connections and ban them by adding rules on firewall. On Ubuntu, install it using the following command lines:

ubuntu@mylinuxserver:~# sudo apt install fail2ban
ubuntu@mylinuxserver:~# sudo systemctl status fail2ban

Fail2Ban must be active (running) and enabled.

Enabling TCP forwarding

TCP forwarding is usefull to set up SSH tunnels. To enable it on Ubuntu, edit the /etc/ssh/sshd_config or create a new file /etc/ssh/sshd_config.d/ with .conf extension and enable the AllowTcpForwarding yes property. Restart your system after that.

Install Docker

As I use Docker to deploy my private services (as this blog), I need to install Docker on the new system. Here is how to proceed:

ubuntu@mylinuxserver:~# sudo apt-get update
ubuntu@mylinuxserver:~# sudo apt-get install ca-certificates curl
ubuntu@mylinuxserver:~# sudo install -m 0755 -d /etc/apt/keyrings
ubuntu@mylinuxserver:~# sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
ubuntu@mylinuxserver:~# sudo chmod a+r /etc/apt/keyrings/docker.asc
ubuntu@mylinuxserver:~# echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
ubuntu@mylinuxserver:~# sudo apt-get update
ubuntu@mylinuxserver:~# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
ubuntu@mylinuxserver:~# sudo sudo usermod -aG docker ${USER}

At this time, reconnect to your server to be view as part of docker group, and try to execute a simple docker container:

ubuntu@mylinuxserver:~# docker run hello-world

Please follow and like us:

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.