Configuration of Configure parameters and installation and uninstallation of software in Linux

Source: Internet
Author: User
Tags gtar

Configuration of Configure parameters and installation and uninstallation of software in Linux

Installing software in Linux environment is not an easy task. If the software is installed after source code compilation, of course it is more complicated. Currently, various software installation tutorials are common; however, if you have a solid understanding of the basic knowledge, you can solve the problems of installing various software. The Configure script configuration tool is one of the basics. It is the basic application of the autoconf tool.

The 'configure 'script has a large number of command line options. for different software packages, these options may change, but many basic options will not change. run the '-- help' script to view all available options. although many options are rarely used, it is very helpful to know their existence when you configure a package for special needs. next we will give a brief introduction to each option:

-- Cache-file = FILE, 'configure 'will test the existing features (or bugs!) on your system !). To accelerate subsequent configuration, the test results are stored in a cache file. when configure has a complex source code tree with the 'configure 'script in each subtree, the existence of a good cache file will be very helpful.

-- 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 'script in the GCC contains options that allow you to control whether to generate and use the GNU Compiler in GCC.

-- No-create, a major function in 'configure 'will create an output file. this option prevents 'configure 'from generating this file. you can think of it as a dry run, although the cache is still rewritten.

-- Quiet, -- silent. When 'configure 'is tested, a brief message is output to tell the user what he is doing. this is because 'configure 'may be slow. Without such output, the user will be thrown aside and wondering what is happening. using either of the two options will throw you aside. the two sentences are interesting. the original Article is like this: If there was no such output, the user wocould be left wondering what is happening. by using this option, you too can be left wondering !)

-- Version: print the Autoconf version used to generate the 'configure 'script.

-- Prefix = PEWFIX, '-- prefix' is the most common option. the generated 'makefile' will view the parameters passed with this option. When a package is installed, it can completely relocate its structural independence. for example, to install a package, for example, Emacs, the following command will install Emacs Lisp file to "/opt/gnu/share ":
$./Configure -- prefix =/opt/gnu

-- Exec-prefix = EPREFIX, which is similar to the '-- prefix' option, but it is used to set the installation location of the file on which the structure depends. the compiled 'memacs' binary file is such a question. if this option is not set, the default option value will be set to the same as the '-- prefix' option value.

-- Bindir = DIR: Specifies the installation location of the binary file. The binary file here is defined as a program that can be directly executed by the user.

-- Sbindir = DIR: Specifies the installation location of the Super binary file. This is a program that can only be executed by the Super User.

-- Libexecdir = DIR: Specifies the installation location of executable support files. Unlike binary files, these files are never directly executed by users, but can be executed by the binary files mentioned above.

-- Datadir = DIR: Specifies the installation location of the common data file.

-- Sysconfdir = DIR: Specifies the installation location of read-only data used on a single machine.

-- Sharedstatedir = DIR: Specifies the installation location of writable data that can be shared on multiple machines.

-- Localstatedir = DIR: Specifies the installation location of writable data that can only be used by a single machine.

-- Libdir = DIR: Specifies the installation location of the library file.

-- Includedir = DIR: Specifies the installation location of the C header file. This option can also be used in other languages, such as C ++ header files.

-- Oldincludedir = DIR, which specifies the installation location of the C header file installed by the compiler except GCC.

-- Infodir = DIR: Specifies the installation location of the Info format document. Info is the document format used by the GNU project.

-- Mandir = DIR: Specifies the installation location on the manual page.

-- Srcdir = DIR. This option does not work for installation. he will tell the 'configure 'source code location. generally, you do not need to specify this option because the 'configure 'script is usually in the same directory as the source code file.

-- Program-prefix = PREFIX, which specifies the prefix that will be added to the name of the installed program. for example, if you use '-- program-prefix = G' to configure a program named 'tar', the installed program will be named 'gtar '. this option is used only when it is used with other installation options. in 'file used only.

-- 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 a sed script. when a PROGRAM is installed, its name will go through 'sed-e PROGRAM 'to generate the installation name.

-- Build = BUILD: Specifies the system platform where the software package is installed. If not specified, the default value is the value of the '-- host' option.

-- Host = HOST: Specifies the system platform where the software runs. If this parameter is not specified, 'config. guess 'is run to detect the platform.

-- Target = GARGET: Specifies the target to system platform of the software. this mainly plays a role in the context of programming language tools such as compilers and compilers. if not specified, the '-- host' option value is used by default.

-- Disable-FEATURE: some software packages can choose this option to provide compilation configuration for large options, such as using the Kerberos authentication system or an experimental compiler for optimal configuration. if these features are provided by default, you can use '-- disable-FEATURE' to disable them. Here 'feature 'is the name of the FEATURE.

Example: $./configure -- disable-gui

-Enable-FEATURE [= ARG]. On the contrary, some software packages may provide some features that are disabled by default. You can use '-- enable-FEATURE' to use it. here, 'feature 'is the FEATURE name. A feature may accept an optional parameter. example: $. /configure -- enable-Buffers' = 128

'-- Enable-FEATURE = no' is synonymous with' -- disable-FEATURE 'mentioned above.

-- With-PACKAGE [= ARG]: In the free software community, there is an excellent tradition of using existing software packages and libraries. when you use 'configure 'to configure a source code tree, you can provide information about other installed software packages. for example, the BLT device toolkit relies on Tcl and Tk. to configure the BLT, you may need to provide 'configure 'with some information about where we installed Tcl and Tk: $. /configure -- with-tcl =/usr/local -- with-tk =/usr/local

'-- With-PACKAGE = no' is synonymous with' -- without-PACKAGE.

-- Without-PACKAGE: Sometimes you may not want your software PACKAGE to interact with existing software packages in the system. for example, you may not want your new compiler to use GNU ld. you can do this by using this option:

$./Configure -- without-gnu-ld

-- X-nodes des = DIR. This option is a special case of the '-- with-package' option. when Autoconf was initially developed, it was popular to use 'configure 'as a work und for Imake to create software running on X. the '-- x-uploads' option specifies the directory containing the X11 header file to the 'configure' script.

-- X-libraries = DIR. Similarly, the '-- x-libraries' option provides a method for specifying the directory containing the X11 Library to the 'configure' script.

Running 'configure 'in the source code tree is unnecessary and bad. A good 'makefile' generated by 'configure 'can build a software package whose source code belongs to another tree. the benefit of constructing a derived file in a tree independent of the source code is obvious: derived files, such as the target file, will be scattered in the source code tree in disorder. this makes it very difficult to build the same target file on another system or with different configuration options. we recommend that you use three trees: A source tree, a build tree, and an 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

Creating cache./config. cache

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 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

Creating./config. status
In this way, the build tree is configured. You can continue to build and install the package to the default location '/usr/local ':

$ Make all & make install

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId = 1440383

After a software package is installed by compiling the source code, how can it be fully uninstalled?

If the original source is still there, many source makefiles have the write uninstall rule, which is feasible to make uninstall directly in Souce, but it is not written by unscrupulous authors, let's take a look at what he did in the install part of Makefile, and then delete it one by one.

If the source is gone... it's depressing.

So far, you can make uninstall .......

 

 

(Because the error is always installed accidentally, make uninstall & make clean and re-configure ......)

Basic installation and uninstallation of software in linux
 
 

The installation and uninstallation of Linux software has been a problem for many new users. In Windows, we can use the installation and uninstallation programs that come with the software or "Add/delete programs" in the control panel. Similarly, in Linux, there is a powerful software installation and uninstallation tool named RPM. It can be used to establish, install, query, update, and uninstall software. This tool is used in the command line. Enter rpm at the Shell prompt to obtain help information for this command.

Software Installation

The installation of software in Linux is mainly in two different forms. The first installation file is xxx.tar.gz, and the other is named xxx. i386.rpm. Most of the software released in the first method is sent in the source code form, and the second method is directly sent in binary form.

For the first method, the installation method is as follows:

1. First, copy the installation file to your directory. For example, if you log on as root, copy the software to/root.

# Cp xxx.tar.gz/root

2. Because the file is compressed and packaged, decompress it. Command:

# Tar xvzf filename.tar.gz if it is in the filename.tar.bz2 format, it should be tar jxvf filename.tar.bz2 to decompress

3. After executing this command, extract the installation file to the current directory by path. Run the ls command to view the decompressed file. Usually there is an "Install" file in the files generated after decompression. This file is a plain text file that describes the installation method of the software package in detail.

4. Execute the decompressed command to generate an executable script program named configure. It is used to check whether the system has the library required for compilation, and whether the library version meets the compilation requirements. Prepare for subsequent compilation. Command: #./configure

If you want to install the software to a specified directory, use #. /configure -- prefix =/the directory you specify. For example, if you want to install an mlterm in the/opt/mlterm directory, enter

#./Configure -- prefix =/opt/mlterm

5. After the check is passed, the MakeFile file for compilation will be generated. Now you can start compiling. The compilation process varies depending on the software scale and computer performance. Command: # make.

6. After compilation, enter the following command to start installation:

# Make install

7. After installation is complete, clear the temporary files generated during compilation and files generated during configuration. Run the following command:
# Make clean

# Make distclean

So far, the software installation is complete.

For the second method, the installation method is much simpler.

Copy the installation file to your directory in the same way as the first method. Then use rpm to install the file. The command is as follows:
# Rpm-I filename. i386.rpm

Rpm automatically unpacks the installation file and installs the software in the default directory. And register the software installation information to the rpm database. The role of parameter I is to enable rpm to enter the installation mode.

Uninstall Software

1. The software is mainly detached using rpm. To uninstall a software package, you must first know the name registered in the system. Type the following command:

# Rpm-q-

You can query all the software packages installed in the current system.

2. Determine the name of the software to be detached, and you can start to uninstall the software. Type the following command:

# Rpm-e [package name]

You can uninstall the software. The function of parameter e is to enable rpm to enter the uninstall mode. Uninstall the software package named [package name. Each software package in the system depends on each other. If the object cannot be detached because of dependency, the rpm prompts and stops uninstalling the object. You can run the following command to ignore the dependency and directly start detaching:

# Rpm-e [package name]-nodeps

Uninstalling dependencies may make other software unavailable in the system.

If you want to know where the rpm package is installed?

Use # rpm-ql [package name]

3. How to uninstall the software installed with the source code package?

It is best to look at README and INSTALL. In general, it is said, but most of the software does not provide the uninstallation method of the source code package; we can find the Software Installation Point to delete. It mainly depends on where you installed it. For example:

If the software is installed, specify a directory. This problem will not be difficult;

For example, use the source code package to install gaim

#./Configure -- prefix =/opt/gaim

# Make

# Make install

If you install mlterm

#./Configure -- prefix =/opt/mlterm

# Make

# Make install

Install all the software installed in the source code package in the/opt directory ??

If deleted, the corresponding software directory will be deleted;

Some software needs to execute make uninstall in the decompressed installation directory, so it will be uninstalled.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.