Linux System Administration

Paul Cobbaut

2015-05-24


Table of Contents

I. process management
1. introduction to processes
terminology
process
PID
PPID
init
kill
daemon
zombie
basic process management
$$ and $PPID
pidof
parent and child
fork and exec
exec
ps
pgrep
top
signalling processes
kill
list signals
kill -1 (SIGHUP)
kill -15 (SIGTERM)
kill -9 (SIGKILL)
SIGSTOP and SIGCONT
pkill
killall
killall5
top
practice : basic process management
solution : basic process management
2. process priorities
priority and nice values
introduction
pipes (mkfifo)
some fun with cat
top
top -p
renice
impact of nice values
nice
practice : process priorities
solution : process priorities
3. background jobs
background processes
jobs
control-Z
& ampersand
jobs -p
fg
bg
practice : background processes
solution : background processes
II. disk management
4. disk devices
terminology
platter, head, track, cylinder, sector
ide or scsi
ata
scsi
block device
solid state drive
device naming
ata (ide) device naming
scsi device naming
discovering disk devices
fdisk
dmesg
/sbin/lshw
/sbin/lsscsi
/proc/scsi/scsi
erasing a hard disk
advanced hard disk settings
practice: hard disk devices
solution: hard disk devices
5. disk partitions
about partitions
primary, extended and logical
partition naming
discovering partitions
fdisk -l
/proc/partitions
parted and others
partitioning new disks
recognising the disk
opening the disk with fdisk
empty partition table
create a new partition
display the new partition
about the partition table
master boot record
partprobe
logical drives
GUID partition table
labeling with parted
partitioning with parted
practice: partitions
solution: partitions
6. file systems
about file systems
man fs
/proc/filesystems
/etc/filesystems
common file systems
ext2 and ext3
creating ext2 and ext3
ext4
xfs
vfat
iso 9660
udf
swap
gfs
and more...
/proc/filesystems
putting a file system on a partition
tuning a file system
checking a file system
practice: file systems
solution: file systems
7. mounting
mounting local file systems
mkdir
mount
/etc/filesystems
/proc/filesystems
umount
displaying mounted file systems
mount
/proc/mounts
/etc/mtab
df
df -h
du
from start to finish
permanent mounts
/etc/fstab
mount /mountpoint
securing mounts
ro
noexec
nosuid
noacl
mounting remote file systems
smb/cifs
nfs
nfs specific mount options
practice: mounting file systems
solution: mounting file systems
8. troubleshooting tools
lsof
fuser
chroot
iostat
iotop
vmstat
practice: troubleshooting tools
solution: troubleshooting tools
9. introduction to uuid's
about unique objects
tune2fs
uuid
uuid in /etc/fstab
uuid as a boot device
practice: uuid and filesystems
solution: uuid and filesystems
10. introduction to raid
hardware or software
raid levels
raid 0
jbod
raid 1
raid 2, 3 and 4 ?
raid 5
raid 6
raid 0+1
raid 1+0
raid 50
many others
building a software raid5 array
do we have three disks?
fd partition type
verify all three partitions
create the raid5
/proc/mdstat
mdadm --detail
removing a software raid
further reading
practice: raid
solution: raid
11. logical volume management
introduction to lvm
problems with standard partitions
solution with lvm
lvm terminology
physical volume (pv)
volume group (vg)
logical volume (lv)
example: using lvm
example: extend a logical volume
example: resize a physical Volume
example: mirror a logical volume
example: snapshot a logical volume
verifying existing physical volumes
lvmdiskscan
pvs
pvscan
pvdisplay
verifying existing volume groups
vgs
vgscan
vgdisplay
verifying existing logical volumes
lvs
lvscan
lvdisplay
manage physical volumes
pvcreate
pvremove
pvresize
pvchange
pvmove
manage volume groups
vgcreate
vgextend
vgremove
vgreduce
vgchange
vgmerge
manage logical volumes
lvcreate
lvremove
lvextend
lvrename
practice : lvm
solution : lvm
12. iSCSI devices
iSCSI terminology
iSCSI Target in RHEL/CentOS
iSCSI Initiator in RHEL/CentOS
iSCSI target on Debian
iSCSI target setup with dd files
ISCSI initiator on ubuntu
using iSCSI devices
iSCSI Target RHEL7/CentOS7
iSCSI Initiator RHEL7/CentOS7
practice: iSCSI devices
solution: iSCSI devices
13. introduction to multipathing
install multipath
configure multipath
network
start multipathd and iscsi
multipath list
using the device
practice: multipathing
solution: multipathing
III. boot management
14. bootloader
boot terminology
post
bios
openboot
boot password
boot device
master boot record
bootloader
kernel
grub
/boot/grub/grub.cfg
/boot/grub/grub.conf
menu commands
stanza commands
chainloading
simple stanza examples
editing grub at boot time
installing grub
grub2
grub 2.0 ?
/etc/grub.d/40_custom
/etc/default/grub
update-grub
lilo
Linux loader
lilo.conf
practice: bootloader
solution: bootloader
15. init and runlevels
system init(ialization)
process id 1
configuration in /etc/inittab
initdefault
sysinit script
rc scripts
rc directories
mingetty
daemon or demon ?
starting and stopping daemons
chkconfig
chkconfig --list
runlevel configuration
chkconfig configuration
enable and disable services
update-rc.d
about update-rc.d
removing a service
enable a service
customize a service
bum
runlevels
display the runlevel
changing the runlevel
/sbin/shutdown
halt, reboot and poweroff
/var/log/wtmp
Ctrl-Alt-Del
UPS and loss of power
systemd
systemd targets
systemd dependencies
systemd services
systemd signalling
systemd shutdown
remote systemd
there is more systemd
practice: init
solution : init
IV. system management
16. scheduling
one time jobs with at
at
atq
atrm
at.allow and at.deny
cron
crontab file
crontab command
cron.allow and cron.deny
/etc/crontab
/etc/cron.*
/etc/cron.*
practice : scheduling
solution : scheduling
17. logging
login logging
/var/run/utmp (who)
/var/log/wtmp (last)
/var/log/lastlog (lastlog)
/var/log/btmp (lastb)
su and ssh logins
syslogd
about syslog
about rsyslog
modules
facilities
priorities
actions
configuration
restarting rsyslogd
logger
watching logs
rotating logs
practice : logging
solution : logging
18. memory management
displaying memory and cache
/proc/meminfo
free
top
managing swap space
about swap space
creating a swap partition
creating a swap file
swap space in /etc/fstab
monitoring memory with vmstat
practice : memory
solution : memory
19. resource monitoring
four basic resources
top
free
watch
vmstat
iostat
mpstat
sadc and sar
ntop
iftop
iptraf
nmon
htop
20. package management
package terminology
repository
.deb packages
.rpm packages
dependency
open source
GUI software management
deb package management
about deb
dpkg -l
dpkg -l $package
dpkg -S
dpkg -L
dpkg
apt-get
apt-get update
apt-get upgrade
apt-get clean
apt-cache search
apt-get install
apt-get remove
apt-get purge
aptitude
apt
/etc/apt/sources.list
rpm
about rpm
rpm -qa
rpm -q
rpm -Uvh
rpm -e
/var/lib/rpm
rpm2cpio
yum
about yum
yum list
yum search
yum provides
yum install
yum update
yum software groups
/etc/yum.conf and repositories
alien
downloading software outside the repository
compiling software
practice: package management
solution: package management
V. network management
21. general networking
network layers
seven OSI layers
four DoD layers
short introduction to the physical layer
short introduction to the data link layer
short introduction to the network layer
short introduction to the transport layer
layers 5, 6 and 7
network layers in this book
unicast, multicast, broadcast, anycast
unicast
multicast
broadcast
anycast
lan-wan-man
lan
man
wan
pan-wpan
internet - intranet - extranet
tcp/ip
history of tcp/ip
rfc (request for comment)
many protocols
many services
22. interface configuration
to gui or not to gui
Debian nic configuration
/etc/network/interfaces
/sbin/ifdown
/sbin/ifup
RHEL nic configuration
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-
nmcli
nmtui
/sbin/ifup and /sbin/ifdown
ifconfig
up and down
setting ip address
setting mac address
ip
dhclient
hostname
arp
route
ping
optional: ethtool
practice: interface configuration
solution: interface configuration
23. network sniffing
wireshark
installing wireshark
selecting interface
minimize traffic
sniffing ping
sniffing ping and dns
specific ip address
filtering by frame
looking inside packets
other filter examples
tcpdump
practice: network sniffing
solution: network sniffing
24. binding and bonding
binding on Redhat/Fedora
binding extra ip addresses
enabling extra ip-addresses
verifying extra ip-addresses
binding on Debian/Ubuntu
binding extra ip addresses
enabling extra ip-addresses
verifying extra ip-addresses
bonding on Redhat/Fedora
bonding on Debian/Ubuntu
practice: binding and bonding
solution: binding and bonding
25. ssh client and server
about ssh
secure shell
/etc/ssh/
ssh protocol versions
public and private keys
rsa and dsa algorithms
log on to a remote server
executing a command in remote
scp
setting up passwordless ssh
ssh-keygen
~/.ssh
id_rsa and id_rsa.pub
copy the public key to the other computer
authorized_keys
passwordless ssh
X forwarding via ssh
troubleshooting ssh
sshd
sshd keys
ssh-agent
practice: ssh
solution: ssh
26. introduction to nfs
nfs protocol versions
rpcinfo
server configuration
/etc/exports
exportfs
client configuration
practice: introduction to nfs
27. introduction to networking
introduction to iptables
iptables firewall
practice : iptables
solution : iptables
xinetd and inetd
the superdaemon
inetd or xinetd
xinetd superdaemon
inetd superdaemon
practice : inetd and xinetd
network file system
protocol versions
server configuration
client configuration
practice : network file system
VI. kernel management
28. the Linux kernel
about the Linux kernel
kernel versions
uname -r
/proc/cmdline
single user mode
init=/bin/bash
/var/log/messages
dmesg
Linux kernel source
ftp.kernel.org
/usr/src
downloading the kernel source
kernel boot files
vmlinuz
initrd
System.map
.config
Linux kernel modules
about kernel modules
/lib/modules
<module>.ko
lsmod
/proc/modules
module dependencies
insmod
modinfo
modprobe
/lib/modules/<kernel>/modules.dep
depmod
rmmod
modprobe -r
/etc/modprobe.conf
compiling a kernel
extraversion
make mrproper
.config
make menuconfig
make clean
make bzImage
make modules
make modules_install
/boot
mkinitrd
bootloader
compiling one module
hello.c
Makefile
make
hello.ko
29. library management
introduction
/lib and /usr/lib
ldd
ltrace
dpkg -S and debsums
rpm -qf and rpm -V
tracing with strace
VII. backup management
30. backup
About tape devices
SCSI tapes
IDE tapes
mt
Compression
tar
Backup Types
dump and restore
cpio
dd
About dd
Create a CDROM image
Create a floppy image
Copy the master boot record
Copy files
Image disks or partitions
Create files of a certain size
CDROM server example
split
practice: backup
VIII. Appendices
A. disk quotas
About Disk Quotas
Practice Disk quotas
B. introduction to vnc
About VNC
VNC Server
VNC Client
Practice VNC
C. License
Index

List of Tables

4.1. ide device naming
4.2. scsi device naming
5.1. primary, extended and logical partitions
5.2. Partition naming
12.1. iSCSI Target and Initiator practice
12.2. iSCSI Target and Initiator practice
15.1. systemd power management