VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: How to install software from source code  (Read 12360 times)

InTheWoods

  • Vectorite
  • ***
  • Posts: 302
How to install software from source code
« on: September 27, 2006, 08:41:43 pm »

How to install software from source code:

Get your package ready
  • 1.   Download the desired package.
    2.   Open the package.
    a.   Open a terminal and CD to the location of the package.
    b.   Use “tar -zxvf <package .tgz>” If package name ends in .tgz.
    c.   Use “tar -xjvf <package.tar.bz2>” for a .bz2 package.
    3.   Read the README and any other instructions.
    4.   Download and install any dependencies (and dependants of the dependencies).
    5.   Run “ldconfig” to update any libraries you have just installed.

NOTE: tar.gz and .tgz are the same thing.


Installing the package
(or dependencies).
Open a terminal and CD to the package directory.
For most packages run the following commands:

   ./configure (options)        #configure the package
   make             #compile files
   make install         #copy files to the system
OR

./configure && make && make install
(is this the same thing?)

./configure <options>
This creates a makefile for your package detailing how the package is to be installed on your system.
Options may be specified in package documentation (or elsewhere).
READ THE DOCUMENTATION.
In Vector 6.0 --prefix=/usr should usually be one of the options. This specifies the package is to be installed in the /usr directory.
If you are updating a package already installed on the system install it to the same directory as the older version.
./configure --help  may list the available options.

EXAMPLE:   ./configure --prefix=/usr --enable-gui

make”      compiles the required files into binary files

make install”      copies the binaries into your system.

You can then clean up from the compiling process with “make clean” (in the package directory). But you will no longer be able to uninstall the package with “make uninstall”!!!
Ditto if you delete your package directory!


A  better way to install from source:

   ./configure (options)       # configure the package   
   make              # compile files
   checkinstall –L      #create a .tlz package.

OR

./configure –prefix=/usr && make && checkinstall –L ( would this work)

checkinstall”   creates and installs a package for your system leaving it in the
package directory.
The checkinstall version provided is optimized for vector .
Do not use another version.
Use the –L switch for a .tlz package and -G for a .tgz package.
The package can be uninstalled like any other with removepkg
without damaging your system.
It can be reinstalled at any time with installpkg.




Installing your package with SCONS
Not all packages use the ./configure && make && make install method of installation. Some use the scons system to build and install packages.

Get your package source and get it ready
(see above)
READ THE DOCUMENTATION.
In a terminal CD to the package directory:
   scons configure   # Configure the package. You may need options.
   scons        # Build the scons package.
   scons install    #  Install the scons package

OR
checkinstall scons install



Other install methods:

Pkgtool            tukaani-pkgtools is a GUI wrapper for the make tools described above.
                     Just follow the onscreen prompts.
install scripts    scons itself uses a python script for its self installation.
                     This is run from a terminal in the package directory.
                     READ THE DOCUMENTATION.
Midnight
Commander     a file manager that runs in a terminal. (this could use it’s own how to)
« Last Edit: September 27, 2006, 08:48:47 pm by Joe1962 »
Logged

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: How to install software from source code
« Reply #1 on: September 27, 2006, 09:02:11 pm »

Good work, mate
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

DrCR

  • Vectorite
  • ***
  • Posts: 166
Re: How to install software from source code
« Reply #2 on: October 26, 2006, 05:10:36 am »

Dido that, thanks as well. It took me over two years of using Linux on and off before figuring out make/makeinstall. Your HowTo has helped to bring me up more than a couple of pegs.  :)

DrCR
Logged

easuter

  • Global Moderator
  • Vectorian
  • *****
  • Posts: 2160
Re: How to install software from source code
« Reply #3 on: October 26, 2006, 07:18:46 am »

very complete howto, kudos InTheWoods!
Logged

barret

  • Member
  • *
  • Posts: 75
Re: How to install software from source code
« Reply #4 on: October 26, 2006, 11:50:26 pm »

this is great! that's exactly what i was looking for :)

especially uninstalling & update bits :) (hm... i think it's worth printing)

big thanks man!
Logged
desktop: no more (gave to sister :D)
laptop: DELL D600 / 1.5 ghz / 1 GB / 8 GB CF / Radeon 9000 / VL6 / Win XP
Registered Linux User #417845
“Strange women lying in ponds distributing swords is no basis for a system of government!”

barret

  • Member
  • *
  • Posts: 75
Re: How to install software from source code
« Reply #5 on: October 29, 2006, 04:32:46 am »

but when i do checkinstall -L it says that there is no such option: -L. what's wrong?
i also checked in help, and indeed, there is no such thing like -L switch. or -G.
Logged
desktop: no more (gave to sister :D)
laptop: DELL D600 / 1.5 ghz / 1 GB / 8 GB CF / Radeon 9000 / VL6 / Win XP
Registered Linux User #417845
“Strange women lying in ponds distributing swords is no basis for a system of government!”

easuter

  • Global Moderator
  • Vectorian
  • *****
  • Posts: 2160
Re: How to install software from source code
« Reply #6 on: October 29, 2006, 04:36:40 am »

but when i do checkinstall -L it says that there is no such option: -L. what's wrong?
i also checked in help, and indeed, there is no such thing like -L switch. or -G.

-L or -G are options uased only for VL 5.8 (and its corresponding dynamite versions).

just use simple checkinstall on its own for 5.1
Logged

saulgoode

  • Vectorite
  • ***
  • Posts: 340
Re: How to install software from source code
« Reply #7 on: October 29, 2006, 12:47:03 pm »

I would recommend doing 'configure' and 'make' as an unprivileged user and then switch to root only for the final installation ('tis a little safer).
Logged
A complex system that works is invariably found to have evolved from a simple system that works.

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: How to install software from source code
« Reply #8 on: October 29, 2006, 10:44:06 pm »

Furthermore, you can delete all the cruft left behind AS a normal user (.o files, etc.)
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

MikeCindi

  • Tester
  • Vectorian
  • ****
  • Posts: 1074
Re: How to install software from source code
« Reply #9 on: November 02, 2006, 11:16:59 pm »

Furthermore, you can delete all the cruft left behind AS a normal user (.o files, etc.)

Is that that same as makeclean and then deleting the source directory? Or is it a better, safer option (esp. when done as USER vs. ROOT)?
Logged
The plans of the diligent lead to profit...Pro. 21:5
 VL64 7.1                                     RLU 486143

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: How to install software from source code
« Reply #10 on: November 16, 2006, 03:57:25 am »

Furthermore, you can delete all the cruft left behind AS a normal user (.o files, etc.)

Is that that same as makeclean and then deleting the source directory? Or is it a better, safer option (esp. when done as USER vs. ROOT)?

make clean rules typically remove object files, dynamically generated headers, executables, etc. I've never seen one fail, especially in the days of GNU autoconf, distutils, and others, but it could happen.

make clean does not delete the source directory (that I know of). If you build as root, revert to normal user, and then try to expunge said directory by hand, however, you will notice all those files created during the build will block your way.

The point is, you can build software just as well as normal user as you can root, and one should do things as normal user by default.

Sorry if I came off as incoherent---I haven't slept for a while...
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

MikeCindi

  • Tester
  • Vectorian
  • ****
  • Posts: 1074
Re: How to install software from source code
« Reply #11 on: November 16, 2006, 05:47:40 am »

Thanks. I don't think you were unclear I'm just trying to learn the "why" along with the "how-to".
Logged
The plans of the diligent lead to profit...Pro. 21:5
 VL64 7.1                                     RLU 486143

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: How to install software from source code
« Reply #12 on: November 22, 2006, 02:07:07 pm »

Oh ya. Gotta love that!!
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

henryxcrudos

  • Packager
  • Vectorite
  • ****
  • Posts: 107
    • Tropic of Vector
Re: How to install software from source code
« Reply #13 on: August 27, 2009, 07:21:19 am »

J.U.S.T. what I was looking for. I thought it'd work like that, but it's good to see it black on white (at least until I change my vieweing options ;D).

THUMBS UP!
Logged
VL Light 6.0 (Final built, 31/03/09, kernel 2.6.27.12).
Dell Latitude C610 [PIII, 1GHz, 128MB SDRAM, 10GB EIDE/ATA HD, cheapo wifi stick (Belkin)]
Registered Linux User no. 495460
Oh no! -> Tropic of Vector