Installing programs and upgrading versions

Discussion in 'Intermediate Tutorials' started by Rob, Jul 9, 2013.

  1. Rob

    Rob Administrator Staff Member

    Messages:
    575
    Likes Received:
    229
    Trophy Points:
    43
    As system administrator, one of the most important tasks is to install programs. This also implies un-installing some as well. The procedure to follow depends mainly on the Linux distribution you're using. There may be other factors as well, like the install scripts provided by developers and companies.

    What's your flavor?

    It was in vogue a few years ago to refer to different Linux distributions as "flavors" of Linux. Although there is a movement afoot to standardize the installation of Linux, there exist important differences among the major distributions on the market. The less well-known distributions normally pick up their installation procedures from the bigger players. Each has their own "package" install system. Let's look at the best known ones:

    Slackware

    Slackware (http://www.slackware.com) has traditionally been the purists' distribution of choice. As far as this writer can gauge though, it's being gradually upstaged by Gentoo Linux in that role. (More on Gentoo later) Slackware relies on a system that installs tarballs with a *.tgz extension. Typing:

    Code:
    installpkg program.tgz
    installs a program. Use the option -warn with installpkg if you want to know what new files are going to installed. If you're of the "Doubting Thomas" persuasion, you can appreciate this option. Typing:

    Code:
    removepkg program.tgz
    will remove the application and any other supplementary files, like documentation.

    You can upgrade programs to newer versions with this command:

    Code:
    upgradepkg new_version.tgz
    Debian GNU/Linux

    Debian (http://www.debian.org) has always been the preferred distributions of another type of purist: the licensing purist. Only truly open source packages go into the official Debian release. That doesn't mean that others can't create non-official packages. They often do. Regardless of its status, if you get a new package, you can install it the traditional way:

    Code:
    dpkg -i package.deb
    That will install a program on a system running Debian GNU/Linux.

    Debian is perhaps the best distribution out there if you're interested in keeping your system's packages up-to-date in a fairly painless way. This is accomplished by using the apt-get system. apt stands forAdvanced Package Tool. You can really take advantage of this tool if you've got a broadband or better connection. To set up for using it, type:

    Code:
    apt-setup
    and it will ask you about information about where you want to get the packages (mirrors) and other ones related to keeping your system up-to-date. Now you're free to start using it.

    To simply install a program, you would type:

    Code:
    apt-get install new_package.deb
    It will look for the package on a remote server and install that package. What's even better is that it will automatically resolve any dependencies that you might have. We all know how nasty packages can be when you haven't got the right libraries or other program installed that it needs. apt-get rivals aspirin as a headache reliever in these cases. Likewise, you can use this command to uninstall programs:

    Code:
    apt-get remove unwanted_package.deb
    The real advantage to this system is that you can use it to update multiple packages or even update your whole system. By typing:

    Code:
    apt-get update
    and then

    Code:
    apt-get upgrade
    you can ensure that your machine is always running the latest offerings from the folks who develop Debian.

    Red Hat and other RPM based distributions

    At the time of this writing, the three most popular commercial distributions are Red Hat, SuSE and Mandrake. These distributions use the popular Red Hat Package Management system (RPM for short) to install and upgrade Linux programs.

    To install a program on any RPM based distribution, type:

    Code:
    rpm -i new_program.rpm
    (the -i option means install). That should simply install the program on your system and any documentation that accompanies it. If you're not sure whether you have that program installed already, you might want to check out your inventory of installed RPMs using the -qa (query/all) options and piping the output to grep.

    Let's say you wanted to look for popular Apache modules you might have. You would type this:

    Code:
    rpm -qa | grep mod_
    You might get output like this:


    Code:
    mod_php4-4.0.4pl1-90
    mod_perl-1.25-30
    mod_python-2.7.2-27

    This comes in handy if you've heard about some security alert pertaining to certain packages. You can see exactly what packages and versions you've got on your system. If your version number is among those vulnerable, you can pick up a new RPM at the company's FTP site and update it:


    Code:
    rpm -F new_improved_package.rpm
    Something you may want to do to increase your security is to verify the packages. There have been instances of crackers switching packages on FTP servers. Not too long ago, there was a case where a "trojaned" copies of the open source version of Secure Shell, OpenSSH, appeared on some FTP servers as well as cracked versions of Sendmail, the world's most popular email server program. This is particularly nasty, so you would want to avoid something like this happening. We'll go into security in greater detail, but the RPM system provides a way to verify that the packages you download are authentic and haven't been tampered with.

    Code:
    rpm -v -checksig some_package.rpm
    This presupposes a couple of things:

    You have gpg, the GNU project's Pretty Good Privacy clone, installedYou have retrieved your Linux distribution company's public key.Check with your vendor for details on getting their public key. These days, there's no such thing as paranoia when it comes to protecting your machines and network. As the saying goes: Caution is the better part of valor.

    Windows substitutes - LindowsOS and Xandros

    We're just going to mention these distributions briefly. The reason for this is because these new distributions, LindowsOS and Xandros, are meant, in the opinion of this writer, to be Microsoft Windows substitutes. If you consider yourself an intermediate level user of Linux, you would find these distributions too limited to employ them in business, scientific or other technical environments. They are, in fact, ``dumbed-down'' so to speak. Far be it for me to imply that anyone who uses these distributions are dummies, but they are hostile to tweaking in the way that the accomplished Linux users like. They are also geared around the use of WINE, an MS Windows emulator, to run Microsoft programs without a lot of fuss, so ideally, their environment is the home or office workstation.

    Both are based on Debian, so the rules for install and updates this distribution apply to them.

    Gentoo Linux

    In the Gentoo Linux distribution, the installation and update method is known as Portage. The work is done via the emerge command.

    To get the latest set of Gentoo packages, type:

    Code:
    emerge rsync
    Then

    Code:
    emerge -up system
    After, you can install new package. It is always best to do it with the -p option. This will check for dependencies.

    Code:
    emerge -p PACKAGE-NAME
    You may update installed packages using the -u option.

    Code:
    emerge -u PACKAGE-NAME
    For more information on administration of Gentoo Linux systems, you can visit the documentation section of their webpage: http://http://www.gentoo.org/main/en/docs.xml

    Tarballs: The Universal SolutionAs we mentioned, most distributions have their own ways to install and update packages. There are some developers, however, that only provide tarballs for their applications. This is not anything to be worried about and just adds a few extra steps to the installation procedure you're accustomed to with other distributions.

    First, you would download and unzip the tarball in some directory. I prefer to create a subdirectory in /usr . You might want to call this directory /newapps, for example. To be on the safe side, I usually create a subdirectory for the app. If the tarball's correctly made, it should create its own subdirectory, but I've had my share of incorrectly made ones that have littered up my nice /newapps directory. Let's say you've got a tarball called nice_network_monitor_app.tar.gz. You could create a subdirectory called /nnma, for example, and unzip and untar the tarball there.

    Code:
    tar -zxvpf nice_network_monitor_app.tar.gz
    This will unzip and untar the file. Then you should go in and read the INSTALL and/or README files provided with the tarball. Installation is normally a question of doing the following:

    Code:
    ./configure
    This will usually find out if you've got the right libraries and programs on your machine that the application needs to be compiled and to run. A lot of stuff will appear that indicates that it's looking for the things it needs. Don't be alarmed if you see a few messages indicating that it can't find some of what it's looking for. If you don't see any error messages in the end that tell you that the program can't be installed, then there's no problem. At this point, if you haven't seen any fatal error messages, you can type:

    Code:
    ./make
    This command actually compiles the program and creates the binary or executable file. Don't be alarmed if your CPU usage goes off the scale. That's the compiler at work. After this, you would then normally type:

    Code:
    ./make install
    This installs the program into the path where the author felt it should run from. This is usually /usr/bin or /usr/X11/bin or it might be even put into /bin.

    Steps one through three can be done as a normal user (we mentioned this in an earlier section on root privilege sharing). ./make install must be done by root or by someone with root privileges.

    Notes:

    grep is one of the important commands we talked about in our Getting Started With Linux Course. With grep, you can find words in files or in the output of programs
    Primit1v3 likes this.

Share This Page