Installing packages from source in Gnu/Linux

Author:

Packages come
in two formats in Gnu/Linux

1.) rpm
packages.

2.) Source
packages.

In this
document we will be installing source packages.

Source
packages generally come in 2 compressed formats

xmms-1.2.10.tar.bz2
–compressed with bunzip(bzip)

xmms-1.2.10.tar.gz
–compressed with gunzip(gzip)

and others
also

1.)first of all
we need to extract these packages .

so copy the
packages in your Gnu/Linux partition. for example in /plugins directory.

go to that
directory and extract them as follows

[root@gaurav
root]# cd /plugins/

[root@gaurav
plugins]# tar xjf xmms-1.2.10.tar.bz2

[root@gaurav
plugins]#

OR

[root@gaurav
root]# cd /plugins/

[root@gaurav
plugins]# tar xvzf xmms-1.2.10.tar.gz

[root@gaurav
plugins]#

here we pass
the arguments

xjf –for
uncompressing packages of the type (.tar.bz2)

xvzf –for
uncompressing packages of the type (.tar.gz)

more on these
attributes can be found by

[root@gaurav
root]# man tar

if the
packages are in some another format then u can extract them also by

a.)copy the
package in your Gnu/Linux partition

b.)Right click
on the package

c.)choose
extract here

this method
surely takes some time more that the command line version but if you are having
any problems in extracting
with the command line then u may proceed in this manner

2.)after packages
have been extracted then u need to compile them and then install these.

you can go
through a file Readme or INSTALL

in all the
install readme files you will find the procedure for installing source packages

I am briefing
the procedure down here

a.) go to the
directory containing the extracted packages

[root@gaurav
root]# cd /plugins/xmms-1.2.10

[root@gaurav
xmms-1.2.10]#

b.) ‘./configure’
will check if the files necessary for installation are available or not

[root@gaurav xmms-1.2.10]#
./configure

c.)’ make’ will
compile the package

[root@gaurav
xmms-1.2.10]# make

d.)’make install’
will install the executable in ‘/usr/local/bin’ (generally)

after these
you can run your new packages by their name only or by giving the full path

[root@gaurav
xmms-1.2.10]# xmms

OR

[root@gaurav
xmms-1.2.10]# /usr/local/bin/xmms

Tips
on installing packages

i) Sometimes it
may happen that during ‘./configure’ u may get a message that such file is not
found, say

‘libasound.so’

it may happen
that the file is in your system but it is not in those directories where the
compiler might be

searching so
in that case first lookout whether if your system does have that file

first of all
update your database of files by

[root@gaurav
root]# updatedb

then you will
be able to locate your file by

[root@gaurav
root]# locate libasound.so

/usr/lib/libasound.so.2.0.0

/usr/lib/libasound.so.2

/usr/lib/libasound.so

/usr/local/lib/libasound.so.2

[ root@gaurav
root]#

Now you have 2
options

Either make a
link or copy the entire file

for example
libasound.so is in ‘/usr/local/lib’

and we want it
to be in ‘/lib’

To make a link
for that file

[root@gaurav
root]# ln -s /usr/lib/libasound.so /lib/libasound.so

this will
create a link in /lib for the file libasound.so

so when the
compiler look out for libasound .so in /lib instead it will find a link there
which will redirect it

/usr/local/lib/libasound.so

alternatively
you can copy that file from ‘/usr/local/lib’ to ‘/lib’ but then some program
might be

looking for
the same file in ‘/usr/local/lib’

so it is
advisable to use links since they save a lot of space

ii) Try to
uncompress the packages with the command line options.

uncompressing
with the right-click option may make your system to stop responding

if your system
stops responding in that case

Ctrl+Esc will
bring the process table

choose the
process which may cause such activity

in this case
you have ‘Ark’ utility
responsible for uncompressing the package

so choose the
appropriate process and kill it to remove it from the process table

iii) See that you
have appropriate space for extracting and compiling the packages sometime

they take a
lot of space for example

While I
extract my kernel of 32 Mb it uncompressed to around 130Mb and to compile it I
need an extra space of
around 150 Mb!!!

iv) after the
packages have been installed you can remove the object files from the package
by

[root@gaurav
xmms-1.2.10]# make clean

this will
remove the object(.o)files which were required only during compile time

also you can
remove the package instead from /plugins to save disk space since aftar the
command ‘make install’ the
required libraries and other files have been installed in ‘/usr’

v) installing
with rpm is easier since they are precompiled and they take less time but they
are version and distribution
specific so you will not get .rpm files for your version of Gnu/Linux, instead
source packages are the same so you
will get them everywhere

?

Leave a Reply

Your email address will not be published. Required fields are marked *