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:
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:
yum y install package_name
yum remove package_name
Check if Updates are available:
yum update package_name
yum search package_name
yum clean all
For more information, go through manual of 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.
rpm -i package_name
rpm -e package_name
rpm -uvh package_name
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
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:
You should execute above command once in a while. Above command fetches latest list of packages from sources.
apt-get install package_name
apt-get remove package_name
Remove package along with configuration files:
apt-get remove -purge package_name
apt-get update package_name
Update all packages in one go:
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.
dpkg -i package_name
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:
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:
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:
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:
* 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.