This is an old revision of the document!


Setup

Server Setup

  • Login to the server via SSH as root
  • Install sudo, create the main user, and add him to the sudoers group
    # apt install sudo
    adduser <username> sudo
  • (VPS) change the machine name:
    sudo hostnamectl set-hostname <new-name>
    sudo edit /etc/hosts
  • enable force_color_prompt=yes in file ~/.bashrc
  • copy /home/user/.bashrc to /root and modify PS1 prompt color (32m –> 31m)

Tuning

Network

  • In a minimal install without GUI is no NetworkManager present. Configure the static ip address first to be able to access the host.
  • Modify /etc/network/interfaces:
    auto enp0s3
    iface enp0s3 inet static
        address 192.168.3.150/24
        gateway 192.168.3.1
        dns-nameservers 192.168.3.1
  • Add the nameserver to /etc/resolv.conf:
    nameserver 192.168.3.1
  • Reboot with either of the following commands:
    sudo reboot
    sudo shutdown -r now
  • Don't forget to bridge the interface if it is a VirtualBox virtual machine.

Security

  • Configure SSH Access
  • Install UFW Firewall
  • Disable root login by changing file /etc/passwd from line 1 to line 2
    root:x:0:0:root:/root:/bin/bash
    root:x:0:0:root:/root:/sbin/nologin

Install and configure packages

  • Additional packages
    $ sudo apt update
    $ sudo apt install vim
    $ sudo apt install zip
    $ sudo apt install rename
    $ sudo apt install rsync
    $ sudo apt install curl
    $ sudo apt install hping3
    $ sudo apt install openjdk-17-jre openjdk-17-jdk
  • Change visudo editor
    $ sudo update-alternatives --config editor
  • Check install
    apt-cache policy <packagename>