® 2007. epam systems. all rights reserved. delivering excellence in software engineering ® 2007....
TRANSCRIPT
® 2007. EPAM Systems. All rights reserved.
Delivering Excellence in Software Engineering
® 2007. EPAM Systems. All rights reserved.
by Aliaksandr Stelmachonak, Dzmitry Kuchko
GNU/Linux FundamentalsPart 3
® 2007. EPAM Systems. All rights reserved. 2
Network Configuration
® 2007. EPAM Systems. All rights reserved.
Network interface configurator
ifconfig – configure and control TCP/IP
network interfaces
Example:
Common uses for ifconfig include
• setting an interface's IP address and netmask
• and disabling or enabling a given interface
ifconfig
displaying the current state of network interfaces
® 2007. EPAM Systems. All rights reserved.
Network interface configurator
ifconfig –a
ifconfig eth0
ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 inet 192.168.1.13 netmask 255.255.255.0
displaying the current state of eth0 interface
Setting configuration for eth0 interface
display all interfaces which are currently available, even if down
Activating and deactivating eth0 interface
® 2007. EPAM Systems. All rights reserved.
Network commands
$ ping google.com
$ ping –c 5 google.com
$ traceroute google.com
$ tracepath ya.ru
$ host ya.ru
$ host 213.180.204.8
$ dig ya.ru
$ dig –x 213.180.204.8
sending a ping request
show the network route for a given host
translate ip address to hostname or vice versa
Another method
® 2007. EPAM Systems. All rights reserved.
Slamd64MOPSLinuxZenwalkSUSE LinuxOpenSUSE Knoppix
XandrosLindows/Linspire/FreespireSimplyMEPISUbuntu Family
Red FlagYellow DogCentOSMandrake/MandrivaFedora
Linux distros hierarchy
® 2007. EPAM Systems. All rights reserved.
/etc/sysconfig/network• /etc/sysconfig/
network-scripts/ifcfg-ethX
• /etc/sysconfig/network
• /etc/resolv.conf
Debian based
• /etc/network/interfaces
• /etc/hostname
• /etc/resolv.conf
Differences between distros
Red Hat based
® 2007. EPAM Systems. All rights reserved.
[root@rhel ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0• DEVICE=eth0
• IPADDR=208.164.186.1
• NETMASK=255.255.255.0
• NETWORK=208.164.186.0
• BROADCAST=208.164.186.255
• ONBOOT=yes
•
root@ubuntu:~# cat /etc/network/interfaces
• auto lo eth0
• iface eth0 inet static
• address 192.168.0.10
• netmask 255.255.255.0
• gateway 192.168.0.1
Main Settings
BOOTPROTO=dhcp
dhcp
® 2007. EPAM Systems. All rights reserved.
[root@rhel ~]# cat /etc/sysconfig/network• NETWORKING=yes
• FORWARD_IPV4=yes
• HOSTNAME=myhost.local
• GATEWAY=192.168.0.1
root@ubuntu:~# cat /etc/hostname• myhost.local
• ;-)
Host name
® 2007. EPAM Systems. All rights reserved.
root@generic-linux:~# cat /etc/resolv.conf• domain minsk.epam.com
• search epam.com. minsk.epam.com.
• nameserver 10.6.0.6
• nameserver 10.6.0.16
DNS and search domains
® 2007. EPAM Systems. All rights reserved.
root@ubuntu:~# /etc/init.d/networking restart
* Reconfiguring network interfaces... [ OK ]
Restarting network
root@rhel:~# service network restart
Shutting down interface eth0: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done. [ OK ]
® 2007. EPAM Systems. All rights reserved. 12
Software management (yum & apt)
® 2007. EPAM Systems. All rights reserved.
Slamd64MOPSLinuxZenwalkSUSE LinuxOpenSUSE Knoppix
XandrosLindows/Linspire/FreespireSimplyMEPISUbuntu Family
Red FlagYellow DogCentOSMandrake/MandrivaFedora
Linux distros hierarchy
® 2007. EPAM Systems. All rights reserved.
Some definitions
A software package refers to computer software packaged in an archive format to be installed by a package management system or a self-sufficient installer.
A package management system is a collection of tools to automate the process of installing, upgrading, configuring, and removing software packages from a computer.
® 2007. EPAM Systems. All rights reserved.
Red Hat based
• RPM
• rpm
• yum
Debian based
• DEB
• dpkg
• apt
General Differences between distros
® 2007. EPAM Systems. All rights reserved.
Some definitions
RPM (Red Hat Package Manager) is a package management system. Originally developed by Red Hat for Red Hat Linux, RPM is now used by many Linux distributions.
YUM (The Yellow dog Updater, Modified) is an open source command line package management utility for RPM-compatible Linux operating systems and has been released under the GNU GPL.
deb is the extension of the Debian software package format and the most often used name for such binary packages. Like the "Deb" part of the term Debian, it originates from the name of Debra, then girlfriend and now ex-wife of Debian's founder Ian Murdock
APT, or The Advanced Packaging Tool, is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants.
® 2007. EPAM Systems. All rights reserved.
YUM: configuration and usage
/etc/yum.conf
yum –hyum list |more yum info firefoxyum search firefoxyum deplist firefoxyum install mcyum remove mcmc check-update
yum update
yum clean all
main configuration file
Viewing yum optionsListing installed packagesGetting package descriptionsSearching for packagesViewing package
dependenciesInstall packageRemove packageCheck for update for
particular packageUpdate all of the outdated
packagesCleaning up the yum cache
® 2007. EPAM Systems. All rights reserved.
YUM: repositories
[root@centos ~]# ls /etc/yum.repos.d/CentOS-Base.repo CentOS-Media.repo
[root@centos ~]# cat /etc/yum.repos.d/CentOS-Base.repo[base]name=CentOS-$releasever – Basebaseurl=http://mirror.yandex.ru/centos/5.4/os/x86_64/gpgcheck=0enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[updates]name=CentOS-$releasever – Updatesbaseurl=http://mirror.centos.org/centos/$releasever/updates/
$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Name of repo
User friendly name of repo
url to repos
activity flag
® 2007. EPAM Systems. All rights reserved.
apt - Advanced Package Tool
•apt-get•apt-cache•apt-cdrom•aptitude
® 2007. EPAM Systems. All rights reserved.
apt-get
apt-get is a simple command line interface for downloading and installing packages. The most frequently used commands are update and install.
• update - Retrieve new lists of packages• upgrade - Perform an upgrade• install - Install new packages (pkg is libc6 not libc6.deb)
• remove - Remove packages• purge - Remove packages and config files• check - Verify that there are no broken dependencies
® 2007. EPAM Systems. All rights reserved.
apt-cache
apt-cache is a low-level tool used to manipulate APT's binary cache files, and query information from them.
• showpkg - Show some general information for a single package
• search - Search the package list for a regex pattern
• show - Show a readable record for the package• depends - Show raw dependency information for a package
• pkgnames – show all installed packages
® 2007. EPAM Systems. All rights reserved.
apt-cdrom
apt-cdrom is a tool to add CDROM's to APT's source list. The CDROM mount point and device information is taken from apt.conf and etc/fstab.• add - Add a CDROM• ident - Report the identity of a CDROM
® 2007. EPAM Systems. All rights reserved.
aptitude
Synaptic is high-level interface to the package manager
Synaptic Package Manager
® 2007. EPAM Systems. All rights reserved.
aptitude
aptitude is high-level interface to the package manager
aptitude
® 2007. EPAM Systems. All rights reserved.
apt: repositories
root@host-93:~# cat /etc/apt/sources.list
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic main restricted
deb-src ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic main restricted
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic universedeb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-security
maindeb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-security
restricteddeb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-updates
maindeb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-updates
restricted
name of distr
type url to repos types of repos
® 2007. EPAM Systems. All rights reserved. 26
Samba client
® 2007. EPAM Systems. All rights reserved.
Kickstart
root@ubuntu:~# apt-get install smbclientroot@ubuntu:~# apt-get install smbfs
root@ubuntu:~# smbclient -U name_surname -W minsk.epam.com -L 10.6.5.70
root@ubuntu:~# smbclient -U name_surname -W minsk.epam.com //EPBYMINW0777/upload
root@ubuntu:~# mkdir /media/1/root@ubuntu:~# smbmount
//EPBYMINW0934.minsk.epam.com/upload /media/1/ -o user=name_surname,dom=minsk.epam.com
root@ubuntu:~# ls /media/1/
you must specify existing share!!!
® 2007. EPAM Systems. All rights reserved. 28
Linux boot process
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary
• BIOS
• LILO or GRUB (boot loader)
• Kernel (+ initrd)
• init
• Run Levels
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: BIOS
Load boot sector from one of:
• Floppy
• CDROM
• Hard drive
The boot order can be changed from within the BIOS settings.
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: LILO or GRUB
Lilo (Linux loader)
• does not understand
filesystems
• uses the BIOS routines to load
Loading sequence
• load menu code, typically
/boot/boot.b
• prompt for (or timeout to
default) partition or kernel
• for "image=" option load
kernel image
GRUB (GRand Unified
Bootloader)
• More advanced and
commonly used
• Understands file systems
• config lives in
/boot/grub/menu.lst or
/boot/boot/menu.lst
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: kernel
• initialize devices
• (optionally loads initrd)
• mounts root filesystem
• runs /sbin/init which is process number 1 (PID=1)
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: initrd
initrd
• is a temporary file system used by the Linux kernel during
boot
• typically used for making preparations before the real root
file system can be mounted
initramfs – modern substitute for initrd
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: /sbin/init
reads /etc/inittab (see man inittab)
• Run boot scripts, eg for redhat /etc/rc.d/rc.sysinit which:
• loads modules
• check root FS and mount RW
• mount local FS
• setup network
• mount remote FS
• Switches to default runlevel, eg 3 (defined in /etc/inittab,
eg: id:3:initdefault: )
• run scripts /etc/rc3.d/S*
• run programs specified in /etc/inittab
® 2007. EPAM Systems. All rights reserved.
Boot sequence summary: runlevels
The term runlevel refers to a mode of operation in one of
the computer operating systems that implement Unix
System V-style initialization.
Differs for different UNIX systems and Linux distributives
Red Hat Linux/Fedora runlevels
® 2007. EPAM Systems. All rights reserved.
Managing init levels
root@ubuntu:~# init 3
root@ubuntu:~# telinit 5
root@ubuntu:~# runlevel3 5
previous
current
® 2007. EPAM Systems. All rights reserved.
Questions?