Linux Administration
Lesson Outline • Getting System Information • Package Management in Linux – – – –
RedHat Package Manager Debian Package Manager Tarball Files On-line Repositories
• Network Configuration – Ethernet Connection – Modem Connection – Wireless Connection
Getting system information – System Processes
• To get information about the processes running on your system we can use ‘ps’ command from the shell prompt. • The ‘ps ax’ (‘ax’ are the parameters passed) command displays a list of current system processes, including processes owned by other users. • To display the owner of the processes along with the processes use the command ‘ps aux’. • The ps output can be long. To prevent it from scrolling off the screen, you can pipe it through ‘less’ command: – ps aux | less
• You can use the ps command in combination with the ‘grep’ command to see if a process is running. E.g. to see if ‘mozilla’ is running type: – ps ax | grep emacs
Getting system information – System Processes (2)
• The ‘top’ command displays currently running processes and important information about them including their memory and CPU usage. • In contrast to ‘ps’ command ‘top’ is interactive and realtime • To exit top, press the [q] key.
Getting system information – System Processes (3) •
In GNOME and KDE you can use a Graphic System Monitor as well. • In GNOME for example select Main Menu Button (on the Panel) => System Tools => System Monitor or type gnome-system-monitor at a shell prompt from within the X Window System to get the GNOME System Monitor tool • GNOME System Monitor gives you almost all the facilities provided by ‘top’ command but graphically • You can end a process, search a process by name etc.
Getting System Information – Memory Usage
• The ‘free’ command displays the total amount of physical memory and swap space for the system as well as the amount of memory that is used, free, shared, in kernel buffers, and cached. • The command ‘free –m’ shows the same information in megabytes, which are easier to read. • This information can also be taken by getting the contents of ‘meminfo’ file in ‘proc’ directory. To do so type: – cat /proc/meminfo
• Graphically you can still use GNOME System Monitor and select the ‘System Monitor’ tab
Getting System Information – Monitor Disks The ‘df’ command reports the system's disk space usage.
• • By default, this utility shows the partition size in 1 kilobyte blocks and the amount of used and available disk space in kilobytes. To view the information in megabytes and gigabytes, use the command ‘df –h’. The -h argument stands for human-readable format. • For more see the appropriate manual page
Main Package Distribution Formats in Linux
• There is no standard package manager in Linux • Packages Distributed in Binaries or Source Code form • Main Package Management Standards – RPM (RedHat Package Manager) (.rpm) • Introduced by RedHat and has been adopted by many other distributions (Fedora, Mandrake, SuSe) . • The most popular Linux package format
– DEB (Debian Package Manager) (.deb) • Introduced by Debian distribution
– Tarball files (.tar.gz/.tar.bz2) • The old-fashioned way of distributing software in Linux/Unix • Compatible with all distros • Main package manager in Slackware, Gentoo
Managing Software in RedHat-based distributions • No standard Graphical RPM Package Manager yet – Depends on the distribution
• Using the command line, packages are installed using rpm utility program – Install a package • rpm -i <package_name>.rpm – Update an existing package • rpm –U <package_name>.rpm – Remove a package • rpm –e <package_name>
Installing software in Debian-based distros • Three ways to manage software packages in Debian • dpkg: Used on .deb files like rpm – Install: dpkg -i <package_name>.deb
• If an older version of the package is installed it updates it automatically by replacing it with the new
– Remove: dpkg -r <package_name>
• dselect: dpkg console front-end • apt-get: The most frequently used way of managing software packages in Debian. – Install: apt-get install <package_name>
• e.g. apt-get install kde to install KDE Window Manager
– Remove: apt-get remove <package_name>
Installing from Tarball files • Compatible with all Linux distributions • Contains a bunch of files of the application, packed in a .tar archive and compressed using GNU Zip (.gz) or BZip2 (.bz2). – Format : .tar.gz or .tar.bz2
• Can be unzipped and unpacked on a directory using the tar command: – tar xvzf .tar.gz – tar xvjf .tar.bz2
• “INSTALL” or “README” files are also exist in this directory giving application-specific usage information
Installing from Source • Software Packages coming in source code archives have to be compiled before installed • Usually come in .tar.gz/.tar.bz2 archives • Typical compilation/installation steps – Unpack the archive:
• tar xzvf <package_name>.tar.gz • tar xvjf <package_name>.tar.bz2
– Change to the extracted directory • cd <extracted_dir_name>
– Run source configuration script as follows: • ./configure
– Build the source code using the GNU Make utility as follows: • make
– Install the package as follows: • make install
On-line Package Repositories
• Large package bases on the Web
– Accessible via FTP or HTTP – Provide package management flexibility with the use of the appropriate tools
• The Debian case (APT - Advanced Packaging Tool)
– The first distribution used organised on-line package repositories – APT utilities set (apt-get, apt-cache etc.) is provided for managing packages on these repositories • Can manage packages in binaries and source format • Provides packages inter-dependency auto-resolve • Contacts repositories listed in /etc/apt/sources.list file • E.g. apt-get remove gnome # Remove GNOME apt-cache search mozilla #Search for package names
• The Gentoo Linux case (emerge)
# containing mozilla”
– Deals mostly with source files – Fetches packages and compiles them according to compilation parameters given in /etc/make.conf – E.g. emerge kde #Fetches, compiles and installs packages for KDE
• The Yellow Dog Linux case (yum)
– Fetches and manages binaries and sources