[email protected]

Report
Delivering Excellence in Software Engineering
GNU/Linux Fundamentals
Part 3
by Aliaksandr Stelmachonak, Dzmitry Kuchko
® 2007. EPAM Systems. All rights reserved.
® 2007. EPAM Systems. All rights reserved.
Network Configuration
® 2007. EPAM Systems. All rights reserved.
2
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
displaying the current state
of network interfaces
ifconfig
® 2007. EPAM Systems. All rights reserved.
Network interface configurator
ifconfig –a
display all interfaces which are
currently available, even if down
displaying the current state
of eth0 interface
ifconfig eth0
Activating and deactivating
eth0 interface
ifconfig eth0 up
ifconfig eth0 down
Setting configuration for
eth0 interface
ifconfig eth0 inet 192.168.1.13 netmask 255.255.255.0
® 2007. EPAM Systems. All rights reserved.
Network commands
$ ping google.com
sending a ping request
$ ping –c 5 google.com
$ traceroute google.com
$ tracepath ya.ru
$ host ya.ru
show the network route for
a given host
translate ip address to
hostname or vice versa
$ host 213.180.204.8
$ dig ya.ru
$ dig –x 213.180.204.8
® 2007. EPAM Systems. All rights reserved.
Another method
Linux distros hierarchy
Slamd64
MOPSLinux
Zenwalk
SUSE Linux
OpenSUSE
® 2007. EPAM Systems. All rights reserved.
Knoppix
Xandros
Lindows/Linspire/Freespire
SimplyMEPIS
Ubuntu Family
Red Flag
Yellow Dog
CentOS
Mandrake/Mandriva
Fedora
Differences between distros
Red Hat based
Debian based
/etc/sysconfig/network
• /etc/sysconfig/network
-scripts/ifcfg-ethX
• /etc/network/interf
aces
• /etc/sysconfig/network
• /etc/hostname
• /etc/resolv.conf
• /etc/resolv.conf
® 2007. EPAM Systems. All rights reserved.
Main Settings
[[email protected] ~]# cat
/etc/sysconfig/networkscripts/ifcfg-eth0
[email protected]:~# cat
/etc/network/interfa
ces
• DEVICE=eth0
• auto lo eth0
• IPADDR=208.164.186.1
• iface eth0 inet static
• NETMASK=255.255.255.0
• address 192.168.0.10
dhcp
• NETWORK=208.164.186.0 • netmask 255.255.255.0
• BROADCAST=208.164.186 • gateway 192.168.0.1
.255
• ONBOOT=yes
•
BOOTPROTO=dhcp
® 2007. EPAM Systems. All rights reserved.
Host name
[[email protected] ~]# cat
/etc/sysconfig/network
[email protected]:~# cat
/etc/hostname
• NETWORKING=yes
• myhost.local
• FORWARD_IPV4=yes
• ;-)
• HOSTNAME=myhost.local
• GATEWAY=192.168.0.1
® 2007. EPAM Systems. All rights reserved.
DNS and search domains
[email protected]:~# cat /etc/resolv.conf
• domain minsk.epam.com
• search epam.com. minsk.epam.com.
• nameserver 10.6.0.6
• nameserver 10.6.0.16
® 2007. EPAM Systems. All rights reserved.
Restarting network
[email protected]:~# /etc/init.d/networking restart
* Reconfiguring network interfaces...
[ OK ]
[email protected]:~# service network restart
Shutting down interface eth0:
[ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
® 2007. EPAM Systems. All rights reserved.
[ OK ]
Software management (yum & apt)
® 2007. EPAM Systems. All rights reserved.
12
Linux distros hierarchy
Slamd64
MOPSLinux
Zenwalk
SUSE Linux
OpenSUSE
® 2007. EPAM Systems. All rights reserved.
Knoppix
Xandros
Lindows/Linspire/Freespire
SimplyMEPIS
Ubuntu Family
Red Flag
Yellow Dog
CentOS
Mandrake/Mandriva
Fedora
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.
General Differences between distros
Red Hat based
Debian based
• RPM
• DEB
• rpm
• dpkg
• yum
• apt
® 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
main configuration file
yum –h
yum list |more
yum info firefox
yum search firefox
yum deplist firefox
yum install mc
yum remove mc
mc check-update
Viewing yum options
Listing installed packages
Getting package descriptions
Searching for packages
Viewing package dependencies
Install package
Remove package
Check for update for particular
package
Update all of the outdated
packages
Cleaning up the yum cache
yum update
yum clean all
® 2007. EPAM Systems. All rights reserved.
YUM: repositories
[[email protected] ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Media.repo
[[email protected] ~]# cat /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever – Base
baseurl=http://mirror.yandex.ru/centos/5.4/os/x86_64/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[updates]
name=CentOS-$releasever – Updates
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
® 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.
Synaptic Package Manager
aptitude
Synaptic is high-level interface to the package manager
® 2007. EPAM Systems. All rights reserved.
aptitude
aptitude
aptitude is high-level interface to the package manager
® 2007. EPAM Systems. All rights reserved.
apt: repositories
[email protected]:~# 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 universe
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-security main
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-security restricted
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-updates main
deb ftp://mirror.minsk.epam.com/pub/Ubuntu/ubuntu/ karmic-updates restricted
® 2007. EPAM Systems. All rights reserved.
Samba client
® 2007. EPAM Systems. All rights reserved.
26
Kickstart
[email protected]:~# apt-get install smbclient
[email protected]:~# apt-get install smbfs
[email protected]:~# smbclient -U name_surname -W minsk.epam.com -L
10.6.5.70
[email protected]:~# smbclient -U name_surname -W minsk.epam.com
//EPBYMINW0777/upload
[email protected]:~# mkdir /media/1/
[email protected]:~# smbmount //EPBYMINW0934.minsk.epam.com/upload
/media/1/ -o user=name_surname,dom=minsk.epam.com
[email protected]:~# ls /media/1/
® 2007. EPAM Systems. All rights reserved.
Linux boot process
® 2007. EPAM Systems. All rights reserved.
28
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
GRUB (GRand Unified Bootloader)
• More advanced and commonly
used
Loading sequence
• Understands file systems
• load menu code, typically
• config lives in /boot/grub/menu.lst
/boot/boot.b
• prompt for (or timeout to default)
partition or kernel
• for "image=" option load kernel
image
® 2007. EPAM Systems. All rights reserved.
or /boot/boot/menu.lst
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
[email protected]:~# init 3
[email protected]:~# telinit 5
[email protected]:~# runlevel
35
® 2007. EPAM Systems. All rights reserved.
Questions? 
® 2007. EPAM Systems. All rights reserved.

similar documents