Dana Vrajitoru
C151 Multi-User Operating Systems

Linux Administration

Super User

  • The system administrator is also called a "superuser".
  • The name of the account is always root.
  • The root user can create user accounts, establish quotas, change basic system settings like the screen resolution.
  • It can modify/delete any file belonging to any user.
  • It can install new software and update the current packages.
  • Even on your own computer it is not recommended to login as root unless you have some sys admin task to perform.

    System Services

  • Background processes that run continuously on your computer.
  • They allow services such as ssh/ftp connections from a remote computer, web and mail servers, mounted network drives, printer handling, etc.
  • These programs are called daemons. Their names often end in a "d", like httpd would be the web server daemon.
  • They can be activated/deactived by the system using service configuration.

    Basic Daemon Structure

  • Fork off the parent process
  • Open any logs for writing
  • Create a unique Session ID (SID)
  • Change the current working directory to a safe place
  • Close standard file descriptors (stdin, stdout, stderr)
  • Enter actual daemon code consisting of an endless loop doing:
  • Wait for an event
  • Process event

    Example of System Task

  • Mounting a USB drive in your Linux system.
  • Plug in the USB drive. Check the file /proc/bus/usb/devices. If the system recognizes the drive, it should be listed there.
  • As root, create a directory under /mnt called usb.
  • Mount the drive with the following command:
    mount /dev/sda1 /mnt/usb -w
  • You can add a line to /etc/fstab:
    /dev/sda1   /mnt/usb    auto    noauto,owner,kuzu	0 0
  • Then you'll be able to mount this drive with mount usb
  • Now most Linux systems mount usb drives automatically under /media/disk.

    Installing Linux

  • Consult an installation guide for the specific distribution you want to install.
    http://www.linux.org/docs/beginner/install.html
  • Determine the hardware compatibility.
  • First step: make a backup of essential files on that computer.
  • Create partitions. You need at least 2, root and swap.
  • Boot the computer from an installation CD (this will usually contain partitioning software).

    Linux Partitions

  • Linux needs at least two partitions:
  • the root partition designated by "/" will be mounted (the root of the entire filesystem); this must be a bootable partition;
  • the swap partition, which is recommended to be at least twice as big as the RAM memory and which will be used as virtual memory.
  • It is sometimes recommended to create a different partition for the /home directory. That way when you update the system, you can reformat only the partition containing the system and not the user files.
  • Each partition will appear as a "hda#" in /dev/

    Mount Point

  • A mount point is a special partition that is mounted under a directory name.
  • For example, /home could be a mount point for a separate partition than root (/).
  • In our labs, /home is a network drive.
  • The following directories cannot be used as mount points: /bin, /dev, /etc, /lib, /lost+found, /proc, /root, and /sbin.
  • A mount point can even be a subdirectory of /:
    /var/spool/mail/

    Installing a Package

  • Software usually comes as a tar gzip archive. First step is to decompress it and read the README file.
  • If the package is open source, you may have to configure it and compile it first.
  • In that case you must look for a script called configure or config and run it first. That should create a Makefile adapted to you system.
  • Next you compile it with make, and then you might need to run another script called install.
  • Alternative: some packages come in RPM format (soft.rpm). These are usually precompiled for a specific distribution. It can be installed with one simple command (–i for install, -U for update, -e for erase):
    rpm –i soft.rpm
  • If installed, the easiest installation command is
    apt-get package
    which finds the package online together with all its dependencies and installs them all in the right order. Normally needs to be run as superuser.
  • Under Ubuntu the command is
    sudo apt-get package
    which runs it as super-user.