1.6 KiB
1.6 KiB
Ubuntu Server 2.2: Checking a system meets requirements
A script that checks CPUs, memory, disk space and the release, whether the machine can run VMs, and what already listens on the ports an application wants.
Before you start
The lab starts two services of its own that listen on ports the next
application wants, as on a server someone else set up. Reset deletes
your check.sh again. Write answers to the files in /root/lab-answers/.
Tasks
- Write a script
check.shin your home directory that prints PASS or FAIL for each of: at least 2 CPUs, at least 2 GiB of total memory, at least 10 GiB free on/, and Ubuntu 24.04, one line each, in that order. Each result must match whatnproc,free -g,df -h /and/etc/os-releaseshow by hand.free -grounds down, so a VM given exactly 2 GiB shows1and fails the memory test. - Find out whether this machine could host KVM guests itself (write
yesornoto/root/lab-answers/2-kvm), and whether it's a virtual machine (write whatsystemd-detect-virtprints, such askvmornone, to/root/lab-answers/2-virt). - Find whether anything already listens on TCP port 80 or 5432, and on
which addresses. Write one line per listener to
/root/lab-answers/3: the port, the address and the program's name, such as8080 127.0.0.1 python3.
Hints
nproc,free -g(orMemTotalin/proc/meminfo),df -BG /(ordf --output=avail),. /etc/os-releaseand$VERSION_ID;[ ... ],if,echo.lscpu | grep -i virtualization,grep -Ec 'vmx|svm' /proc/cpuinfo;systemd-detect-virt.sudo ss -tlnp;0.0.0.0means every IPv4 address.