3

I have servers (with Debian or Centos) and I would like to install programs from sources, because I can always have up to date software. If I want to install some program from source I usually do next steps:

  1. Download archive with source
  2. Unzip and cd to directory with source
  3. Run ./configure prefix=/usr/local
  4. make && sudo make install

After that I remove downloaded archive and unzipped folder with source.

My questions are:

  1. If I want to update program to newer version, what steps should I perform?
  2. How can I remove program installed in such way?
  3. Is it correct to remove folder with source after installation or it can be usefull later?
Braiam
  • 35,991
rkm
  • 133
  • 3
    Have a look at stow; stow keeps everything separate, and sym-link it. http://blog.danieroux.com/2005/08/07/using-gnu-stow-to-manage-source-installs/ – ctrl-alt-delor Jun 12 '14 at 22:15
  • Usually you are best to somehow create a package, there are multiple ways to do this. This guide covers the best options for Debian. If someone wants to turn that into an answer here, that would be nice... – Graeme Jun 12 '14 at 22:44
  • Finding a package to use or if possible building ones one package is generally a better way to go. Backports are also useful - see http://unix.stackexchange.com/q/112157/4671. – Faheem Mitha Jun 12 '14 at 23:00
  • The problem is that sometimes I can't find needed package. I'll try to build package from source by myself anyway - it looks very interesting. But first I need to learn how to do it for Centos too. Are there any analogues of Backports for CentOS? – rkm Jun 12 '14 at 23:23
  • What sources are we talking about? Depending on which packages there may be some additional methods included in the Makefile included w/ them. For example, sometimes they'll include a make target called uninstall. Also often times a .spec file will be included in a tar file which you can use rpmbuild to autobuild directly. – slm Jun 13 '14 at 02:13

3 Answers3

3

You don't. Set up your own RPMs, create a repository from them, and let the distribution's tools take over.

vonbrand
  • 18,253
1

The easiest way to install software is to let someone else build it for you. If you want the latest software (usually not a good idea on a server, it's better to keep a stable system), don't use CentOS (which is the most conservative among the major distributions), and don't use Debian stable. Use Fedora, or Debian unstable, or Arch Linux.

If you like pain and insist on compiling your own programs, or if you really need the bleeding edge for a few programs, then use stow to manage the installed directory tree. The principle is that you install each program in its own subdirectory such as /usr/local/stow/PROGRAM_NAME, and stow creates symbolic links to populate a common directory /usr/local. See Keeping track of programs for a quickstart guide.

You may want to keep the source around in case you want to recompile (say after fixing a bug). Otherwise, normally, you don't need the source.

0

You really should use something like checkinstall-tool, which packages manually built software into debs/rpms which can then be installed and removed in the usual way (docs for ubuntu: https://help.ubuntu.com/community/CheckInstall ).

If you want to keep on doing things by hand, some makefiles have target uninstall which can help. If not, then you just have to manually uninstall files; you can use make -n install, which will show what is being done in the installation. Both of these require that you have the original source tree still installed.

isido
  • 151
  • 1
  • 3