Linux Learning Diary-source code compiled Apache

Source: Internet
Author: User

This article for the author in the study of Linux software Installation, try to use the source code to install Apache process, after a small summary, found wrong to correct. 】

One, the typical source code compilation installation software process includes the following 3 steps:

1) Run the Configure command and combine the necessary parameters to generate the makefile; (readers can own Baidu makefile related knowledge)

2) Run make command to generate various modules and main programs;

3) Run the Make install command to copy the necessary files to the installation directory.

(The above procedure is performed in the root directory of the corresponding software installation package.)

Second, the installation process

Linux systems, generally in the/USR/LOCAL/SRC directory to download the source package (not a hard rule, just a habit), in this directory can be ordered:

wegt http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz download. Resources from Tsinghua University open source software image Station (https://mirrors.cnnic.cn/), a lot of mirror resources can be found inside.

After the download is done using tar for decompression, and then into the /usr/local/src/httpd-2.4.27 directory, after entering the directory need to use the Configure tool to generate makefile, for my novice, only in the simplest way to generate , because there are too many parameters that can be added when configuring Apache. Command: ./configure--prefix=/usr/local/apache/ After this, configure will produce a lot of output and start checking many compilation environments (with GCC tools, software dependencies, and so on).

At this time many people will appear the error message of installation failure (Configure:error:APR not found. Please read the documentation. No APR is found, please read the documentation) This is where dependencies are configured first, and in general there is a lack of apr-util and pcre. If there is no error, skip to step 4th. ( Note: 1-3 steps is the error after the configuration environment, should be in the/usr/local/directory operation, the configuration is completed to check whether the current directory has Apr apr-util pcre three folders, and then into the/usr/local/src/ Before proceeding in the httpd-2.4.27 directory )

1 Download Package

      wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz

wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

wget Http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

2 Installation (The following demo Apr installation Other installation method is the same)

      TAR-ZXF apr-1.4.5.tar.gz

CD apr-1.4.5

./configure--PREFIX=/USR/LOCAL/APR

      Make && make install (this combination command, if not run under root, use sudo to run make only through root and make install still does not have permission, the author is resolved by bash

"sudo bash-c ' make && make install '")

3 Finally, when compiling Apache, add:

     ./configure--prefix=/usr/local/apache/--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--with-pcre =/usr/local/pcre/

4 after completing the previous step, the makefile file is generated in the current directory, which is installed by using the make and make install commands. Command: Make && make install

After 5 operation has completed successfully, Apache has been installed and can be opened by command: /usr/local/apache/bin/apachectl start Service

Then use the ifconfig directive to view the server address:

    

6 finally enter the domain name in the browser, the result is the following installation success:

    

This way of compiling the source code, just experience the process, familiar with the process and the principle of deepening their understanding, the above way installation although it seems very simple, but is due to the use of simple compilation method. The use of source code to compile and install software in fact there are many drawbacks, first of all, the system must exist in the GCC tools (for safe production has a certain impact); Secondly, the source code compilation itself is a lot of optional parameters, these parameters correspond to different functions, the installation of the parameters specified when the software has what features, For different usage environments, the requirements should be different, so in the worst case, you will need to recompile the installation (except for some projects that add functionality by adding modules, these projects can be compiled without recompiling and only need to compile the appropriate modules). In addition, the process of compiling the installation takes a long time and does not apply to large-scale project deployments. The final source code compilation can not complete the software management functions (uninstall, upgrade, detection ...) )。 In addition, RedHat to solve the shortcomings of source code compilation, using a simpler rpm (RedHat Package Manager) packet management mechanism. Readers can view the details in http://man.linuxde.net/rpm.

Linux Learning Diary-source code compiled Apache

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.