240 likes | 386 Views
ITI-481: Unix Administration. Meeting 2 (Parts 1 and 2) Meeting 3 (Part 1). Today’s Agenda. Software Installation Booting and Shutting Down Emergency Boot Procedures. Software Installation. Methods of Installation Binary distributions Red Hat Package Manager (RPM) Compiling from source
E N D
ITI-481: Unix Administration Meeting 2 (Parts 1 and 2) Meeting 3 (Part 1)
Today’s Agenda • Software Installation • Booting and Shutting Down • Emergency Boot Procedures
Software Installation • Methods of Installation • Binary distributions • Red Hat Package Manager (RPM) • Compiling from source • Software installations usually must be done as root.
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 Red Hat CD managed through RPMs. • RPMs that are part of the Red Hat Distribution can be found on your install CD at:/mnt/cdrom/RedHat/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.
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”)
RPM at the Command Line (con’t) • List the files associated with a particular package: rpm –ql package-name
Exercise: Using Red Hat Package Manager • Place your Linux CD in your drive - the files on your CD can be accessed via the directory /mnt/cdrom. • The RedHat/RPMS directory on your CDROM contains many RPM files. • Install tcpdump off of the Red Hat CD:> cd /mnt/cdrom/RedHat/RPMS> rpm –ivh tcpdump-3.4-16.i386.rpm • Uninstall elm software :> rpm -e elm-2.5.1-1 • Question: Is pine installed on your system? If so, what is the version number?
Installing Software from Source • A source installation the 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 distribution. • Requires a C compiler (gcc).
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!
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
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
Where to Find UNIX Software • TwoCows – http://www.twocows.com • SunFreeware – http://www.sunfreeware.com. • Download.com – http://www.download.com
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 • Load the “kernel” into memory • Execute “rc scripts” (startup scripts)
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.
Linux Loader (LILO) • LILO is a boot manager. • Usually installed in the Master Boot Record (MBR – a special segment of your hard disk). • 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:/boot/vmlinuz-2.2.12-20
General UNIX System Booting • Linux is unique, as it uses LILO is a very interactive bootloading system. • Administrators rarely interact with the bootloader on other flavors of UNIX (unless a special bootloader is present).
The 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
rc Scripts • init runs /etc/rc.d/rc.sysinit to activate swap partitions and check consistency of file systems. • init runs /etc/rc.d/rc with an option designating the runlevel 0-6. • Runlevel scripts are located in /etc/rc.d/rcX.d (X=runlevel #). Are used for both startup and shutdown purposes. • 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|stop. Scripts with a S are run with start option. Scripts with a K are run with a stop option. • Scripts in /etc/rc.d/rcX.d are symbolic links to /etc/rc.d/init.d. • /etc/rc.d/rc.local runs last.
Ways of Changing Run Levels • /sbin/telinit [0-6] or /sbin/init [0-6] • /sbin/shutdown –h (for halt) –r (for reboot) • /sbin/reboot • /sbin/halt • At LILO boot prompt:linux [0-6] • CTRL-ALT-DELETECan be disabled in /etc/inittab. • Only power-cycle a Linux system as a last resort.
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.
Useful Keyboard Shortcuts • Change to text consoleCTRL-ALT-[F1-F6] • Change to X-Windows CTRL-ALT-F7 • Terminate X-Session CTRL-ALT-Backspace
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.” (Linus only) • After booting into single-user mode, type:init 5
Emergency Boot Procedures • If system is unable to boot normally, the following options are available: • Boot off of your system-specific boot disk - Can be created during install process or by using mkbootdisk:> /sbin/mkbootdisk 2.2.12-20 • Boot into single-user mode. • Boot off of your install floppy or cdrom.
Homework • Read Chapters 5, 9, 12, and 24 in Linux Administration: A Beginner’s Guide.