Вы находитесь на странице: 1из 40

Linux Administration

Red Hat Linux

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

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

Linux-Administration

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

Linux-Administration

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

Linux-Administration

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

www.Kernel.org
Linux was originally written for Intel processors but now supports over 30 processors!

Linux-Administration

Copyright 2012: All Rights Reserved.

Day 1-4

Linux Administration

X11
A powerful networked graphical environment
Developed at MIT, freely distributable X.org - complete implementation of X based on the X11R7.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, emacs, zip, chkconfig Many server components are generic UNIX software: Apache, sendmail, BIND, Samba Free implementations of commercial applications OpenSSH, OpenMotif, GNUPG Internationalization Multiple languages Unicode support!
Linux-Administration 10

Copyright 2012: All Rights Reserved.

Day 1-5

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.org http://arduino.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 Reserved.

Day 1-6

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.

Day 1-7

Linux Administration

Popular Linux Distributions


Ubuntu Mint CentOS Puppy http://distrowatch.com

Linux-Administration

15

Linux Distrubution
Linux kernel
Debian

Red Hat

GNU tools, compiler, libraries

Linux operating system

SUSE

X graphics : KDE GNOME Installation tools, configuration tools, Support, Applications


Linux-Administration 16

Other: Apache, Database, Multimedia

Copyright 2012: All Rights Reserved.

Day 1-8

Linux Administration

What Is a Linux Distribution?


A Linux distribution is:
A preconfigured kernel GNU utilities X graphical environment (KDE, GNOME) Other generic software components Distributor-specific installation & configuration Support

Linux-Administration

17

Red Hat
Red Hat
Worlds 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.redhat.com/rhel)


18-24 month release cycle Purchased with one year Red Hat Network / support contract CLIENT or SERVER versions

Fedora (fedoraproject.org)
Updates every 6 months Unsupported, community based

Linux-Administration

18

Copyright 2012: All Rights Reserved.

Day 1-9

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, configuration management, & multi-state

Linux-Administration

20

Copyright 2012: All Rights Reserved.

Day 1-10

Linux Administration

Red Hat Installation


Installer
Multi-tasking Linux Anaconda, a python script

Source
CD, DVD, USB drive Network: FTP, NFS, 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 Its classified by group or family Disadvantage: dependencies

Linux-Administration

22

Copyright 2012: All Rights Reserved.

Day 1-11

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 ;

Linux-Administration

24

Copyright 2012: All Rights Reserved.

Day 1-12

Linux Administration

Getting Help
Two important commands: man & info command help Others (x = command): whatis x - 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, System Tools, Terminal or start a terminal window by pressing CTRL-ALT-F2)

From command line type: w (or uptime; 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.

Day 1-13

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, or even help to get more detail on the previous commands! Try the GUI tool from Applications, System Tools, System Monitor and look at the different tabs.
Linux-Administration 28

Copyright 2012: All Rights Reserved.

Day 1-14

Linux Administration

Linux Installation

Linux-Administration

29

Linux Installation Steps


Source: CD/DVD/USB/LAN installation Target: Supported Hardware
CPU, RAM Hard drive, Array Network & Video

Network Configuration Software Selection


Linux-Administration 30

Copyright 2012: All Rights Reserved.

Day 1-15

Linux Administration

HW: CPU & Memory Support


Intel, AMD, MIPS, PowerPC, SPARC Itanium, Alpha, UltraSPARC, 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, SCSI, PCMCIA, ISA

Linux-Administration

32

Copyright 2012: All Rights Reserved.

Day 1-16

Linux Administration

Laptops, Mobile
Tricky installations Custom bus, Video and/or Sound chipsets Older laptops may be difficult to install Boot from CD, floppy or network URL: www.linux-laptop.net

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.

Day 1-17

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, LV) Physical/Logical Extent (PE, LE) Volume Group (VG)

Linux-Administration

35

Red Hat Installer Features


GUI or text modes CD or network install; kickstart install Modes:
Rescue, Desktop, Workstation, Laptop, Server, Custom, Upgrade options.

Runs Anaconda, a Python script Multi-tasking kernel


Linux-Administration 36

Copyright 2012: All Rights Reserved.

Day 1-18

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-19

Linux Administration

Package Selection
GUI: X, KDE, 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.

Day 1-20

Linux Administration

BIOS Initialization
Power On Self Test recognizes hardware, CPU, memory, bootable config from CMOS. 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, static GRUB more dynamic, reads ext2

Linux-Administration

42

Copyright 2012: All Rights Reserved.

Day 1-21

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.6.x/modules Passes control to /sbin/init

Linux-Administration

43

init Initialization
Init loads scripts from /etc/rc.d init.rc is the master script Based on parameter or /etc/inittab default, it will execute scripts in rc.x All boot scripts live in init.d, can be configured via chkconfig Last script is rc.local
Linux-Administration 44

Copyright 2012: All Rights Reserved.

Day 1-22

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, 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.

Day 1-23

Linux Administration

The rc.sysinit Script


Controls the initial mounting of filesystems, repairing if needed
rc.local allows local customization

Linux-Administration

47

System V run levels


0 - Halt 1 - Single user mode 2 - Multiuser, without network 3 - Full multiuser mode 5 - X11 (graphical login) 6 - Reboot

Linux-Administration

48

Copyright 2012: All Rights Reserved.

Day 1-24

Linux Administration

The rc.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.

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

Linux Administration

Configuring Services
chkconfig servicename function
Function add del list Try: chkconfig list | sort

system-config-services From GUI: Applications, System Settings, Server Settings, 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.

Day 1-27

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-28

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-29

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.

Day 1-30

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

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.

Day 1-32

Linux Administration

Network Interfaces
lo or dummy 127.0.0.1 eth0, tr0 are aliases to real kernel modules, 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-33

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.

Day 1-34

Linux Administration

Binding Multiple IP Addresses


Many ISPs use multiple IP to provide many hosts or domains from 1 system Its a kernel feature
ifconfig eth0 10.0.0.1 ifconfig eth0:1 10.0.1.1 ifconfig eth0:X 10.0.X.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, netmask & if device should start at boot
Linux-Administration 70

Copyright 2012: All Rights Reserved.

Day 1-35

Linux Administration

Configuration Utilities
ifup, ifdown system-config-network ifconfig arp nslookup, 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, the server provides a lease for the IP address, the netmask, & can provide name server & gateway info
Linux-Administration 72

Copyright 2012: All Rights Reserved.

Day 1-36

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.

Day 1-37

Linux Administration

IP Forwarding
There are kernel variables you can alter to change the way the kernel behaves while its running To configure a Linux computer as a router between networks, 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.

Day 1-38

Linux Administration

Name Resolution
Berkley Internet Name Domain (bind) from www.isc.org Server name: named uses /etc/named.conf 4 modes: master, slave, caching-only, forwarding-only
Linux-Administration 77

DNS Client Configuration


/etc/resolv.conf
nameserver 10.0.1.254

/etc/hosts.conf
order hosts, bind

/etc/nsswitch.conf

Linux-Administration

78

Copyright 2012: All Rights Reserved.

Day 1-39

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.

Day 1-40

Вам также может понравиться