Linux Administration

Red Hat Linux

Administration & Programming Intel, Portland, OR Jan 16-19 2012

Linux History Distributions Linux and Unix Installation System Initialization File system Management Booting Linux Graphical Desktops Command Line



Copyright 2012: All Rights Reserved.

Day 1-1

Linux Administration

Unit 1: History
Linux Is Not UniX
Developed by Linus Torvalds 8/25/1991 Based on Minix, a Unix clone

Free to use, install & modify
Based on GNU tools Licensed under GNU GPL



What Could You Do With Linux?
VPN link to remote site Linux FTP server Linux VPN gateway Linux file and print server for Windows clients To the Internet

Linux Web server

Linux router Linux DHCP server Linux Linux print server Application for UNIX clients server Linux-Administration

Linux firewall

Linux mail server

Linux NFS file server NIS server DNS server 4

Linux DataBase

Copyright 2012: All Rights Reserved.

Day 1-2

Linux Administration

What Can You Do With Linux?
Linux Cloud Services

Linux Tablets & Readers Linux Android for Mobile Phones

Linux Gaming Linux-Administration

Linux Arduino 5

Linux Operating System
Linux kernel

GNU tools, compiler, libraries

Linux operating system

X graphics : KDE GNOME

Other: Apache, Database, Multimedia
Linux-Administration 6

Copyright 2012: All Rights Reserved.

Day 1-3

Linux Administration

The GNU System
Free Software Foundation: FSF.ORG
Objectives were to create freely distributable UNIX tools
Software should be free from patents & commercial ownership

GNU provides many UNIX commands & useful applications



The Linux Kernel
Began as Linus Torvalds’ personal project to
Run a UNIX-like operating system on an i386 PC Offered as FREE to use & modify (GPL) Version 0.02 was made public on Oct 1991
Linux was originally written for Intel processors but now supports over 30 processors!



Copyright 2012: All Rights Reserved.

Day 1-4

Linux Administration X11 A powerful networked graphical environment Developed at . Day 1-5 . Samba Free implementations of commercial applications OpenSSH. GNUPG Internationalization Multiple languages Unicode support! Linux-Administration 10 Copyright 2012: All Rights Reserved. sendmail.6 standard Servers typically do not require graphics Some useful system administration tools are graphical X graphical tools can be run on a server and displayed remotely MIT = Massachusetts Institute of Technology Linux-Administration 9 Other Linux Applications UNIX software packages have been ported Korn Shell. BIND.complete implementation of X based on the X11R7. freely distributable X. OpenMotif. emacs. zip. chkconfig Many server components are generic UNIX software: Apache.

Day 1-6 .org Linux-Administration 11 Security Linux supports many security features UNIX security to control access resources Pluggable Authentication Modules (PAMs) Kerberos Firewall protection for the Internet IPsec Hardened shared libraries Downloaded software can be verified for authenticity IPsec = IP security Linux-Administration 12 Copyright 2012: All Rights http://arduino.Linux Administration Hardware Utilization Linux runs without problems on older computers Linux works well on high-performance modern hardware Linux can run on many embedded systems! https://openwrt.

Day 1-7 .Linux Administration Low Cost Linux & most Linux software are free Commercial software for Linux is low cost (or free) Often no need to purchase new hardware Software updates are also free (or low cost) Support by distributors and other organizations available at reasonable cost Enterprise Linux provides the reliability and support of commercial UNIX at a reasonable price FREE as in FREEDOM! Linux-Administration 13 Classic Linux Distributions Red Hat (Fedora) Suse (Novell) Debian Knoppix Slackware Linux-Administration 14 Copyright 2012: All Rights Reserved.

compiler. configuration tools. Support. libraries Linux operating system SUSE + X graphics : KDE GNOME Installation tools. Applications Linux-Administration 16 Other: Apache. Database.Linux Administration Popular Linux Distributions Ubuntu Mint CentOS Puppy http://distrowatch. Day 1-8 . Multimedia Copyright 2012: All Rights Linux-Administration 15 Linux Distrubution Linux kernel Debian Red Hat GNU tools.

GNOME) Other generic software components Distributor-specific installation & configuration Support Linux-Administration 17 Red Hat Red Hat World’s leading open source application platform Started as a consumer distribution in NC After 10 years it decided to focus on the enterprise Red Hat Enterprise Linux (www.Linux Administration What Is a Linux Distribution? A Linux distribution is: A preconfigured kernel GNU utilities X graphical environment ( 18-24 month release cycle Purchased with one year Red Hat Network / support contract CLIENT or SERVER versions Fedora (fedoraproject. Day 1-9 .org) Updates every 6 months Unsupported.redhat. community based Linux-Administration 18 Copyright 2012: All Rights Reserved.

Day 1-10 .Linux Administration Red Hat Products Linux-Administration 19 Red Hat Network Provides software updates (up to 7 years) Management & Monitoring Modules Extended capabilities for large deployments Provisioning Module Bare-metal installation. & multi-state Linux-Administration 20 Copyright 2012: All Rights Reserved. configuration management.

DVD.Linux Administration Red Hat Installation Installer Multi-tasking Linux Anaconda. Day 1-11 . USB drive Network: FTP. a python script Source CD. HTTP Kickstart file simplifies similar installs Linux-Administration 21 Package Manager: RPM Red Hat Package Manager has: Compiled or Source Software Documentation & program help Installation / un-install scripts It’s classified by group or family Disadvantage: dependencies Linux-Administration 22 Copyright 2012: All Rights Reserved. NFS.

Linux Administration Package Manager: YUM Newer Red Hat versions use: YUM Solves Dependencies Can have multiple repositories One click Update of: Operating System Applications Utilities Linux-Administration 23 Running Commands Commands have the following syntax: command options arguments Options modify a command's behavior Single-letter options usually preceded by Can be passed as -a -b -c or -abc Full-word options usually preceded by -Example: --help Arguments data needed by the command (filenames) Multiple commands can be separated by . Day 1-12 . Linux-Administration 24 Copyright 2012: All Rights Reserved.

who) to find who is logged in & server uptime From command line type: dmesg | more to read kernel log Linux-Administration 26 Copyright 2012: All Rights Reserved.short descriptions of command which x – displays command location locate x – finds a file Program help (F1) Red Hat Documentation or web site! Linux-Administration 25 Hands-on Lab 1a Exploring Linux Boot from Fedora CD or DVD Login as “fedora” Select “Applications”. Day 1-13 .Linux Administration Getting Help Two important commands: man & info command –help Others (x = command): whatis x . “Terminal” or start a terminal window by pressing CTRL-ALT-F2) From command line type: w (or uptime. “System Tools”.

“System Monitor” and look at the different tabs. Linux-Administration 28 Copyright 2012: All Rights Reserved. Day 1-14 . or even help to get more detail on the previous commands! Try the GUI tool from “Applications”.Linux Administration Hands-on Lab1b From command line type: free to find out about memory utilization From command line type: df –h to find out about free disk space on mounted devices From command line type: mount to find out about available mounted devices From command line type: ps ax to display running processes Linux-Administration 27 Hands-on Lab1c From command line type: more /etc/inittab to read operating system defaults From command line type: more /etc/fstab to read file system defaults Try the man command for any of the previous commands. “System Tools”.

Day 1-15 .Linux Administration Linux Installation Linux-Administration 29 Linux Installation Steps Source: CD/DVD/USB/LAN installation Target: Supported Hardware CPU. Array Network & Video Network Configuration Software Selection Linux-Administration 30 Copyright 2012: All Rights Reserved. RAM Hard drive.

SCSI. UltraSPARC.Linux Administration HW: CPU & Memory Support Intel. IBM z90 SMP support: up to 64 CPUs RAM: min 256MB up to 64GB Linux-Administration 31 Bus Support System & Hot swappable Plug & Play USB Firewire (IEE1394) Older Buses: EIDE. PCMCIA. MIPS. SPARC Itanium. PowerPC. Alpha. ISA Linux-Administration 32 Copyright 2012: All Rights Reserved. AMD. Day 1-16 .

linux-laptop. Video and/or Sound chipsets Older laptops may be difficult to install Boot from CD. Day 1-17 . Mobile Tricky installations Custom bus.Linux Administration Linux-Administration 33 Configuring RAID RAID levels supported Level 0: striping w/o parity Level 1: disk mirroring Level 5: striping with parity Linux-Administration 34 Copyright 2012: All Rights Reserved. floppy or network URL: www.

Laptop. Workstation. Desktop. Runs Anaconda. LE) Volume Group (VG) Linux-Administration 35 Red Hat Installer Features GUI or text modes CD or network install. Custom. Upgrade options. Day 1-18 . a Python script Multi-tasking kernel Linux-Administration 36 Copyright 2012: All Rights Reserved. LV) Physical/Logical Extent (PE.Linux Administration Configuring Flexible Filesystems with LVM LVM allows easy partition grow or resizing ONLY available in RHEL in GUI mode Physical/Logical Volume (PV. Server. kickstart install Modes: Rescue.

Day 1-19 .Linux Administration Partitioning Hard Drives GUI or text tools available during install Auto or Manual modes /boot partition Dual boot systems Swap partition (2x RAM) Create LVM or RAIDs Linux-Administration 37 Network Configuration and Firewall Setup ifconfig redhat-config-network Dynamic IP (DHCP) Static IP iptables Linux-Administration 38 Copyright 2012: All Rights Reserved.

Day 1-20 . KDE.Linux Administration Package Selection GUI: X. GNOME Servers Tools Programming Multimedia Applications Linux-Administration 39 System Initialization BIOS Boot Kernel init services Login Linux-Administration 40 Copyright 2012: All Rights Reserved.

bootable devices: CD ROM Floppy Hard Drive Network USB devices Linux-Administration 41 The Boot Loader Last step in BIOS Loads first partition of bootable device It can present a preset menu of choices Under Linux: LILO (Linux Loader) – older. CPU.Linux Administration BIOS Initialization Power On Self Test recognizes hardware. bootable config from CMOS. reads ext2 Linux-Administration 42 Copyright 2012: All Rights Reserved. Day 1-21 . static GRUB – more dynamic. memory.

can be configured via chkconfig Last script is rc.Linux Administration Kernel Initialization Kernel loads based on parameters passed All logging goes to /var/log/dmesg Detects hardware Loads initrd (if necessary) Mounts root Loads /lib/2.d init.6. it will execute scripts in rc.d.x/modules Passes control to /sbin/init Linux-Administration 43 init Initialization Init loads scripts from /etc/rc.rc is the master script Based on parameter or /etc/inittab default. Day 1-22 .x All boot scripts live in init.local Linux-Administration 44 Copyright 2012: All Rights Reserved.

Linux Administration Run levels Depending on the server usage or situation you may want to start at: Text (Console) login Graphical login Maintenance mode Default is controlled by /etc/inittab id:3:initdefault: Linux-Administration 45 Daemon Processes Run unattended Do not write to console Write via logging facility. Day 1-23 . usually to /var/log/messages Can be started via ‘service’ command service sendmail start service sendmail stop Linux-Administration 46 Copyright 2012: All Rights Reserved.

Linux Administration The rc. repairing if needed rc.Halt 1 .Single user mode 2 .Reboot Linux-Administration 48 Copyright 2012: All Rights Reserved. Day 1-24 .sysinit Script Controls the initial mounting of filesystems.Multiuser.Full multiuser mode 5 .local allows local customization Linux-Administration 47 System V run levels 0 . without network 3 .X11 (graphical login) 6 .

local Script Backdoor for customization of your system Red Hat uses it to build /etc/issue at boot time Can be used to configure additional hardware or new scripts Linux-Administration 49 Virtual Consoles Linux starts with 6 default virtual consoles Alt-F1 to Alt-F6 (or CTRL <.->) Can have up to 63 consoles Linux-Administration 50 Copyright 2012: All Rights Reserved.Linux Administration The rc. Day 1-25 .

Linux Administration System Shutdown and Reboot To reboot: shutdown –r to reboot reboot or init 6 To halt: shutdown –s to halt halt or init 0 Linux-Administration 51 Controlling Services service ‘servicename’ function Function: start / stop / restart / status kill PID nice level process GUI: “System Tools”. “System Monitor” Linux-Administration 52 Copyright 2012: All Rights Reserved. Day 1-26 .

“Services” Linux-Administration 53 System Monitoring and Process Control uptime + ps = w ps ax kill –signal PID killall process top Linux-Administration 54 Copyright 2012: All Rights Reserved. “System Settings”. Day 1-27 . “Server Settings”.Linux Administration Configuring Services chkconfig ‘servicename’ function Function –add –del –list Try: chkconfig –list | sort system-config-services From GUI: “Applications”.

Day 1-28 .Linux Administration Hands-on Lab 2 Exploring Linux Boot from Red Hat CD or USB From command line type: “dmesg | more” to read kernel log From command line type: “runlevel” to find current run level From command line type: “less /etc/inittab” to read system defaults Linux-Administration 55 Linux Graphical Environments X Window System GNOME KDE Linux-Administration 56 Copyright 2012: All Rights Reserved.

Day 1-29 .Linux Administration GUI Components X Server X Client X Tools GUI Tools Calendar Calculator File Manager Linux-Administration 57 X Server Overview Client application Xlib Client (window manager) Xlib Client application Toolkit Xlib Network X11 protocol X server Device drivers Linux-Administration 58 Copyright 2012: All Rights Reserved.

Day 1-30 .Linux Administration X Principles X is considered inappropriate on a server GUI tools can be very useful and convenient An X server manages a physical display Controls who can use the display Controls who can receive events from a display Communicates using the X11 protocol Implements device drivers for drawing and handling mouse and keyboard events Linux-Administration 59 Linux X Servers XFree86 implements X11R6 Comes with Slackware and other flavors of Linux Also available for other operating systems XFree86 actually has a separate X server for each display controller type MetroX and AcceleratedX are other types of commercial X servers Linux-Administration 60 Copyright 2012: All Rights Reserved.

Linux Administration Virtual Displays and Desktops Screens containing a lot of windows become cluttered Some window managers have a larger display area than screen Visible area pans when the cursor gets near the edges Display area Screen Linux-Administration 61 Configuring X Various tools are available for configuring X xf86config comes with XFree86 but is difficult to use xf86cfg is available on some distributions Red Hat uses redhat-config-xfree86 Linux-Administration 62 Copyright 2012: All Rights Reserved. Day 1-31 .

Day 1-32 .Linux Administration Network Configuration Linux-Administration 63 Network Device Recognition All Standard devices are recognized by the kernel at boot time Odd or extra hardware can be turn on or off by loading modules Red Hat customized networking: /etc/sysconfig/network /etc/sysconfig/network-scripts directory Linux-Administration 64 Copyright 2012: All Rights Reserved.

1 ‘eth0’.0. ‘tr0’ are aliases to real kernel modules. Day 1-33 .Linux Administration Network Interfaces ‘lo’ or dummy 127.0. defined in /etc/modules Network devices can be configured with: system-config-network Linux-Administration 65 Address Resolution Protocol ARP is used in the TCP/P network to find other systems We query a server for a hostname & we get an IP address Linux-Administration 66 Copyright 2012: All Rights Reserved.

Day 1-34 .Linux Administration Enabling Network Interfaces To start: ‘ifup device’ To stop: ‘ifdown device’ To start network device & services: service network start To stop network device & services: service network stop Linux-Administration 67 Multiple NICs Each card will have its own configuration file Can be enabled/disabled at boot time Linux-Administration 68 Copyright 2012: All Rights Reserved.

netmask & if device should start at boot Linux-Administration 70 Copyright 2012: All Rights Reserved.0. Day 1-35 .0.1 ifconfig eth0:X 10.0.0.X.1 ifconfig eth0:1 10.1.Linux Administration Binding Multiple IP Addresses Many ISPs use multiple IP to provide many hosts or domains from 1 system It’s a kernel feature ifconfig eth0 10.1 Linux-Administration 69 Interface Configuration Files In the /etc/sysconfig/network-scripts directory there are text files for each device detected: ifcfg-eth0 for eth0 ifcfg-lo for loopback (lo) Which contain the IP or DHCP setting.

& can provide name server & gateway info Linux-Administration 72 Copyright 2012: All Rights Reserved. dig hostname netstat Linux-Administration 71 DHCP/BOOTP Dynamic Host Control Program is the newer version of the Boot Protocol A client requests from a server an IP address at boot time If granted. Day 1-36 .Linux Administration Configuration Utilities ifup. the netmask. ifdown system-config-network ifconfig arp nslookup. the server provides a lease for the IP address.

Day 1-37 .Linux Administration Network Scripts Allowing User Control of Network Interfaces The ifup & ifdown interface scripts are the only scripts that the user should use to bring up & take down network interfaces Linux-Administration 73 System Default Route The ‘route’ command displays & configs route information Newer kernels set default route automatically For troubleshooting: route shows / configs the IP routing static tables can be set to host or net ‘default’ keyword specifies a route which will be used if no other route matches Linux-Administration 74 Copyright 2012: All Rights Reserved.

you may want to activate IP forwarding with the following command: # echo 1 >> /proc/sys/net/ipv4/ip_forward Linux-Administration 75 Global Network Parameters The interesting bits are in /proc/sys/net Reverse Path Filtering Generic ipv4 /proc/sys/net/ipv4/icmp_echo_ignore_all /proc/sys/net/ipv4/ip_default_ttl Linux-Administration 76 Copyright 2012: All Rights Reserved.Linux Administration IP Forwarding There are kernel variables you can alter to change the way the kernel behaves while it’s running To configure a Linux computer as a router between networks. Day 1-38 .

forwarding-only Linux-Administration 77 DNS Client Configuration /etc/resolv.conf nameserver 10. bind /etc/nsswitch. slave.254 /etc/hosts.conf Linux-Administration 78 Copyright 2012: All Rights Reserved.isc. Day 1-39 .Linux Administration Name Resolution Berkley Internet Name Domain (bind) from www.1.conf order hosts.0.conf 4 modes: master. Server name: named uses /etc/named.

Day 1-40 .Linux Administration DNS & Network Diagnostics arp nslookup dig host netstat –nr tcpdump or ethereal Linux-Administration 79 Summary Linux History Distributions Linux and Unix Installation System Initialization File system Management Booting Linux Graphical Desktops Command Line Linux-Administration 80 Copyright 2012: All Rights Reserved.

Sign up to vote on this title
UsefulNot useful