Linux SysAdmin Guide

  1. Installing Linux
  2. User Administration [ adduser, removing users. locking accounts ]
  3. Basic Networking
  4. NFS
  5. NIS
  6. Web Server Admin [ installing apache ]
  7. Mail Administration
  8. NT - Linux Networking
  9. ftp Administration

I. Installing Linux

a. Installation

Insert CD and hit DEL to make it the default booting device. Boot from installation CD.

b. Boot Problems

c. Hostname


II. User Administration

a. Adding and Removing Users


III. Basic Networking

a. Hosts


IV. NFS

a. NFS Server

  1. Configuration Files : /etc/exports, /etc/hosts.allow, /etc/hosts.deny

    /etc/exports

    /usr/local   199.100.11.5(ro)
    /home        198.100.12.6(rw)
    
  2. Starting Services : Check which ones are already running using %rpcinfo -p .
    1. Portmapper Start : %rpc.portmap
    2. Mount Daemon Start : %rpc.mountd
    3. NFS Server Daemon Start : %rpc.nfsd
    4. Auxiliary NFS Services : %rpc.statd ; %rpc.lockd ; %rpc.rquotad
      • %rpcinfo -p     (at least three lines containing "portmapper", "nfs", and "mountd" should be seen; at most these plus "rquotad", "status", "nlockmgr")
    5. Export exports file : %exportfs -ra (force nfsd to re-read /etc/exports)

      b. NFS Client

      • Mount the files :
        • %mount -o rsize=1024,wsize=1024 -t nfs mars:/home/user /home/user     (mount, setting default datagram size in muliples of 1024 up to 8192 with mostly 4096 default and specifying nfs file type)
        • %mount mars:/home/user /home/user
        • Check the mount using %df or %mount; NIS setup enables user to see his files.
        • "Type Mismatch" : client or server does not cotain `nfs' in /proc/filesystems; kernel must be rebuilt.
        • "RPC Failure" : nfsd not running on server.
        • "Permission Denied" : Client not in /etc/exports.
      • Unmount the files :
        • %umount /home/user

      V. NIS

      a. NIS Server

      • Start the NIS Server : %ypserv
        • %rpcinfo -u localhost ypserv ( check whether the above worked; one should see the word `running')
      • Build and Install NIS Databases : %/usr/lib/yp/ypinit -m     ( takes some time )
        • "Domain Name No Set" : if this is the error message then type %domainname xyz.com

      b. NIS Client

      • Start the NIS Client : %/sbin/ypbind
        • "No NIS Server" : if this is the error message then edit /etc/yp.conf to include a line ypserver mars , where mars must be in /etc/hosts.
        • "No NIS Domain" : if this is the error message then type %domainname xyz.com.
        • %rpcinfo -u localhost ypbind or %rpcinfo -p localhost ( check whether ypbind is running)
        • %ypcat passwd.byname ( check whether the above worked, remote users should be able to login )
      • Mount NFS Files : %mount -o rsize=1024,wsize=1024 -t nfs mars:/home/user /home/user     ( mount user's home directory, the user can now view and edit his files )

      VI. Web Server Administration

      a. Installing Apache : Not required for many versions of Linux as Apache is usually preinstaled.

      1. Download
        • $lynx http://www.apache.org/dist/httpd/httpd-2_0_NN.tar.gz     (also via http://www.apache.org/dist/httpd/)
      2. Extract
        • $gzip -d httpd-2_0_NN.tar.gz
          $ tar xvf httpd-2_0_NN.tar
              (gunzip and untar )
      3. Configure
        • $./configure     ( configure using default options)
          $./configure --help     (get help)
          $./configure --prefix=PREFIX     ( PREFIX defaults to /usr/local/apache2)
           $ CC="pgcc" CFLAGS="-O2" \
              ./configure --prefix=/sw/pkg/apache \
              --enable-rewrite=shared \
              --enable-speling=shared  
              (specifying C compiler and install dir)
      4. Build
        • $make     (compile and build, takes 3 minutes or more )
      5. Install
        • $make install     (compile and build, takes 3 minutes or more )
      6. Customize
        • $vi PREFIX/conf/httpd.conf     (edit file )
      7. Run
        • $PREFIX/bin/apachectl start     (run, test first http://localhost; document root tree is PREFIX/htdocs/)
        • $PREFIX/bin/apachectl stop     (stop)

        b. Running Apache

        1. Check Config File
          • /etc/httpd/conf/httpd.conf     (should contain an uncommented line ServerName localhost )
        2. Start Apache
          • httpd     (start daemon)
          • /usr/sbin/httpd -C "ServerName mars"     (start daemon specifying server name)
        3. Test Apache
          • $lynx http://localhost     (test server, file displayed is /var/www/html/index.html with /var/www/ as base)
          • $lynx http://mars/     (test servername aliasing)

          c. CGI

          • $lynx http://localhost/cgi-bin/test.cgi     (using in-built test script /var/www/cgi-bin/test.cgi and #mv test-cgi test.cgi )

          VII. Mail Admin

          a. sendmail

          • /etc/aliases :

            /etc/aliases

            ...
            all: user, samar, mantu
            ...
            

          • /etc/sendmail.cf :

            /etc/sendmail.cf

            ALL: ALL
            in.telnetd: ALL
            

          VIII. NT - Linux Networking

          a. Samba

          Enables networking between NT and Linux.

          a. Installing Samba

          1. Configure (Not always required)
            • $./configure --help     (help)
          2. Build Binaries
            1. $make     (create binaries)
            2. $make install     (create binaries; $ make installbin, $make installman separately install binaries and manual pages)
            3. Configuration File smb.conf
              • Consult examples dir. file
                 [global]
                   workgroup = MYGROUP
                  [homes]
                    guest ok = no
                    read only = no
                  
                    ( smb.conf should be in same place as spec. in Makefile, default /usr/local/samba/lib/ )
            4. Test smb.conf
              • $testparm     (test)
            5. smbd and nmbd Daemons started
              • Possibility 1: Inetd $/etc/inetd.conf     (test)
              • Possibility 2: Shell Script $mystartsmb.sh
                  #!/bin/sh
                  /usr/local/samba/bin/smbd -D 
                  /usr/local/samba/bin/nmbd -D 
                  
                $chmod 755 *.sh; ./startsmb.sh     (executable run by hand or exec by /etc/rc.local )
            6. Test Connections
              • $ smbclient -L yourhostname     (get list of host names)
              • $ smbclient //yourhostname/aservice     (connect with linux client)
              • C:\WINDOWS\> net use d: \\servername\service     (try mounting disks)

              a. Features of Samba

              1. Config Files
                • $smb.conf     (similar to ini files, manipulatable via $swat

                Other tools include qmail, fetchmail, mgetty, sendfax and hylafax.