The steps for compiling and installing the source code package are not complex. In the actual installation process, the most important thing is to prepare the compiling environment. You can select or set the program package compilation parameters based on your actual needs; and Related configurations after the package is installed.
1. Prepare the compilation environment
Take centos6 as an example. Generally, two package groups are installed through yum, the compilation tool, and the main header files and library files on which the compilation package depends are all ready.
# Yum groupinstall "development tools"
# Yum groupinstall "server platform development"
In addition, if some dependency Development Kits are found to be missing during the compilation phase of the package, install them through Yum and continue the compilation. This process may be repeated!
2. Select or set package compilation Parameters
Before running the configure script, you usually need to add various parameters according to your actual needs. These parameters are roughly classified into the following three categories.
A) specify the relevant installation path. Example:
-- Prefix =/usr/local/package_name
-- Sysconfdir =/etc/package_name
B) enable/disable the feature. Example:
-- Enable-FPM
-- Disable-socket
C) Specify the dependent functions, programs, or files. Example:
-- With-function: enables a function.
-- Without-function: disables a function.
The configure script supports different parameters for different programs. For more information, see run./configure -- help.
3. Related configurations after the package is installed
After the package is installed, in order to allow the system to find the corresponding binary executable program files, library files and header files that can be called by other third-party packages, and man help files, set the parameters. For more information, see the following example.
Httpd source code installation practices:
1. Download the source code file httpd-2.2.29.tar.bz2 from the official website of apache. it is assumed that the file is stored in the/tmp directory.
2. # cd/tmp
3. # tar xf./httpd-2.2.29.tar.bz2
4. # cd httpd-2.2.29
5. Compile and install the SDK. It is assumed that the package is installed in/usr/local/httpd in advance, the httpd configuration file is placed in/etc/httpd, and the dynamic module loading function is allowed.
#./Configure -- prefix =/usr/local/httpd -- sysconfdir =/etc/httpd -- enable-so
# Make
# Make install
6. Configure the package after installation.
A) create the "httpd. Sh" file in the/etc/profile. d directory. The file content is as follows:
# Vim/etc/profile. d/Apache. Sh
Path =/usr/local/httpd/bin: $ path
Export path
B) Create the "httpd. conf" file in the/etc/lD. So. conf. d/directory. The file content is as follows:
/Usr/local/httpd/lib
C) Let the system regenerate the library file path Cache
# Ldconfig
D) Create a symbolic link so that the system can find the header file provided by httpd.
# Ln-S/usr/local/httpd/include/usr/include/httpd
E) export the man file. Modify the configuration file/etc/man. config and add the following lines at the corresponding location:
Manpath/usr/local/httpd/man
Now, the Apache web server program httpd has been compiled and installed through the source code! Because there is no service script, you can manually start it as follows:
# Apachectl start
This article is from the blog of "bee Huai Yu Shan Ren", please be sure to keep this http://deshanrenjian.blog.51cto.com/9324633/1551181
Source code compilation and installation package and httpd source code installation practices