Josh's Linux Guide - Installing Software Packages Installing Software Packages Created on September 30, 1997 Last updated on July 19, 2000 Development stage: Beta If you've ever wondered how everyone else knows how to install software packages and you don't, read on. Here, I'll try to explain what you should look for when you're downloading all sorts of programs from all over, as well as some examples. This covers installing tarred and gzipped archives, not any distribution-specific software packages. This document should work with all Linux distributions, not just the ones that use RPM. If you're using Red Hat Linux or any other distribution that uses RPM, you can read up on using RPM. Summary Download the software, which is usually in the form *.tar.gz. Extract the archive. Using tar -zxvf archive.tar.gz will usually work. Do the standard ./configure ; make ; make install to configure, compile, and install the software. If you can't find instructions, try looking for a file called INSTALL or README in the directory. Downloading The first step in installing a new program is download the archive. These archives usually come in *.tar.gz files (or *.tgz; same type of compression, different name) which are stored on FTP servers such as sunsite.unc.edu. On servers that aren't fully dedicated to serving out Linux software, the software you're looking for is usually stored in the /pub/linux directory. A lot of servers also have Unix software in /pub/unix, which means they're applications that can run on all (or most) flavors of Unix, of which Linux is also included. Basically, just use your common sense when browsing or searching for programs on these FTP servers. There are a lot of Linux software archives out there, but you probably already have a single program in mind that you want to install. Anyway, here are some FTP sites that contain tons of software you can use with Linux: http://sunsite.unc.edu/pub/Linux ftp://tsx-11.mit.edu/pub/linux ftp://ftp.cc.gatech.edu/pub/linux I know I missed at least a couple of good, popular ones. If you're bored, you can try e-mailing it to me. Basic Stuff for the FTP Program Linux comes with a default ftp program, which probably came with your distribution. With Red Hat it's NetKit, with Slackware it's somewhere in disk set N, and for other distributions I have no idea. Let me know if you can help me out here so I won't sound like an idiot. (Too late, huh?). Anyway, the ftp program will get you into an FTP server. The way you use it is ftp ftp.host.somewhere.com, and you'll be connected to that server. For example, if I were to connect to sunsite.unc.edu, I would type ftp sunsite.unc.edu at the main Linux prompt. If there's an error, like the server being down, just type open host.elsewhere.com when you're at the "ftp>" command line. Now, on to more important stuff. Like how to get your files. Assuming you've changed to the directory you want using the cd command (it works just like MS-DOS), key in ls. If it's a large directory, scroll up using the Shift-PageUp keystroke, use your mouse to highlight the filename, type in "get, hit the spacebar, and then click the right mouse button. Finally, press [Enter] and you should see some FTP language being spit out on your screen. Sometimes you may have to get multiple files. Say you want to get the GIMP, and you've found the directory at ftp.gimp.org. You want to get everything that starts with "gimp". First type in, at the FTP command prompt, prompt. That's right, just type prompt. That will get the FTP client to stop asking you whether you want to get each file when you do the next step. (You can also turn it back on by typing it in again.) Now, use mget followed by any files that you want to get. I suggest using the "*" character to save you some typing. If I wanted to get all the GIMP file, for example, I'd type mget gimp*tar.gz when in the directory for the GIMP archives. After you've downloaded the file, it's in the directory that you started the ftp program from. Most software packages can be extracted anywhere, but just move it to /usr/src/ as a good habit. Use mv filename.tar.gz /usr/src/ so that it will be in the directory /usr/src now. Extracting the Package Once you've got your package downloaded, it's time to extract it. The method of compression that was used to store it might be different; sometimes people might only use .tar to put all the contents of a directory in one file, and sometimes they may use GNU zip (gzip), with a file extension of *.gz, which I think is convenient for compressing single files. Most of the time, though, software packages will come in a *.tar.gz or *.tgz format and will usually extract to one or more directories with the files inside them. Anyway, now that you've got the file, you should know how to extract it (duh!). If it's a *.tar.gz file or a *.tgz file, you would use tar -zxvf [filename]. For example, if you have a file you downloaded called gimp-0.99.17.tar.gz and you downloaded it into /usr/local/src/, you'd do a cd /usr/local/src/ first and then extract the archive using tar -zxvf gimp-0.99.15.tar.gz. The tar -zxvf command line will extract a file, showing you the files and directories which are being extracted. Most Linux/Unix software packages in the *.tar.gz format create a directory after extraction, but watch out for the ones that don't. Compiling and Installing Most of the time, you'll have to have make installed. This is what helps compile large programs and most Unix software packages. However, before running this, you should help the software get to know your system. There's usually a file called configure in the directory that was extracted. Run it by typing ./configure when you're in the directory. That will print out a bunch of stuff that mentions stuff about checking whether gcc works, if automake is installed, if some .h file can be used, that sort of stuff. After running ./configure you should have everything ready to compile. You shouldn't need to worry about optimizing anything right now; you just want that package to run well, which the authors of the software as well as the configure script should have already helped set up for. Usually you can just type make, which will compile the source code for the program. Compiling it is basically taking those text files that contain instructions, the source, and converting it into binary files that will create your program. Sometimes you'll have to type something else after make so that it knows what to do. I had to do this when installing a mail server. Instead of just make, I had to type make lnx so that it would know that I was running Linux. There's make depend, which, I guess, configures what depends on what. Usually, after the make, you'll only need to do a make install. Since make compiles the binary executables (the program), so make install installs them to the proper place. Binaries Most software packages under Linux are available as binary packages, as well. That means you don't have to go to the trouble (or fun) of compiling the package yourself. You should always read the README or INSTALL file, but as a general rule, you can safely use the ./configure ; make ; make install procedure. It probably won't compile anything since binaries are already present, though. Keeping Logs If you are the root user on the system, you should keep a log of where the files installed to, in case you ever want to remove them. Create a directory in your home directory (/root/) called install_logs using mkdir /root/install_logs. That will create the directory /root/install_logs so you can have text files telling you exactly where programs installed their files to. Where are these text files going to come from, though? Well, assuming that you use a standard make install, just type in make install > /root/install_logs/program-1.0, where program-1.0 is the name and version of your software. That basically installs the files where they're supposed to be, while at the same time writing to a file exactly what would have been echoed out to the screen. Even if you already did make install, you can still do a make install > /root/install_logs/program-1.0. That will reinstall the binaries, but that usually won't matter, since they're the same files, just being written to the same place again. I guess there are some instances where you wouldn't want to do this, but generally it's safe to do many make install commands. This isn't absolutely necessary, but it will help you keep track of where your software files are, in case you want to get rid of them. Cleaning Up Usually when you're done and you know that the program is working, you can type rm -rf directory, where "directory" is the directory created when you extracted a file. You won't need that anymore, because it's just source code, but if you want to look at the source code and modify the program, you should keep it around. Tips When you can't seem to figure out what to do, just try reading a file called INSTALL in the directory that the tarred and gzipped file extracted. If there is no INSTALL file, check for a file called README. Related Pages Using RPM Questions, comments, suggestions, contributions, any feedback at all? I sure would like you hear what you have to say about my work. My e-mail address is jgo@local.net. Copyright © 1997-2000 HREF="mailto:jgo@local.net">Joshua Go (jgo@local.net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.