Midterm exam exercises. November 5 2024. Time 6:40 p.m. – 9:00 p.m.#

Number of exercises: 5. Each exercise has a maximum score. In home directory of user hostadm, you need to create a new subdirectory, MIDTERM and a file within it, answers.txt, where you will be writing answers to the exam exercises.

In the file, first, put your name, then proceed with answering to the questions below.


1. VM deployment in KVM (max score 2)#

A) Create a new VMs, fall24, by cloning kvm1.

B) Find out the IP address of the VM.


2. User accounts (max score 4)#

On both your desktop and the VM, create user acount midterm with uid 2000, gid 2000, and home directory in /NFS/home/midterm.


3. NFS (max score 6)#

A) On fall24 VM, install NFS server packages, and export directory /NFS/home to the desktop.

B) Mount the NFS directory on the desktop.

C) Verify that user midterm can write into the NFS mounted directory on the desktop.


4. Linux packages and command find (max score 4)#

A) Download package libc6-dev into directory /NFS/home/midterm without installing it.

B) Extract package into new directory PKG created in /NFS/home/midterm.


5. Commands find and tar (max score 4)#

A) In directory PKG, find the relative path to file struct_sched_param.h

B) In directory PKG, find the relative path to directory include.


Answers#

1. A) virt-clone -o kvm1 -n fall24 -f KVM/fall24.qcow2
   virsh start fall24
   virsh console fall24

   Fix the hostname. Reset machine id.

   B) ip a
      192.168.122.217

2. groupadd -g 2000 midterm
   mkdir -p /NFS/home
   useradd -d /NFS/home/midterm -m -g 2000 -u 2000 -s /bin/bash midterm
   

3. A) install the generic kernel:

     sudo apt install linux-image-6.5.0-45-generic
     reboot
     sudo apt remove linux-image-5.15.0-1059-kvm

     apt install nfs-common nfs-kernel-server

     /etc/exports contains:
     /NFS/home  192.168.122.1(rw)

    systemctl restart nfs-kernel-server

   B) apt nfs-common
      mkdir -p /NFS/home

      Find the IP address of fall24 VM:
      virsh domifaddr fall24
           
      Say IP address is 192.168.122.217.
      showmount -e 192.168.122.217
      mount 192.168.122.217:/NFS/home /NFS/home

      df -h

4.  A) su - midterm
       apt download libc6-dev
    B) dpkg -x libc6-dev_2.35-0ubuntu3.8_amd64.deb PKG

5.  A) find PKG -name struct_sched_param.h
         PKG/usr/include/x86_64-linux-gnu/bits/types/struct_sched_param.h
    B) find PKG/ -type d -name include
         PKG/usr/include