Homework 4

Homework 4#

systemd

  • On run01 VM, install package tinyproxy.

  • Check the status of service tinyproxy.

  • Assign ownership of tinyproxy user and group on directory /var/log/tinyproxy.

  • Restart service tinyproxy.

  • Check the service status.

  • Browse the content of the unit file.

User environment

  • On run01, create directory /usr/local/software/bin.

  • Add the directory in the PATH environment variable for user jerry.

  • Add the directory in the PATH environment variable for all the users on the system.

Python scripting

  • On the desktop, copy file /etc/libvirt/qemu/kvm1.xml into directory Python, where jupyter notebook is running. Make the file readable for all users.

  • Develop a python script in jupyter to read the file and print out the value of RAM, number of CPUs, and the location of the qcow2 file for the VM.

  • Hint: in the lines, look for strings containing ‘memory’, ‘vcpu’, and ‘source file’, accordingly. Use module re and method split, re.split(), to separate the line content by regular expressions depicting symbols <, >, />, and =.

  • In the home directory on VD, create directory HW4. Copy kvm1.xml into directory HW4. In directory HW4, implement the above python script in executable file vm_xml.py.

  • Modify the script to read the xml file as input parameter by using sys.argv[1] in the script to reference the file then run:

    ./vm_xml.py kvm1.xml
    
  • Copy file /etc/libvirt/qemu/rocky10.xml in HW4, and run

    ./vm_xml.py rocky10.xml