Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit e16a570 · 18 days ago

Linux and KVM, part 2: installing Ubuntu Server 24.04 and the first 30 minutes after it

🌐 Machine-translated from Russian. Show original

In this part:

Step-by-step installation#

Boot from a flash drive (the boot menu is usually F11, F12, F8, or Esc when powered on) → Try or Install Ubuntu Server.

  1. Language — English. Error messages in English are easier to find in search.
  2. Layout — English (US).
  3. Installation type — Ubuntu Server (not minimized).
  4. Network — select the wired interface → Edit IPv4 → Manual:
    • Subnet: 192.168.1.0/24
    • Address: 192.168.1.10
    • Gateway: 192.168.1.1
    • Name servers: 192.168.1.1,1.1.1.1
  5. Proxy — empty, Mirror — leave the suggestion.
  6. Disk — Use an entire disk, check Set up this disk as an LVM group. Important: by default, the installer gives the root only part of the space. On the Storage configuration screen, select ubuntu-lv → Edit → set the size larger (for example, 100 GB for the system; the rest will be left for VM in part 4).
  7. Profile — name, server name (kvm01), your login (not admin and not root), strong password.
  8. Ubuntu Pro — Skip for now (let's return in part 7).
  9. SSH — ✅ Install OpenSSH server. If you have a key on GitHub, you can import it immediately.
  10. Featured snaps — don't choose anything.
  11. Wait for Reboot Now, remove the flash drive.

First SSH login#

From your computer:

ssh ivan@192.168.1.10

When connecting for the first time, answer yes — this is remembering the server's "fingerprint."

Updates#

sudo apt update && sudo apt full-upgrade -y
sudo reboot

Enable automatic installation of security updates (usually already enabled):

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Login with a key instead of a password#

On your computer (Windows PowerShell, Linux, or macOS):

ssh-keygen -t ed25519 -C "ivan@laptop"

Copy the public key to the server. In Linux/macOS:

ssh-copy-id ivan@192.168.1.10

In Windows:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh ivan@192.168.1.10 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Check that key login works in a new window, and only then disable passwords:

sudo tee /etc/ssh/sshd_config.d/10-hardening.conf >/dev/null <<'EOF'
PasswordAuthentication no
PermitRootLogin no
EOF
sudo systemctl restart ssh

⚠️ Do not close the current session until you are sure the new login is working. Otherwise, you will have to go to the server with the monitor.

Firewall#

sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose

Open only what you need. Even better — allow SSH only from your own network:

sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp
sudo ufw delete allow OpenSSH

Password brute force protection (useful if SSH is browsing the internet):

sudo apt install -y fail2ban

Time and time zone#

sudo timedatectl set-timezone Asia/Almaty
timedatectl

There should be yesin line System clock synchronized . Correct timing is critical for logs, certificates, domains, and backups. Since 2024, all of Kazakhstan has been living under one UTC+5 zone; in current versions of the package, this is taken into account tzdata, and updates from the step above will be improved.

Minimal useful commands#

CommandWhat shows
htopCPU and memory load (output — F10)
df -hfree disk space
ip -br aIP address
systemctl status sshservice status
journalctl -u ssh -n 50the latest service log entries
sudo ss -tulpnwhich ports is listened to by the

If something goes wrong#

  • No network — check the /etc/netplan/*.yaml file and apply sudo netplan apply. Details about netplan — in part 4.
  • Forgot password — in the GRUB menu (Shift or Esc at boot) → Advanced options → recovery mode → root → passwd ivan.

The server is ready. Next — Linux and KVM, part 3: install KVM, the Cockpit web interface, and create the first VMs with Linux and Windows.

Comments 00 участников · 0 гостей🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.