1 / 33

ITI-481: Unix Administration

ITI-481: Unix Administration. Meeting 2 Rutgers University Center for Applied Computer Technologies Chris Uriarte, Instructor. Today’s Agenda. Software Installation Booting and Shutting Down Emergency Boot Procedures. Software Installation. Methods of Installation Binary distributions

MartaAdara
Download Presentation

ITI-481: Unix Administration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ITI-481: Unix Administration Meeting 2 Rutgers University Center for Applied Computer Technologies Chris Uriarte, Instructor ITI-481 - Chris Uriarte

  2. Today’s Agenda • Software Installation • Booting and Shutting Down • Emergency Boot Procedures ITI-481 - Chris Uriarte

  3. Software Installation • Methods of Installation • Binary distributions • Red Hat Package Manager (RPM) • Compiling from source • Software installations usually must be done as root. ITI-481 - Chris Uriarte

  4. Red Hat Package Manager (RPM) • Generally used for installation and removal of precompiled software. • Originally deployed on Linux systems, now available on other major platforms (most notably, Solaris) • Installation of operating system and additional software on many UNIX distributions managed through RPMs. • RPMs that are part of the Linux Distribution can be found on your install CD at:/mnt/cdrom/<Distribution Name>/RPMS • RPM installations are usually managed by the rpm command (/bin/rpm) • As close to “setup” as you can get on UNIX – one command installs an entire software package. ITI-481 - Chris Uriarte

  5. RPM at the Command Line • For a list of packages already installed:rpm –qa • To install a new package:rpm –ivh package-file-name • To upgrade an existing package:rpm –Uvh package-file-name • To uninstall a package: rpm –e package-name (package name as seen in “rpm –qa”) ITI-481 - Chris Uriarte

  6. RPM at the Command Line (con’t) • List the files associated with a particular package: rpm –ql package-name ITI-481 - Chris Uriarte

  7. Package Files vs. Installed Packages • An rpm package file is a file that contains all the software associated with a particular application. It ends with the .rpm extension, for example netscape-communicator-4.71-i586.rpm • When the package is installed, using the rpm –i option, the package name is officially entered in the system package database as the application name and version, i.e. netscape-communicator-4.71. Therefore, to remove the package, you need use the package name – not the full name of the file that you used to install the package. ITI-481 - Chris Uriarte

  8. Exercise: Using Red Hat Package Manager • Place your Linux CD in your drive - the files on your CD can now be accessed via the directory /mnt/cdrom. • The Mandrake/RPMS directory on your CDROM contains many RPM files. • Install tcpdump off of the Red Hat CD:> cd /mnt/cdrom/Mandrake/RPMS> rpm –ivh tcpdump-3.6.1-1mdk.i586.rpm • Uninstall elm software :> rpm -e elm-2.5.3-7mdk • Question: Is vim installed on your system? If so, what is the version number? ITI-481 - Chris Uriarte

  9. Installing Software from Source • A source installation takes raw computer code and compiles it into a usable software program. • Optimizes software for platform on which it is compiled. • Generally provides more installation and configuration options that using a binary or RPM distribution. • Requires a C compiler (gcc is the most common and is pre-installed with many systems). ITI-481 - Chris Uriarte

  10. Typical Steps for Installing from Source • Download source archive. • Unpack archive • filename.tar.gz or filename.tgz - use gzip and/or tar • filename.Z – use uncompress • filename.zip – use unzip • Look at README and/or INSTALL documents for specific installation steps. • Usually, you: • Run configure script if there is one. • Run make. • Run make install. • Key: READ the README and INSTALL files! ITI-481 - Chris Uriarte

  11. Exercise: Installing ssh1 from Source • Download ssh1.2.27. Additional download locations can be found at http://www.ssh.com/products/ssh/download.html. • From the download directory:> tar -xvzf ssh-1.2.27.tar.gz > cd ssh-1.2.27>./configure> make> make install ITI-481 - Chris Uriarte

  12. Where to Find UNIX Software • Tucows Linuxhttp://www.linuxberg.com • Freshmeathttp://www.freshmeat.net/ • Rpmfind.nethttp://rpmfind.net/linux/RPM/ • Updates for packages distributed with Red Hat Linux can be found at any of the Red Hat Mirrors: http://www.redhat.com/download/mirror.html ITI-481 - Chris Uriarte

  13. Where to Find UNIX Software • TwoCows – http://www.twocows.com • SunFreeware – http://www.sunfreeware.com. • Download.com – http://www.download.com ITI-481 - Chris Uriarte

  14. When will you use these software installation procedures? • When you want to install a new system or user application. • When you need to apply patches, fixes or updates that have been provided by your OS vendor. • i.e. RedHat security patches and bug fixes available at: http://www.redhat.com/apps/support/errata/ ITI-481 - Chris Uriarte

  15. The UNIX Boot Process • The UNIX boot process is unique. • UNIX is divided into system states called “run levels”, ranging from level 0 to level 6. • UNIX Flavors boot differently, but the general concepts are always the same: • Bootstrap the system using a bootloader • Load the “kernel” into memory • Execute “rc scripts” (startup scripts) ITI-481 - Chris Uriarte

  16. The Linux Boot Process • LILO starts and Linux is selected as the operating system to boot. • The Linux kernel is loaded into memory and then probes system hardware. • The init process reads /etc/inittab and determines whether runlevel 0-6 should be started. • rc scripts are executed for the specified run level to start various services. ITI-481 - Chris Uriarte

  17. Linux Loader (LILO) • LILO is a boot manager. • Usually installed in the Master Boot Record (MBR – a special segment of your hard disk that the system reads during startup). • Configuration file is /etc/lilo.conf. If any changes are made to lilo.conf, /sbin/lilo needs to be run for the changes to become active. • For Linux, LILO’s purpose is to identify the location of the kernel, which is actually just a file like:/boot/vmlinuz-2.2.12-20 ITI-481 - Chris Uriarte

  18. General UNIX System Booting • Linux is unique, as it uses LILO - a very interactive bootloading system. • Administrators rarely interact with the bootloader on other flavors of UNIX (unless a special bootloader is present). • Other UNIX flavors, however, have capabilities that are similar to those of LILO. ITI-481 - Chris Uriarte

  19. The UNIX init Process • init reads /etc/inittab, which designates what runlevel to start. A runlevel of initdefault is selected unless otherwise designated. • A runlevel determines what functionality the system should be providing. Run levels include:0 Halt the system1 Single-user (no networking)2 Multiuser without NFS3 Multiuser with NFS4 Unused5 Same as 3 but with X11 console6 Reboot the system ITI-481 - Chris Uriarte

  20. UNIX Run Levels • Run Level 1 – “single user mode” • No prompts for username/password • Access only via console – no remote access to the system (i.e. telnet) • Very minimal services are running – no networking, no X Windows. • Console user has “root” permissions • User for system maintenance • Used when you forget your root password ITI-481 - Chris Uriarte

  21. UNIX Run Levels (con’t) • Run Level 2 • All typical services are started • Multi-user mode – users are allowed to log into the system • NO NFS (Network File System) file sharing • Run Level 3 • Same as run level 2, but NFS is enabled. • ***This is the DEFAULT system run level. ITI-481 - Chris Uriarte

  22. UNIX Run Levels (con’t) • Run Level 4 • Not used (historical) • Run Level 5 • Same as run level 3, but the system will automatically boot into X Windows and console users will authenticate via an X Windows username/password interface. ITI-481 - Chris Uriarte

  23. Special Run Levels • Run Level 0 • The system “halt” or “shutdown” run level • System processes are stopped and the system halts • Run Level 6 • The system “reboot” run level. • System processes are stopped and the machine is restarted. ITI-481 - Chris Uriarte

  24. rc Scripts • Run level scripts are located in /etc/rc.d/rcX.d (X=runlevel #, e.g. /etc/rc.d/rc3.d for run level 3). They are used for both startup and shutdown purposes. • These directories have startup scripts that run processes and applications during boot time. The scripts use the following naming convention: • K or S + Number + Service Name (i.e. S80sendmail) • S is for start. K is for kill. Lower numbers start before higher. • Startup scripts take two options: start or stop. Scripts with a S are run with start option. Scripts with a K are run with a stop option. ITI-481 - Chris Uriarte

  25. rc scripts, con’t • The scripts in the rcX.d directories are typically NOT actual files themselves – they are usually symbolic links to links to scripts located in /etc/rc.d/init.d or /etc/init.d • For example: • A script that starts the apache server, might exist: /etc/rc.d/init.d/apache. This script need only contain the commands that required to start apache. • To start Apache during run level 3, create a symbolic link in /etc/rc.d/rc3.d called, for example, S99apache and link it to /etc/rc.d/init.d/apache ITI-481 - Chris Uriarte

  26. rc script example • Example – you create a script that checks the system for “world writeable” files (files that anyone on the system can write to) and emails these files to you. • This script is called checkworldread and is located in /etc/rc.d/init.d. • You would like to run this script when the system starts in ANY multiuser mode (I.e. run level 2, 3 and 5) • Therefore, you must create rc-style symbolic links to /etc/rc.d/init.d/checkworldread from the /etc/rc.d/rc2.d, rc3.d and rc5.d directories. ITI-481 - Chris Uriarte

  27. rc script diagram /etc/rc.d/rc1.d /etc/rc.d/rc3.d /etc/rc.d/rc5.d /etc/rc.d/rc2.d S99checkwr S99checkwr S99checkwr /etc/rc.d/init.d Symbolic link checkworldread ITI-481 - Chris Uriarte

  28. Ways of Changing Run Levels • /sbin/telinit [0-6] or /sbin/init [0-6] • Allows you to specify a specific run level to change to • /sbin/shutdown (typically, “shutdown now”) • /sbin/reboot • /sbin/halt • At LILO boot prompt type linux <run level> (i.e. ‘linux 5’) • CTRL-ALT-DELETE • Key combination on PC-based UNIX systems reboots the systemCan be disabled in /etc/inittab. • ***Only power-cycle a UNIX system as a last resort. ITI-481 - Chris Uriarte

  29. Changing the Default Run Level • To change the default run level, edit /etc/inittab – look for the line: id:3:initdefault: • After “id:” put the run level number you wish to use as your default run level. (usually 3 and 5 are most common options) • Now when your machine boots, it will automatically enter that run level. • The default UNIX run level is 3, unless you’ve specified otherwise during setup. ITI-481 - Chris Uriarte

  30. Useful Keyboard Shortcuts • Change to text consoleCTRL-ALT-[F1-F6] • Change to X-Windows CTRL-ALT-F7 • Terminate X-Session CTRL-ALT-Backspace ITI-481 - Chris Uriarte

  31. Exercise: Changing Runlevels • As root, type the following:shutdown –t 30 –h “System Downtime Beginning” • Hit the power switch on your machine to turn the system back on after the shutdown process is complete. NEVER turn power off without a proper shutdown. • At the LILO prompt, enter “linux 1.” (Linux only) • After booting into single-user mode, type:init 5 ITI-481 - Chris Uriarte

  32. Emergency Boot Procedures • If system is unable to boot normally or you forgot your root password, the following options are available: • Boot off of your system-specific boot disk – • Can be created usually be created during a UNIX install process. Linux also has a “mkbootdisk” command. • Boot off of your install floppy or cdrom. You may be prompted to boot into single user mode or into a “recovery mode” • Boot into single user mode. ITI-481 - Chris Uriarte

  33. Homework • Reading Linux Administration: A Beginner’s Guide – assigned in class. ITI-481 - Chris Uriarte

More Related