CS183 Lab 3: VI Tutorial and Software Package Management Tools

Goal: First, you will learn how to use 'vi', an old, powerful and ubiquitous editor on most versions of Unix/Linux via a self-paced tutorial. Then, you will learn about how to install and use two software package management tools: yum, from RedHat; and pkgtools, a collection of home-grown csh scripts.

VI Tutorial

To start a VI tutorial, run the command 'vimtutor' on a lab machine (not on your VM).
  $ vimtutor
Follow the instructions and you should be done in 30 minutes.

yum

yum, the Yellowdog Updater, Modified, is a meta-package manager based on RPM.
  1. To find what software has been install:
    $ yum list | less
    
  2. To check if a software have been installed, say, emacs, do:
    $ yum list emacs
    
    Pay close attention to the output message. Alternatively, you can use rpm command to do the same:
    $ rpm -q emacs
    
  3. To install emacs, do:
    $ yum install emacs
    
    NOTE: Count how many dependent software packages emacs needs and are installed as a result.
  4. Check if emacs has been installed.
    $ which emacs
    $ emacs
    
  5. To remove emacs, do:
    $ yum remove emacs
    
    NOTE: Count how many software packages yum actually removes.
  6. Check if emacs is still there.

pkgtools

Pkgtools is a collection of home-grown csh scripts written by Sugih Jamin while he was a USC graduate student, and extended a little by me :). It allows the software to be compiled from source and installed in a self-contained directory, from which files and directories can be symbolically linked to a common directory called /import, or whatever defined by the $IMPORT_HOME environment variable, such as /usr/local. A similar utility called Graft, written in Perl, can be found here.

To install pkgtools, do the following:

  1. Login as root.
  2. Create a new group in /etc/group called installer with GID 200, and add yourself to the group.
  3. Create the following directories:
  4. Change the group ownership of the directories above to installer and change the group permission of those directories to be writable and setgid.
  5. Login as you.
  6. Download a copy of pkgtools from http://www.cs.ucr.edu/~weesan/cs183/download/pkgtools-1.3.tar.gz and store it under /import/src.
  7. Ungzip and untar pkgtools.tar.gz to /import/pkgs
  8. Install (or enable) the pkgtools by
    $ cd /import/pkgs
    $ /import/pkgs/pkgtools/bin/pkginstall pkgtools
    
    You will be prompted for software version and location to get the upgrade. Type "1.3" (without the double quote) for the version and "http://www.cs.ucr.edu/~weesan/cs183/download/pkgtools-1.3.tar.gz" for the location.
  9. Add /import/bin to your PATH and /import/lib to LD_LIBRARY_PATH in ~/.bashrc.
    PATH=/import/bin:$PATH
    LD_LIBRARY_PATH=/import/lib:$LD_LIBRARY_PATH
    
  10. Source your ~/.bashrc
    $ source ~/.bashrc
    
  11. Now, assuming there is no RPM for emacs, so, go ahead and download http://ftp.gnu.org/gnu/emacs/emacs-22.2.tar.gz and store it under /import/src
  12. Compile Emacs.
    $ cd /tmp
    $ gzip -cd /import/src/emacs-22.1.tar.gz | tar xvf -
    $ cd emacs-22.1
    $ CFLAGS="-O3" ./configure --prefix=/import/pkgs/emacs
    $ make
    $ make install
    
  13. To Install or enable Emacs, use pkginstall.
    $ pkginstall emacs
    
  14. Run Emacs to make it is installed correctly.
    $ emacs
    
  15. Check what have been installed by using pkginfo.
    $ pkginfo
    $ pkginfo emacs
    
  16. To remove (or disable) Emacs, use pkgremove.
    $ pkgremove emacs
    
  17. Try to run emacs again and pkginfo to make sure it is the case. Hint: an asterisk ('*') at the end of the emacs entry indicates the emacs package has been removed (or disabled).
  18. Install (or enable) emacs back on for future use.

Questions

  1. What are the pros and cons of both of the tools, also justify when or how each tool should be used.
  2. What are the differences between the soft-link (symbolic link) and hard-link?
  3. Create three users: alice, bob and tom. Create a new directory called /home/shared and set it up such that only alice and bob can create and access the files (thus, sharing the files between alice and bob) under /home/shared but not tom, without extra interference from either the users or the system admin. For example, if alice creates a file named /home/shared/a, bob should be able to access/edit the file right away, and tom can't at all, without having alice to change the file's permission. In order to receive full credit for this part, you need to show your result via a couple of screenshots or simply the text output, of the permission of the /home/shared and the error/success messages while accessing the files by different users.

Scoring


Notes & Tips: