Tuesday 30 June 2015

How to install a package in linux

Command-line process:
  • Compiling and Installing software from source/manual
  • Installing RPM's using the Redhat Package Manager
  • Installing using Debian's apt-get
  • Installing with fedora / yum

Compiling and Installing software from source/manual
  • Generally when you download a package for installation that ends with tgz, gz, bz2, or *zip this will be a source installation.
  • If your file ends with a "bz2" you will first have to ucompress the file will the command bunzip2 APPLICATION.tar.bz2. This will result in a new file like APPLICATION.tar. Tar is an archive system that rolls up directories into a file. To unpack the directory you would issue a command similar to tar xvf APPLICATION.tar. Unpacking the directory would then result in a directory (in our example)APPLICATION. 
  • If the downloaded file ended in tgz or gz then you have a compressed archive and you simply have to add the "z" switch to the tar command to both uncompress and unpack the archive. This command would look like tar xvfz APPLICATION.tgz, which would result in the directoryAPPLICATION.
  • Once you have your directory unpacked you need to change into that directory (with the command cd APPLICATION). Once inside this directory issue the ls command. You will most likely see either a README file or an INSTALL file. Open those up and see if there are any special instructions for installation. If there are no special instructions then the standard compilation steps will most likely work. Here's how this works:
    • su to the root user
    • From within the APPLICATION directory issue the command ./configure. This will generate a make file for the compilation.
    • Issue the command make.
    • Issue the command make install
  • That's it. If all went as planned, the application should be installed

Installing RPM's using the Redhat Package Manager
  • Installing via RPM is actually quite simple. Here's how this works. 
  • Once you have downloaded the rpm file you want to install, open up a terminal window and issue the following commands:
    • su (you will be prompted to enter the root password)
    • rpm -ivh filename.rpm (where filename is the actual name of the file you downloaded)
  • That's it. If all went well your package should now be installed.
  • If you want to make sure your package was installed you can issue the command rpm -q filename and you should see the name of the package and the version that is installed.
  • If you want to remove that package you just installed (or another package) issue the command:
    • rpm -e filename
  • and the package will disappear.
Installing software with Apt-get
  • This is one of the best installation systems available. With apt-get you do not have to download a package, you just have to know the name. Here's how apt-get works (I am going to assume Ubuntu is the distribution, so you'll make use of sudo). Open up a terminal window and issue the following:
    • sudo apt-get install package_name
    • to install the needed package.
  • To remove a package with apt-get you would issue the command:
    • sudo apt-get remove package_name
    • to remove the package from your system.

Installing with fedora / yum
  • yum install
  • yum remove
  • yum update

No comments:

Post a Comment