A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
The installation of software in Linux is not an easy task; if it is installed by source code, it is more complicated; now the tutorial of installing various software is very common, but the change of the basic knowledge of the solid grasp, the installation of various software problems will be solved. Configure script Configuration tool is one of the basics, it is the basic application of autoconf tools.
The ' Configure ' script has a number of command-line options. These options may change for different packages, but many of the basic options will not change. Take '--help ' option to execute ' configure ' The script can see all the options available. Although many of the options are rarely used, it is beneficial to know that they exist when you configure a package for special needs. Here is a brief introduction to each of these options:
--cache-file=file, ' Configure ' will test the existing features (or bug!) on your system. To speed up the subsequent configuration, the results of the test are stored in a cache file. When configure a complex source tree with a ' configure ' script in each subtree, the existence of a good cache file can be a great help.
--help output help information. Even experienced users occasionally need to use the '--help ' option because a complex project contains additional options. For example, the ' configure ' in the GCC package The script contains options that allow you to control whether to build and use the GNU assembler in GCC.
--no-create, one of the main functions in ' Configure ' will produce the output file. This option prevents ' configure ' from generating this file. You can think of this as a drill (dry run), although the cache is still being rewritten.
--quiet,--silent, when ' configure ' carries out his test, will output a brief message telling the user what is being done. This is because ' configure ' may be slower, Without this output, users will be thrown aside wondering what is happening. Using either of these options will throw you aside. These two words are more interesting, the original is this: If there was no such output, the user would are left wondering what is happening. By using the option, you too can is left wondering!)
--version, prints the version number of the autoconf used to generate the ' configure ' script.
--prefix=pewfix, '--prefix ' is the most commonly used option. The system-made ' Makefile ' will look at the parameters passed with this option, and when a package is installed, it can be completely relocated to a separate part of his structure. For example, when installing a package, For example, Emacs, the following command will cause Emacs Lisp file to be installed to "/opt/gnu/share":
--exec-prefix=eprefix, similar to the '--prefix ' option, but is used to set the installation location of the file to which the structure relies. The compiled ' emacs ' binary is one such question. If this option is not set, The default option values will be set to the same value as the '--prefix ' option.
--bindir=dir, specifies the location where the binaries are installed. The binaries here are defined as programs that can be executed directly by the user.
--sbindir=dir, specify the installation location for the super binaries. This is a program that is typically executed only by Superuser.
--libexecdir=dir, specify the installation location for executable support files. In contrast to binary files, these files are never executed directly by the user, but can be executed by the binaries mentioned above .
--datadir=dir, specify the installation location for the common data file.
--sysconfdir=dir, specifies the installation location for read-only data that is used on a single machine.
--sharedstatedir=dir, specifies the installation location of writable data that can be shared across multiple machines.
--localstatedir=dir, specifies the installation location of writable data that can only be used on a single machine.
--libdir=dir, specify the location where the library files are installed.
--includedir=dir, specify the installation location of the C header file. This option is also available for other languages such as header files for C + +.
--oldincludedir=dir, specifies the installation location for the C header files installed in addition to the GCC external compiler.
--infodir=dir, specify the installation location for the info format document. Info is the document format used by the GNU Project .
--mandir=dir, specify the installation location for the manual page.
--srcdir=dir, this option has no effect on the installation. He will tell the location of the ' configure ' source. In general, this option is not specified because the ' configure ' script is generally in the same directory as the source file.
--program-prefix=prefix, specifies the prefix that will be added to the name of the installed program. For example, using '--program-prefix=g ' to configure a program called ' tar ' will cause the installed program to be named ' Gtar '. When used with other installation options, this option will only work if it is used by the ' makefile.in ' file.
--program-suffix=suffix, specifies the suffix that will be added to the name of the installed program.
--program-transform-name=program, the program here is an SED script. When an app is installed, his name will go through ' sed-e programs ' to produce the installed name.
--build=build, specifies the system platform on which the package is installed. If not specified, the default value will be the value of the '--host ' option.
--host=host, specifies the system platform on which the software runs. If not specified, ' config.guess ' will be run to detect.
--target=garget, specifies the system platform that the software targets (target to). This is primarily useful in programming language tools such as compilers and assembler contexts. If not specified, the default value of the '--host ' option is used .
--disable-feature, some packages can choose this option to provide compile-time configuration for large options, such as using a Kerberos authentication system or an experimental compiler optimal configuration. If you provide these features by default, you can use the '-- Disable-feature ' To disable it, where ' FEATURE ' is the name of the feature.
For example: $./configure--disable-gui
-enable-feature[=arg], on the other hand, some packages may provide some default prohibited features that can be used with '--enable-feature '. Here ' FEATURE ' is the name of the attribute. An attribute may accept an optional parameter. For example: $./configure--enable-buffers=128
The '--enable-feature=no ' is synonymous with the above mentioned '--disable-feature '.
--with-package[=arg], in the free software community, there is an excellent tradition of using existing packages and libraries. When you configure a source tree with ' Configure ', you can provide information about other packages that are already installed. For example, BLT Device toolkit that relies on Tcl and TK. To configure BLT, you may need to give ' configure ' information about where we put Tcl and TK: $./configure--with-tcl=/usr/local--with-tk=/ Usr/local
'--with-package=no ' is synonymous with the '--without-package ' that will be mentioned below.
--without-package, sometimes you may not want your package to interact with packages that are already in the system. For example, you might not want your new compiler to use the GNU ld. You can do this by using this option:
--x-includes=dir, this option is a special case of the '--with-package ' option. When Autoconf was first developed, it was popular to use ' configure ' as a workaround for Imake to make software running on X. ' The--x-includes ' option provides a way to indicate to the ' configure ' script the directory containing the X11 header file.
--x-libraries=dir, similarly, the '--x-libraries ' option provides a way to indicate to the ' configure ' script the directory containing the X11 library.
It is not necessary to run ' configure ' in the source tree. A good ' Makefile ' produced by ' Configure ' can build a software package that belongs to another tree. The benefit of building a derived file in a tree that is independent of the source is obvious: the derived file , such as the target file, will be messy scattered in the source tree. This also makes it difficult to build the same target file on a different system or with different configuration options. Three trees are recommended: a source tree, a build tree, an installation tree (install Tree). Here is a very close example of using this method to build the GNU malloc package:
$ Gtar ZXF mmalloc-1.0.tar.gz
$ mkdir Build && CD Build
$ .. /mmalloc-1.0/configure
Checking for gcc ... gcc
Checking whether the C compiler (GCC) works ... yes
Checking whether the C compiler (GCC) is a cross-compiler ... no
Checking whether we are using the GNU C ... yes
Checking whether GCC accepts-g ... yes
Checking for a BSD compatible install .../usr/bin/install–c
Checking host system Type ... I586-pc-linux-gnu
Checking build system Type ... I586-pc-linux-gnu
Checking for ar ... Ar
Checking for ranlib ... ranlib
Checking how to run the C preprocessor ... gcc–e
Checking for unistd.h ... yes
Checking for getpagesize ... yes
Checking for working mmap ... yes
Checking for limits.h ... yes
Checking for stddef.h ... yes
Updating cache. /config.cache
So this tree is configured, below you can continue to build and install this package to the default location '/usr/local ':
$ make all && make install
How to completely uninstall a package after it is installed by compiling the source code?
If the original source is still there, a lot of source makefile have written uninstall rules, directly in souce make uninstall is feasible, but met the unscrupulous author did not write, That one sentence to see makefile in the install part of what he did, and then delete each.
If the source is gone ... Then let's be depressed.
So far, I have been able to make uninstall ....
(because you always accidentally install the wrong place, the result is make Uninstall&&make clean, and then re-configure ...)
Basic installation and uninstallation of software under Linux
Installing and uninstalling Linux software has always been a challenge for many new users. In Windows, we can use the software's own installation uninstall program or Add/Remove Programs in Control Panel. Similarly, there is a powerful software Installation uninstall tool named RPM under Linux. It can be used to establish, install, query, update, uninstall software. The tool is used under the command line. You can get help for this command by entering RPM after the shell prompt.
Installation of software
There are two main types of software installation in Linux. The first installation file is named Xxx.tar.gz, and the other installation file is named xxx.i386.rpm. Most of the software issued in the first way is sent in the form of source code, and the second method is sent directly in binary form.
For the first type, the installation method is as follows:
1. First, copy the installation files to your directory. For example, if you are logged on as root, copy the software to/root.
2. Because the file is compressed and packaged, it should be uncompressed. The command is:
3. After the command is executed, the installation files are extracted by path and are decompressed in the current directory. You can see the extracted files with the LS command. Typically, files that are generated after decompression have "Install" files. This file is a plain text file, detailing how the package is installed.
4. An executable script named configure that was generated after the decompression was performed. It is used to check whether the system has a library that is required for compilation, and whether the version of the library meets the required system information for installation such as compilation. Prepare for the subsequent compilation work. The command is: #./configure
If you want to install the software to the specified directory, you should use #./configure--prefix=/your own designated directory, for example, I want to install a mlterm into the/opt/mlterm directory, should be entered as follows
5. After the check passes, a makefile file is generated for compilation. At this point, you can start compiling. The process of compiling depends on the size of the software and the performance of the computer, and the time spent is different. The command is: #make.
6. After successful compilation, type the following command to start the installation:
7. After installation, the files generated during the compilation process should be cleared for temporary files and configuration. Type the following command:
This concludes the installation of the software.
For the second, the installation method is much simpler.
As in the first way, copy the installation files to your directory. Then use RPM to install the file. The command is as follows:
RPM will automatically unpack the installation files and install the software into the default directory. and register the installation information of the software in the RPM database. The function of the parameter i is to get the RPM into the installation mode.
Uninstalling the software
1. The uninstallation of the software is mainly done using RPM. To uninstall the software, first know the name of the package registered in the system. Type the command:
You can query to all packages installed on the current system.
2. Determine the name of the software to be uninstalled , you can begin to actually uninstall the software. Type the command:
#rpm-E [package name]
You can uninstall the software. The function of the parameter e is to allow the RPM to enter the unload mode. Uninstall The package named packages name. Because of the dependencies between the various packages in the system. If there is a dependency that cannot be uninstalled , RPM will give you a hint and stop uninstalling . You can use the following command to ignore dependencies and start unloading directly:
#rpm-E [Package Name]–nodeps
Ignoring dependencies may cause other software in the system to become unusable
If you want to know where the RPM package is installed?
should use #rpm-QL [package name]
3. How to uninstall software installed with the source code package?
It is best to look at the Readme and install, the general situation has said, but most of the software does not provide the source package unloading method; We can find the installation point of the software to remove. It depends on where you have installed it. Like what:
If you are installing the software, specify a directory. This problem is not difficult;
For example, using the source package to install Gaim
If you install Mlterm
The source package installs the software, all specifies installs in the/OPT directory, so does not know??
If deleted, delete the corresponding software catalog;
Some software to perform make uninstall in the decompression installation directory, so that it is uninstalled
Configure parameter configuration and software installation and uninstallation under Linux
Start building with 50+ products and up to 12 months usage for Elastic Compute Service