Manually compile and install httpd in Linux

Source: Internet
Author: User

Why do I need to manually compile and install the RPM package?

Due to my limited level, I have two answers to this question:

1. Since the RPM package on the network is compiled by the author on his own machine, it is not suitable for the hardware platforms of various platforms. For example, if the author's machine is in X86_64 architecture, and your machine is i386, It is not lucky. It is not suitable for you. You can only download the source code and install it manually.

2. if you are doing O & M in a large company, you cannot easily download the RPM package and install it online for the sake of server system security, because others may maliciously inject Trojans and backdoors, nothing is impossible. For the sake of security, you must manually compile and install them.

It is difficult to manually compile and install it. What steps do I need?

Next, let me explain the steps below.
1. Install the compiling environment.
2. Download the httpd package (source code)
3. Compile and install
Haha, isn't it quite simple? Well, let's go through the detailed steps below.
1. Install the compiling environment
Install the compilation environment. As the name implies, the compiler required for compiling is installed.
How many compilers are there? We can use yum groupinfo Development tools to view the package group. Some readers may not understand the meaning of this command. After I write this blog post, I will open a separate blog to explain the yum commands and yum repository. It is actually very simple, so don't be afraid.

 

Of course, there are many compilation tools in a Development tool. You don't need to select them, just install them all.
Installing Development tools is very simple. You can directly install the Development tools in yum install. Because the author's network speed is very bad, the installation from the yum library is very slow, because the previous installation, so the installation process is not demonstrated on site.
After the installation is successful, run the command yum grouplist to check whether all package groups have been installed successfully.

Well, the first step is so easy.
2. Download the httpd source code package
Find the source code address on the Internet ,:


 
After copying the link address, go to xshell and enter the following in the command line:
The downloaded source code package exists in your current path.


 
After downloading the source code, decompress it and use ls in the current directory to check the format of compressed files in which the source package is compressed.

Files ending with .tar.bz2 are archived with tar for bzip2 compression and can be decompressed and archived with tar-jxf httpd-2.2.25.tar.bz2. Get a file named: httpd-2.2.25
The next step is to go into the httpd-2.2.25 directory and use the command: cd httpd-2.2.25.
Before compilation, we also need to define which features or functions are enabled for the current program compilation, and customize the installation path. The configure script in the package is used for setting. It is necessary to give a more in-depth introduction to the pre-compilation setting.
The package contains a makefile. the in and configure files generate the configuration file for one-step compilation (make command). Of course, you can do this without setting, it is installed by default according to its own default configuration.
There are several important frequently used configurations:
1. You can specify the installation path.
-- Prefix =/user/local/package-name
-- Sysconfdir =/etc/package-name
2. Specify the enabled features:
-- Enable-feature (feature) For example:-enable-socket configuration does not enable the socket function.
-- Disable-feature for example:-disable-socket configuration enable socket function
3. Specify the dependent functions, programs, or files
-- With-function: enables a function.
-- Without-functions: Disable a function.
Of course, different programs have different configure scripts with different functions and different settings to obtain help information.
Run the configure script to generate the make configuration file.
3. Compile and install
Compile: Use the make command directly.
Install: make install
So far, the installation has been completed.


 
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------
The above is installed. As the name implies, it is about to run. Before running it, you must set the environment variables so that we can input the program in shell, so that shell can find the location of our source program to start. Of course, this setting is written to the configuration file, which is permanently valid, not just for the current shell.

CentOS 6.5 compile and install httpd-2.4.7

CentOS 6.4 source code compilation and installation of httpd and start testing

Install and test httpd source code in CentOS

DRBD + Heartbeat + httpd implement HA cluster

Httpd service phase experiment in Linux

Httpd process and thread understanding Summary

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.