I know there is a sort of standard series of commands to compile and install packages that come only as source. What is it?
Usually it is something like that.
This (when executed in the directory your source code is), creates a Makefile with the rules that will be used to build the program. This is where you can change the behavior of the compilation (that is, compile the program with options that are not default).
This builds the program with the rules specified in the Makefile.
This is usually executed as root (or using
As Mihai Limbasan noted, you can usually pass the --prefix option to ./configure to determine where the program will be installed. If you have the necessary permissions in the target directory you won't even need to run make install using sudo (or as root).
For example, if you do
you should be able to install this program without root privileges. I should point out that this will restrict the program's usage to those with execute privileges on the directory you specified. So if you need a system wide install, you should probably use the default solution (running make install with root privileges).
Mihai also reminded that you can remove the installed program by running
(again, as root or using sudo if you used the default options in configure), but that requires that you keep the build directory in place after you install the program. That is, it's not best practice to remove the source directory of a program you've compiled, so that you can remove it later.
What I get the source for an application the first thing I do is to read the pretty standard README/INSTALL file. They usually tell me exactly what I need to do. They tell me what dependencies I will to install before I compile to get all the functionality I want. They tell me what I need to do to secure the install.
Take 3-5 minutes and read those docs they can save you a lot of time.
These steps assume package compiles properly, all dependencies are met, and "check" target exists and passes.
for your ./configure you may want to use ./configure --help first as this will show the configuration options that can be passed to configure. This will be particularly useful if you are getting problems with your compilation or do not want some support provided by the package.
make check is sometimes replaced with make test as well. I would recommend trying these on any software you are compiling prior to installation.