In the process of installing and compiling Linux software on your own, three steps are performed: /configure,make,make install. /What exactly do these three steps do in the installation process, which has previously been confusing, and today we will learn together.

. /configure(configure)

configure generates a makefile file based on the current system environment and specified parameters to prepare for the next compilation step. You can control the installation by adding parameters to configure, such as the code: . /configure -prefix=/usr means that the software will be installed under /usr, the executable will be installed in /usr/bin (instead of the default /usr/local/bin), and the resource files will be installed in /usr/share (instead of the default /usr/local/ share). Also some software configuration files can be set by specifying the -sys-config= parameter. Some software can also be compiled with -with, -enable, -without, -disable, etc. You can control the compilation by allowing . /configure -help to see the detailed help. Its common parameters are as follows.

  • -help: output help information
  • -prefix=PREFIX: installs all files into the PREFIX folder. Actually different files will be installed into different subfolders.
  • -exec-prefix=EXEC-PREFIX: Installation location for structural dependency files. Default is the same as PREFIX.
  • -bindir=BINDIR: Directory of executable programs. Defaults to EXEC-PREFIX/bin.
  • -datadir=DATADIR: Directory of read-only files required by the program. Defaults to PREFIX/share.
  • -sysconfdir=SYSCONFDIR: Directory for configuration files. Defaults to PREFIX/etc.
  • -libdir=LIBDIR: Directory for library files and dynamically loaded modules. Default is EXEC-PREFIX/lib.
  • -includedir=INCLUDEDIR: Directory for C and C++ headers. Default is PREFIX/include.
  • -docdir=DOCDIR: directory for documentation files. Default is PREFIX/doc.
  • -mandir=MANDIR: Manual directory. Default is PREFIX/man.
  • –with-includes=DIRS: DIRS is a series of colon-separated folders that are added to the compiler’s headers. For example: –with-includes=/opt/gun/includes/
  • -with-libraries=DIRS: DIRS is a series of colon-separated folders that are used to find library files. For example: –with-libraries=/opt/gnu/lib:/usr/sup/lib
  • -enable-locale: Turn on locale support.
  • -enable-recode: Turn on support for single-byte character set records.
  • -enable-multibyte: Allow multibyte encoding.

make(compile)

make, this step is to compile, when execute make, make will search the current directory Makefile (makefile) this text file, and makefile inside records the source code how to compile details.

make install(install)

make insatll, this command to install, this step usually requires you to have root privileges (because to write files to the system).

Other commands.

  • make clean Clears the compile-generated executable and target files.
  • make distclean In addition to clearing the executable and target files, it also clears the Makefile generated by configure.
  • make dist packages the program and associated archives into a zip file for distribution.

How do I uninstall a compiled and installed (make install) software?

Use the anti-installer that comes with the installation package

The common targets for uninstallation are: make uninstall/distclean/veryclean, etc., but not every source package provides uninstallation, it is not a universal method, etc.

By removing the separate directory set at compile time

If you set -prefix to a separate folder when compiling, just delete that folder, but if you compile and install to something like /usr, find a temporary directory and reinstall it, e.g.

. /configure -prefix=/tmp/to_remove && make install

Then iterate through the files in /tmp/to_remove and delete the files in the corresponding installation location.

Remove via the installation log

The installation log will show you exactly which files were installed in which locations, usually using the ‘cp’ or ‘install’ command to copy the files. You can remember to log all the output of ‘make install’ beforehand, ‘make install &> |tee make.log’.