Tuesday, March 28, 2017

Installing Applications Under Linux

Installing Applications Under Linux


INSTALLING APPLICATIONS UNDER LINUX(Fedora,RedHat,Debian )

Installing applications under Linux has been a major stumbling block for Linux newbies , even though the situation has improved with automatic installers (Like yum,aptitude,autopackage etc) but still applications installation under Linux is a tricky affair . So i decided to share whatever i know about installing applications under Linux with the Linux Newbies via my blog.


Installing rpm packages on Redhat,Fedora Based Systems : - For Fedora based systems rpm is the standard format for packages , it stands for RedHat Package Manager .The files have ".rpm" extension . The rpm formats major advantage is it is easier to maintain applications installed using rpm than compiling from different sources.Also various dependencies for applications are previously determined before installing the applications hence it ensures error free running of application after installing the application.

To install a rpm package use command:
rpm -i PackageName

TO uninstall rpm package use :
rpm -e PackageName
PackageName is different from filename You used to install the package . This is actually the name of software that is installed.

If you have some file on your system and you dont recognize to which package it belongs use the command : -
rpm -qf filename with path
this would return the name of package the file belongs to.

If you have a rpm package but you are unsure about the package that is its name ,description etc use this command to get information about the package: -
rpm -qpi package name

If you want to know what files and where the rpm installs for a specific package use the following command : -
rpm -qpl packagename

If you want to upgrade an existing package on your system use :-
rpm -Uvh packagename
this command uninstalls the old version of the package and installs the new version of the package.This commands works even when there are no existing version of application installed hence this can be effectively used for Installing new packages.

However freshen(-Fvh) option dosent install new package if it dosent exist and only upgrades existing package on the system.This can be particularly useful if you have a number of packages and only want to upgrade the packages and dont want to install new packages.

You can use the command
rpm -Fvh *
For the above purpose


rpm -qa | less
Views list of installed applications , one screen at a time.

rpm -qa
List all applications installed on the system

rpm -qa | grep -i
To search if a particular package with is installed on the system.



Installing packages under Debian GNU/LINUX based distributions : - Debian Linux based distributions like Ubuntu,Kubuntu ,Debian etc come with an excellent package management system (apt-get) which allow for installation of software with relative ease. Debian has been traditionally easier of Linux distributions in view of software installation.Debian Linux uses the deb package format for packaging software similar to the rpm package on Redhat and fedora based systems.

However before one starts using apt-get software repositories have to be set-up correctly on the local machine. Repositories are a collection of softwares stored on the Internet which could be used for installation of software using apt-get. The location of repositories is stored in the machine in the file /etc/apt/sources.list and could be modified for removing or adding additional repositories locations. A comprehensive list of available repositories could be found at www.apt-get.org .

After completing setting up of repositories one has to make local database on the machine storing information about softwares in sync with the repositories making the information about package available on the net locally available and could be done with command .

apt-get update


Now once the package information is cached locally one can Install applications or search for available package using command. However one has to be connected to Internet for installing software though software could be searched without the Internet.

apt-get install packagename

One important feature of apt-get is that user is shielded from the trouble of dependency . If a application needs additional libraries,package etc to be installed they are automatically searched from the repositories and installed before installing the application . This is one of the most important feature of installing application through apt-get.

To search for a particular package in the database stored locally.

apt-cache search packagename


To upgrade all the softwares on the system

apt-get upgrade

To remove a particular package

apt-get remove packagename


apt-get autoclean

Above option cleans packages in cache that are found useless or partially complete and deletes them.

Installing Debian(.deb) Packages :-
Debian Linux distribution unlike other is not maintained by any particular organization but maintained by volunteers . The Package used by Debian and all distributions based on it is deb . dpkg is the tool that is used for installing applications on Debian based systems.

dpkg --install
To install a package or upgrade on the system.The name is the complete name of package file ending with .deb extension . If all the packages and libraries needed by the package your are installing is found on the system the installation proceeds and package is installed. However if some library is missing or files needed by package is not found on the system appropriate error would be shown and dpkg would exit showing error.


dpkg --remove
To Remove already installed application from the system. However this command does not remove the configuration file that may be needed for re installation of package however if you want to remove the configuration file also . Following command could be used :-
dpkg --purge

dpkg --status
Above command displays the status of package specified.

dpkg --listfiles
Above command lists the name of all the files installed by package specified as

dpkg -l * | grep ^i | more

Above command displays all the installed application on the system page wise.


dpkg -l gtk* | grep ^i | more

Above command displays all the installed applications on the system beginning with name gtk.

However one can also use dselect to install or remove applications on the system. dselect is a menu driven application

for installing and removing application.


Installing applications using yum : -

Similar to apt-get on debian based system . Redhat and Fedora ships with yum for installation of applications from repositories.

The installation of software gets very easy with the help of yum.

yum stores the repositories address in the file /etc/yum.conf . Initially it has only few repositories and should be expanded to

include more for example i added the following :

[livna-stable]

name=Livna.org Fedora Compatible Packages (stable)

baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/yum/stable

gpgcheck=1

[FedoraUS]

name=Fedora US $releasever - $basearch - Latest Packages

baseurl=http://download.fedora.us/fedora/fedora/2/i386/SRPMS.os/

[newrpms.sunsite.dk]

name=Fedora Core 2 NewRPMS.sunsite.dk

baseurl=http://newrpms.sunsite.dk/apt/redhat/en/i386/fc2

[dag]

name=Dag RPM Repository for Fedora Core 2

baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag

[dries]

name=Extra Fedora rpms dries - $releasever - $basearch

baseurl=http://dries.studentenweb.org/yum/fedora/linux/$releasever/$basearch/dries

After completing above one should run

yum -y check-update

This command downloads header , information about all the new software available and stores it locally.

yum -y list

Above command displays the list of all the packages available for installation.

yum -y list installed

Above command displays the list of all the packages installed on the system.

yum -y install packagename

Above command downloads and installs the package after searching it in the repositories. This also downloads all the dependencies

and installs it ,before installing the package.

yum update

Above command updates all the upgradable packages on the system.

yum remove

Above command removes the package specified as

yum list recent

Above command displays the list of all the applications recently installed or updated.

yum provides filename

above command displays the package the filename belongs to.

Installing from sources : Most of the Open-Source application available under Linux is available as Source Code which needs to be compiled at the users end. This approach though is time consuming since compiling an application takes a descent amount of time depending on the complexity of the application, Also installing from sources is a bit more complex than installing from binaries. But still it does have its benefits , The applications compiled can be significantly faster than the binaries downloaded since they are optimized for your system also there are many situations when binaries are not available for your Processor or Distribution and hence compiling application from the source is the only option.

Step 1: Download the source file from the Internet usually the source files are tar archives. Extract it into a directory using the tar command.
Example if you download the file : examples-0.1.2.tar.gz

Extract with: tar -xzvf examples-0.1.2.tar.gz

-x extract the file
-z unzip it (required for .gz files)
-v verbose, print the names of the files as they are extracted
For archives starting with .tar.bz2 use bunzip2 filename for extracting the file.

after extracting the file go into the directory of the created file and execute the configure script which configures the packages source file according to your system and checks if all the needed libraries are present ,This tells how software must be compiled.If an error is shown during the execution of configre script look for the missing library and install it and then rerun the configure script. After completion of the configure scripts execution "Makefile" is created which is then used to compile the package .

./configure
make

make: - This command starts compiling the application after reading the Makefile on how to install the applications binaries. This process takes the most of the time .

After doing this login to superuser mode and execute the following command to install the applications to a suitable location.

make install

make install : - This command installs the package usually in /usr/local folder.
However if for some reason the compilation does not take place successfully try reading README,INSTALL text files in the projects directory. Usually most of the projects include documentation about installing the applications in these files.


Autopackage : Autopackage is also one of the simpler ways of installing application . More can be read about it here :

www.autopackage.org

Article (C) 2006 Ambuj Varshney

For Linux On Desktop Blog




Get This Article as PDF 


Available link for download