Mastering Linux
Total Page:16
File Type:pdf, Size:1020Kb
MASTERING LINUX installing software Mastering Linux, part 9 This month Jarrod Spiga demonstrates how to install packages on a To add or remove packages, drill down into the relevant group by clicking on Details. Ensure all Linux system with Red Hat Package Manager (RPM) and Yellow dog checkboxes for the applications you want to install Updater, Modified (yum). are ticked. Some packages within program groups won’t have checkboxes next to them. These are usually Why spend hundreds or even thousands of dollars prerequisite packages which must be installed for on fancy boxed software packages when there are that program group. often open source equivalents readily available for After selecting the packages you want to install, little or no cost? For the most part, finding the hit Install Packages at the bottom of the Add and software is a piece of cake. Most hurdles are Remove Software tool. Confirm your selections at encountered when it comes to installing packages, the dialog to begin the install. You may be asked to since the process is a little more involved than insert the installation media into your optical drive running setup.exe. It can be a bit difficult getting during the procedure. your head around managing prerequisite, 2 After adding the packages, run up2date co-requisite and conflicting packages, let alone and download any updates available for the compiling your own applications. But there are tools newly-installed applications. The sole drawback Bonus DVD software available to make things easier. to installing from CD is that you don’t always have PDFs of every instalment of the latest, most secure versions. the Mastering Linux series. ADD AND REMOVE PROGRAMS Part of the reason why Fedora Core 3 is a four-CD A TASTE OF YUM Skill level download is that it ships with an extensive array of The Add and Remove Software tool only lists the popular software packages. Most aren’t packages bundled on the Fedora Core 3 CDs. There Intermediate automatically installed to conserve disk space, but are hundreds of other applications downloadable all are readily accessible from the CDs should you via the Yellow dog Updater, Modified (yum). Requirements need them. Yum is an automated update and package An installation of Linux 1 The quickest and easiest way to check what’s on installation app for RPM-based systems (including (Fedora Core 3 was used the CDs is to use the Add and Remove Software tool, Fedora) that runs at the command line. Its main in the writing of this article) located under GNOME > System Settings. If you purpose is to determine all the dependencies for • a working network or aren’t logged in as the root user, you’ll be asked for packages being installed or upgraded, and to figure Internet connection. the root password to continue. out which order to install those dependencies so At launch, the tool scans your system and everything works. Time to complete compiles a list of the software that’s already installed. Yum is the application used to download 3 hours (approx) Then the Add Package Groups screen appears. and install updates in the correct order. Pick a package: many software applications can be installed on your Linux Always update: after installing packages from CD, it’s a good idea to run 1 system using the Add and Remove Packages tool. 2 up2date to ensure that those are the latest stable versions. 1 apcmag.com mastering linux part 9 apcmag.com mastering linux part 9 2 MASTERING LINUX installing software Configuring yum was explained in part come across an application that’s not one of this series (APC December 2004, available for download via yum. page 98; also in PDF format on this month’s Many developers package cover DVD). software for download in RPM 3 To download and install software using format — the same format as yum. yum, you’ll need to know the name of the However, installing an RPM is more package you want. You can use the list involved than using yum: you have argument to the yum command to guess to download all the required package names, but it can take some time packages and resolve any for online repositories to tell you whether dependencies or conflicts manually you’ve guessed correctly. A better way is before installation. to create a single file with a listing of all 4 Installing and upgrading RPM of the packages available. To do so, bring packages from the GUI is very up a command prompt and run as the simple: just navigate to the location root user: of the appropriate RPM package and double-click on it. If you’re not Package hunt: Rpmfind.net is an array of mirrors containing yum list available > ~/yum-list.txt logged in as root, you’ll be prompted thousands of applications packaged in RPM format, ready for your for the root password to proceed. Fedora Core 3 system. Your system will then check what To search through a list of packages, simply prerequisites are needed. rpm -Ivh <package name> run the following command: 5 Once this evaluation is complete, a dialog will appear that reports how many packages cat yum-list.txt | grep <name> will be installed, and how much disk space where <package name> is the name of the they will consume. Select continue and package(s) that you’re installing. In this Fedora installs or upgrades everything, example, the v switch to the rpm command where <name> is part of the name of the including the prerequisite RPM files (if provides more detailed output. Without it, the packages you’re looking for. Fedora can find them). rpm command only displays errors The advantage of yum is that you’ll always If Fedora can’t find any required RPM files, encountered. The h switch prints hashes (#) as download and install the latest version of the an error message pops up displaying the a pseudo-progress bar at the command line, package — there’s no need to update after packages that can’t be located. You’ll need to giving you an idea of how the installation is installation. And when future versions come resolve any failed dependencies (see “Failed proceeding. out, you don’t have to do anything more than dependencies”, right) before the installation A similar command can be used to run up2date again. will succeed. upgrade packages, though you’d use the U You can also install RPM packages from (for upgrade) switch instead of I (for install). RPM the command line. The rpm command Even though the yum repository contains can perform a variety of tasks — running FAILED DEPENDENCIES thousands of software packages, you may rpm --help from the command line lists Managing dependencies is one of the more the functions available. difficult tasks when installing RPM packages. The following command In extreme cases, you’ll need to satisfy a lineline cancan bebe usedused toto installinstall a number of prerequisites to install a package, packagepackage viavia RPM:RPM: but some of those prerequisites have prerequisites of their own. List all that’s yum: saving a list of all available yum packages makes for speedy Quick and easy: installing RPM packages is too easy when using the 3 searching in the future. 4 GUI — provided that X-Windows can find all the required packages. 1 apcmag.com mastering linux part 9 apcmag.com mastering linux part 9 2 MASTERING LINUX installing software If you have failed dependencies, the first BUILDING AND COMPILING necessary for compilation. After configuration, place to look is on the Fedora CDs. Insert the Almost every application under Linux can build the application by running: first Fedora Core 3 CD and at a command line, be compiled directly from source code, mount the disk by entering: even if RPMs are available. Most applications make for Linux are written using the C mount /mnt/cdrom programming language, and the GNU Don’t expect to understand a lot of the output Compiler Collection (GCC) is used to build — it’s often useful in debugging a Search for the required RPM by typing: and compile them. compilation, but will only be of use should This process usually involves three steps: your build fail. find /mnt/cdrom -print | grep Configuration making any customisations Once your system stops processing code, <dependency> and applying any settings to the package. look at the last few lines of output. If you see Building the actual compilation of the any errors, the build has failed. You’ll need to where <dependency> is the name of the source code and your configuration to rectify these errors before running the make dependency you’re looking for. If you find it, create the executable files and data that command again. In most cases, failed builds copy the relevant RPM files to the same make up the application. are the result of missing prerequisites or a bad location as the RPM. If you don’t find the Installation copying the executable files configuration. In both cases, refer to the dependency, unmount the CD-ROM: and data to appropriate locations on your INSTALL file. file system. unmount /mnt/cdrom You’ll usually download the source code in GET GOING a gzipped tarball format — a format similar to Once you have a successful build, copy the and search the next CD. If you’ve searched a ZIP file and carries the TAR.GZ extension. To necessary files to working locations by typing: every CD and still can’t find it, there are a extract the source file from the gzipped number of online RPM libraries that can be tarball, you could run: make installStart me up searched, such as www.rpmfind.net.