Compile the installer from the source under Linux

Source: Internet
Author: User

This article simply records the next, under Linux How to install the program through the source code, as well as related knowledge.

I. Components of the procedure

Linux programs are mostly made up of the following parts:

Binary files: That is, program files that can be run

Library files: The files that we usually see in the Lib directory

Configuration file: This doesn't have to be said, all know

Help documentation: a document that is usually a command that we view with the man command under Linux

Ii. storage directory for Linux programs

The storage directory for Linux programs is roughly three places:

/etc,/bin,/sbin,/lib: Programs required for system startup, these directories cannot mount additional partitions and must be on the partition of the root file system

/usr/bin,/usr/sbin,/usr/lib: Operating system core functions, can be partitioned separately

/usr/local/bin,/usr/local/sbin,/usr/local/lib,/usr/local/etc,/usr/local/man: This is used to install a third-party program that corresponds to binary files, library files, configuration files, Directory of Help Documents

Normally, we install the installer in the/usr/local directory.

Third, compile the installation source program

1. Use the following command to see if the GCC compiler is currently installed, and there is no possibility to install GCC with Yum first

GCC--version #查看是否安装gcc

2, unzip the source package, for example:

TAR-XVF nginx-1.7.7.tar.gz #解压源码包

3, into the extracted source package:

CD nginx-1.7.7 #进入源码包

4, execute the Configure file, this file has two functions: 1, let the user select the compilation feature; 2. Check the compilation environment. The makefile file is generated when configure executes. For example:

./configure--prefix=/usr/local/nginx--conf-path=/etc/nginx/nginx.conf

Where we have established the installation path through--prefix, and--conf-path the specific location of the configuration file. Note: Not all program configure parameters are the same as can be used./configure--help See the detailed parameter description. If the program depends on the library is not installed in the current system, it will cause configure last error, encountered this situation requires you to install the dependent library first.

5. Execute make command, compile program

Make

6, after the successful compilation can be installed, execute the following command

Make install

To this program even if the installation is complete, but do not forget that there is a follow-up configuration Oh

Iv. Configuration Procedures

1, modify the PATH environment variable, to be able to identify the binary file path of this program;

Modify the/etc/profile file to add in the file

Export path= $PATH:/path/to/somewhere# Remember that it is the directory where the executable file is located, and do not include the executable file in the path.

Then execute:

Source/etc/profile #是我们的修改生效

2, by default, the system search library file path/lib,/usr/lib; To add additional search paths (note: Some programs do not provide library files, then this setting is not required)

Create a file with a suffix of. conf in/etc/ld.so.conf.d/, and then write the path you want to add directly to the file, and then execute the following command to take effect

Ldconfig

3, if the program provides the library file, will also provide the corresponding header files, generally in the installation directory of the Include directory, the system default scan header file path is:/usr/include. We can connect to our installer's header file under/usr/include.

Ln-s/usr/local/nginx/include/usr/include/yourname

4, may also provide the help document, is generally the installation directory of the man directory, in order for us to use the man command to view our program's help document, we need: Add a manpath in/etc/man.config, point to our document directory

Compile the installer from the source under Linux

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.