Ubuntu Server - VM

Ubuntu Serverarrow-up-right


🌐 Resources πŸ”—


  • Create a new Virtual Machine in VMWare with preferred specs:

    • Processors: 1 CPU - 2 Cores

      • enable Virtualize Intel VT-x/EPT or AMD-V/RVI

    • RAM Memory: 2 GB

    • Hard Disk: 15 GB

    • CD: use the Ubuntu Server LTS .iso image file - Download herearrow-up-right - and check Connect at power on

    • Network: set it as NAT

    • Display: Deactivate Accelerate 3D graphics

    • Edit virtual machine and Remove: Printer

  • Boot the virtual machine and proceed with the Ubuntu Server Installationarrow-up-right

Installation Process

  1. Boot to Try or Install Ubuntu Server

  2. Choose the language

  3. Update to the new installer (if offered)

  4. Select keyboard layout

  5. Select Ubuntu Server as base for the install

  6. Wait for Network connection to establish via DHCP (continue without networking if this fails)

    • Do not configure a proxy

  7. Leave Ubuntu archive mirror as it is (or change based on necessity)

  8. For storage, leave Use an entire disk checked, and choose a disk to install to

    • Edit the ubuntu-lv logical volume by assigning it the max size

  9. Select Done on the configuration screen and confirm the install

  10. Enter a username, hostname and password

  11. Skip for now the Ubuntu Pro upgrade

  12. On the SSH Setup, check the Install OpenSSH server, select Done for the next 2-3 slides

  13. Select Reboot


First Boot & Update

  • Disable CD Connect at power on

  • Boot Ubuntu Server

  • Connect through SSH and/or Run the following commands

  • Reboot the system


Configurations

  • SSH into the VM

Bash aliases or ZSH

Expand Partition and Filesystem

  • Turn off the VM, increase disk space on the hypervisor, turn on the VM

  • Proceed with expanding the necessary partition on the server


Network

Static IP

  • Set a static IP in the netplan .yaml if not configured during OS installation.

  • If necessary and the VM has 2 NICs, add the seccond one in the netplan .yaml


Tuning

Basic Tools


  • Alternative to install Docker Engine (via APT)

  • ctop - concise commandline monitoring for containers


Hardening

SSH-key-based authentication

Ubuntu Server with OpenSSH pre-installed comes with PasswordAuthentication yes parameter already set inside /etc/ssh/sshd_config.d/50-cloud-init.conf (or /etc/ssh/sshd_config). If the parameter is commented, the default is yes (password auth permitted) for the sshd_configarrow-up-right.

  • Generate an SSH Key Pair on the local HOST from which the connection is established

  • Add the Public Key to a system/sudo user on the Ubuntu Server VM

If you want to use the same key saved on Github profile, having already the private key in the Ubuntu Local HOST (commands above), ssh into the Ubuntu Server VM and use the following commands:

  • Log out and log in using the Private Key

  • Disable SSH password authentication

  • Test SSH access (on the new port if changed) before closing the current session

    • Only SSH-key-base authentication is permitted

SSH-Hardened configuration

e.g. 10-hardening.conf file:


... more to come ...


Last updated