Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 12 Linux Disk and System Management

395

To enable the interface, use the following command:

ifconfig eth0 up

The following list includes some of the options that you can set with the ifconfig command:

interface: The name of the interface.

up: This flag causes the interface to be activated.

down: This flag causes the driver for this interface to be shut down.

[-]arp: Enable or disable the use of the ARP protocol on this interface.

[-]promisc: Enable or disable the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.

[-]allmulti: Enable or disable all-multicast mode. If selected, all multicast packets on the network will be received by the interface.

metric N: This parameter sets the interface metric.

mtu N: This parameter sets the Maximum Transfer Unit (MTU) of an interface.

netmask addr: Sets the IP network mask for this interface.

[-]broadcast [addr]: If the address argument is given, set the protocol broadcast address for this interface.

address: The IP address to be assigned to this interface.

You don’t need to use all the options of the ifconfig command, but know how to configure a basic ethernet or loopback interface.

Installing System Packages and Patches

5.5 Download and install patches and updates (e.g., packages, tgz)

Upgrading a system service or application is a common task for an administrator. You may need to upgrade a package or install a system or application patch for many reasons, including:

Bug Fixes: Most upgrades fix a number of program bugs since the last release of the program. This ensures that you are using the most current stable version.

Enhanced Functionality: Most new upgrades enhance the functionality of the program. This will help the user base by giving them additional tools with which to enhance their work.

396 Part V Maintaining the Linux System

Increased Security: Many programs come with severe security flaws. These are usually patched up in later releases. It is extremely important to keep your programs up-to-date regarding security enhancements.

Any type of system upgrade or patch that you perform should take place during offhours, so as not to affect the users. If users are logged into the system with files open, an upgrade or patch may cause data corruption — because you may need to stop or restart a program or service, or reboot the system. Remember to mention any upgrades or system maintenance in the “Message of the Day” file in /etc/motd. This reminds users to log off before they leave work, so no files will be open.

Software packages come in many different types. The most common method for packaging a group of files is using the tar and gzip utilities to create an archive file and compress it. These files are denoted by the extension tar.gz. Some distributions offer their own packaging format, such as RPM (Redhat Package Manager), or Slackware, which uses a modified tar and gzip package with the extension .tgz.

Compressed archive

Most programs and patches come in the form of a compressed archive. A program patch or upgrade contains several source code files, binaries, and program libraries. A compressed archive consists of all the files that are part of the update, tied together in a single file called a tar archive.

One problem with tar is that it doesn’t actually compress the files in the archive; therefore, they can often be very large in size, which makes them more difficult to download over slow Internet connections, and impossible to fit on a floppy disk. To compress the archive, use the gzip utility. This utility compresses the data in a file into the smallest possible form. When used in conjunction with the tar utility, you can create a collection of files, and then compress them so that you only need one small file.

The resulting file has a .tar.gz extension, indicating that it is a tar file that has been compressed with gzip. To extract the file, use the gunzip command to unzip the file:

gunzip packagename.tar.gz

After the command completes, the file will be unzipped, and the remaining product is the tar archive file. Then, you can use the tar command to extract the files from the archive:

tar -xvf packagename.tar

The tar utility also comes with the capability of unzipping the archive while extracting files at the same time. To do this, use the -z switch:

tar -zxvf packagename.tar.gz

Chapter 12 Linux Disk and System Management

397

Performing the gunzip and tar extract commands together is a lot easier than using the two separate commands to extract and unzip the files.

After the file has been extracted, be sure to read the documentation before installing the upgrade or patch. Typically, a README file will give you installation instructions.

From the README file, you may have to compile the source code into a binary, and then execute the binary to start your upgrade or patch. Often, this process can be very tedious and time-consuming.

1.Run the configure command. This prepares the system for installation, and ensures that you have the proper compiler and any other dependencies for the operation.

2.Use the make command to compile the source code into binary format.

3.Use the make install command. This command installs your binary in the proper location.

After you finish, you can remove the original source files and the compressed file.

RPM

The RPM (Redhat Package Manager) format is another type of package installation. RPM is a utility that streamlines the method for installing applications, upgrades, and patches.

By installing an application through RPM, you only need to activate one command to uncompress and install your application package. You don’t need to use tar, gzip, or tediously compile source code. The RPM manager does all this automatically. Although created by Redhat, the RPM format is used by many different distributions for package installation.

RPM packages come with the extension .rpm. To install it, simply use the install option:

rpm -i packagename.rpm

To see more information when installing, use the verbose and hash mark options, which allow you to see a better view of what is being installed.

rpm -ivh packagename.rpm

If you have an existing application that you want to upgrade, use the upgrade option. If the application doesn’t already exist, it will install anyway.

rpm -Uvh packagename.rpm

398 Part V Maintaining the Linux System

To delete an application installed through RPM, use the erase function. This quickly and efficiently removes your application entirely:

rpm -e packagename.rpm

Only update a package or install a patch if you are currently experiencing issues that are fixed by the update. Needlessly updating an application or applying a patch can often lead to system problems that you aren’t prepared for.

Debian Package Installer

Packages for the Debian Linux distribution have the extension .deb. To install or manipulate these files, use the dpkg utility.

To install a Debian package, use the following command: dpkg -i packagename.deb

To obtain a list of files that are contained in the package without installing them, use the following command:

dpkg -L packagename.deb

To remove or uninstall a package, use the following command: dpkg -r packagename.deb

Slackware Package Installation

Slackware’s package management system utilizes .tgz files as its package format. Although the type of file is very similar to a standard tar.gz file, and can be unzipped and untarred as usual, the resulting package is only intended for installation on a Slackware system.

You can install Slackware packages by using a menu-driven tool called pkgtool. From the command line, you can use different utilities, depending on what you want to do with the package. For example, to install a package, use the following command:

installpkg packagename.tgz

The installpkg utility comes with an excellent installation option, which shows you what happens if you install a particular package. The “warn” option allows you to test a package before installing on a production system. To test install the package, use the following command:

installpkg -warn packagename.tgz

To remove a package from a system, use the removepkg command:

removepkg packagename

Соседние файлы в предмете Операционные системы