Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications


Welcome to the world of Linux! Package installation in Linux is pretty easy, easier than other Operating Systems. All distros have Package Managers to take care of software installation, removal or upgrade. There are a few other ways too but one should give first preference to default package manager only. If your machine has internet access then package installation is a few clicks away.

How Package Managers work:

Package manager download packages from Sources (Repositories) and install those in your machine. Sources are pre-configured in most distros and it is easy to add more sources, if necessary.

Internet access is necessary for all Package Managers. In case your machine doesnt have internet access, you can download packages manually and install those through tools available in your distro.

  • .rpm packages for RedHat, Fedora, OpenSUSE, CentOS and other RPM based distros.

  • .deb packages for Debian, Ubuntu and their derivatives.

  • Tar packages to compile package from source.

Most package managers have Graphical Interfaces too. Graphical Interface makes things a lot easier. Command line tools are fast and if you know correct commands and options, nothing can beat command line tools. But, as I mentioned earlier, Graphical Interfaces are very helpful for New Users. Just a few clicks and package is there in Menu.


Fedora, RedHat and CentOS

Command line: yum
Graphical Interface: Yum Extender.

Graphical Interface of yum is not pre-installed in Fedora. Open Terminal/Konsole and execute this:

su -

yum -y install yumex

Above code will install Yum Extender. Look for it in Menu. Open it and install/update/remove packages easily.

All proprietary packages, Media Codecs are not available in default sources of Fedora and one should install Livna or Freshrpms repository. I would suggest you to install only one of those repositories. Installing both repositories could lead to package version conflicts.

If you want to use command line tool, check these basic yum commands:

Install Package:

yum y install package_name

Remove Package:

yum remove package_name

Check if Updates are available:

yum check-update

Update package:

yum update package_name

Search package:

yum search package_name

Clean cache:

yum clean all

For more information, go through manual of yum

man yum

Install Manually Downloaded RPM packages ( .rpm )

One must have root privileges to install/remove/update any package. Its not recommended to login as root user in GUI. Login as Regular User and execute su command to gain root privileges.

su -

Install package:

rpm -i package_name

Remove package:

rpm -e package_name

Update package:

rpm -uvh package_name

Search package:

rpm -q package_name

Display Package Information:

rpm -qi package_name

As I mentioned earlier, one should install packages through default package manager only. You will run into dependency problems because of manual installation.

Debian, Ubuntu, Kubuntu, Xubuntu and other Debian based distros:

Command Line : apt-get
Graphical Interface : Synaptic Package Manager, Adept Package Manager.

Synaptic package manager is pre-installed in all Debian based distros having Gnome as default Desktop Environment. Adept package manager is available in K Desktop Environment (KDE).

* I prefer Synaptic over Adept because of its user-friendly interface. One can install Synaptic in KDE easily. I will keep you updated regarding Adept. I will keep on testing Adept in future releases and let you know if I find any good in it.

Look for Synaptic Package Manager in Menu and open it. Click on Reload button. It will fetch latest package list from sources. Search for package you want to install. You can use Search button for that. Select package, mark it for installation and hit Apply button. Thats it. Synaptic will download and install package for you.

How to use apt-get:

One must have root privileges to execute apt-get command.
In Debian, execute this

su -

Above command will give you root privileges. Execute exit command after executing apt-get commands.

Unlike Debian, Ubuntu and most of other Debian based distros dont allow root login in shell by default. You can gain root privileges through sudo. You have to prefix apt-get command with sudo.

Fetch latest list:

apt-get update

You should execute above command once in a while. Above command fetches latest list of packages from sources.

Install package:

apt-get install package_name

Remove package:

apt-get remove package_name

Remove package along with configuration files:

apt-get remove -purge package_name

Update package:

apt-get update package_name

Update all packages in one go:

apt-get dist-upgrade

Clean cache:

apt-get clean all

Execute above command after major upgrade or installing several packages. Whenever you use Package Manager (Synaptic, Adept or apt-get) to install/upgrade packages, it saves those packages in /var/cache/apt/archives folder. All these cached packages occupy disk space unnecessarily. Execute above command to remove those cached packages and free up space.

How to install manually downloaded .deb packages:

One must have root privileges to install/remove/update any package. Its not recommended to login as root user. Login as Regular User and execute su (in Debian) or prefix sudo (Ubuntu and other Debian based distros) to gain root privileges.

Install Package:

dpkg -i package_name

Remove Package:

dpkg -remove package_name

Remove Package completely including configuration files:

dpkg -purge package_name

Display description of package:

dpkg --print-avail package_name

Display a list of available Package using Wildcard patterns:

dpkg -l package*

How to Compile and install software from source:

Sources (Repositories) of all distros have tons of packages and most of time; there is no need to compile packages. There are a few exceptions though:

  • Pre-compiled packages dont work properly on your machine and a few necessary features are missing.

  • You need a bleeding edge version of some packages and test those.

  • Packages dont work fast in your machine and you want to configure those according to available hardware.

Source comes in a zipped format commonly called as tarball and it could have .tar.gz, .tar.bz2 or .zip extension. First of all, we have to extract source code.

There are a few Archive Tools available in sources and pre-installed in a few distros. Right click on tarball and if it gives Extract here option, you are good to go.
In case there is no Extract here option, open Terminal/Konsole, navigate to the folder where you have saved tarball and execute this:

For .tar.gz extension, execute this

tar -zxvf filename

For .tar.bz2 extension execute this

tar -jxvf filename

A few files have .zip extension too. Execute this for .zip extension:

unzip filename

On clicking Extract Here or executing tar command, a new folder will be created at same location. Look for README or INSTALL file in that folder and follow instructions from there.


Compilation process is almost same for all packages. Here are general instructions:
Three steps: Configure, compile and install.

Navigate to extracted folder:

cd folder_name

Configure package:

./configure

Above command will display a lot of info. Check last 10-12 lines of the output. There should not be any error message and command should exit successfully.
If ./configure throws any error, next step will not be successful. Search in the forum for solution or start a new thread. Do not forget to post exact error message in your thread.

Lets compile package now:

make

Above command will compile package. If make command doesn't throw any error, package is ready for installation. In case, it throws error(s), you have to resolve those first.
You must have root privileges to install package. Depending on your distro, you can gain root privileges through su, sudo or direct login as root user (it should be avoided because of various reasons).

Finally, execute this to install package:

make install

Its done!

* As I have mentioned several times, avoid package compilation or manual installation. Package Managers do their job pretty well. If you want to compile for any reason, go through instructions given in ReadMe or Install file. If you have any problem, search atLinuxForums.org or start a new thread at Linuxforums.org/forum. We will be happy to help you.

Rate This Article: poorexcellent
 
Comments about this article

Comment title: * please do not put your response text here