How to install the Apache server in Linux

Source: Internet
Author: User

How to install the Apache server in Linux
Due to the learning needs, all the Apache source code packages are manually installed, and the installation process has many strange problems. However, if you find out what the problem is, it is not too difficult. If you have any installation problems, read this tutorial carefully. First download the httpd package (http://httpd.apache.org/download.cgi#apache24 ). Since I installed CentOs7.0 in a virtual machine, we also need to download a software to place the package files downloaded in Windows in Linux. (: Http://winscp.net/eng/docs/lang:chs) Click to install WinSCP, after the installation is successful, the interface can appear: Enter the Virtual Machine IP address, user name and password, click to log on. Find the downloaded package file and drag it into the Linux folder. Note: You must place the downloaded httpd package file in the/usr/local/src directory, this directory is often used to place various source code packages. Next, log on to Linux and go to the src directory (cd/usr/local/src ), decompress the httpd package file # tar-zxvf httpd package file (Note that there may be an episode here. When you decompress the package, the following error may occur: gzip: stdin: not in gzip formattar: child returned status 1tar: Error exit delayed from previous errors Error. The reason is that because the compressed package is not compressed in gzip format, 'z' can be removed during decompression to decompress the package ): # cd httpd folder # cd. /configure -- prefix =/usr/local/apache at this time the following problem occurs: [root @ localhost httpd-2.4.17] #. /configure -- prefix =/usr/local/apache2 Checking for chosen layout... apache checking for working mkdir-p... yes checking for grep that handles long lines and-e... /usr/bin/grep checking for egrep... /usr/bin/grep-E checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu configure: Refreshing Apache Portable Runti Me library... configure: checking for APR... no configure: error: APR not found. please read the documentation. from the configuration information of the last row, we can know that the APR is not found. What is APR? Note: Do not confuse APR with ARP. The former is Apache portable Run-time libraries, which can be transplanted to the Runtime Library of Apache, its main function is to provide an underlying support interface library for upper-layer applications that can be used across multiple operating system platforms), while the latter is (Address Resolution Protocol, Address Resolution Protocol ). Okay, now we can download the APR package, but to tell everyone that APR is still dependent on the package APR-util, all we need to download APR-util :( http://apr.apache.org /) we still use the method mentioned at the beginning of the article to put it under the/usr/local/src directory. Run the following command to decompress and install: # cd/usr/local/src # tar-xvf apr package file # cd apr folder # cd. /configure -- prefix =/usr/local/apr-util but the following configuration problem occurs: we need to install the Gcc compiler. We can install gcc # yum install gcc-c ++ online (this must be installed. If not, the software package will also be required to be installed in the following installation. After installation is complete, you can reinstall APR-util and APR. you can install the package as usual. When we install the httpd package file, we find that the following error occurs during installation: checking whether we are using the gnu c compiler... yes checking whether gcc accepts-g... yes checking for gcc option to accept ISO c89... none needed checking how to run the C preprocessor... gcc-E checking for gcc option to accept ISO c99... -std = gnu99 checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available From the http://pcre.org/from the configuration information can be seen: we also need to install the PCRE package file, in fact, the installation here I think everyone is very crashed, I thought how to install so many things, here we will talk about the dependency of the software package in Linux. If you install the Apache server as an example, it is: httpd package file --> PCRE --> ARP --> APR-util --> if we select source code to install GCC, We must install it step by step. We can find the PCRE in the configuration information on the Internet (mainly used for string mode segmentation, matching, search and replacement operations ): http://download.chinaunix.net/download/0008000/7913.shtml # unzip pcre package file # cd pcre folder # configure -- prefix =/usr/local/pcre -- with-apr =/usr/local/apr/bin/apr-1-config # make install. After the installation is successful, we can install the httpd installation package again, next, you can rest assured that there will be no other dependent installation package software. We still follow the previous method: # cd httpd package file # cd. /configure -- prefix =/usr/local/apache -- with-pcre =/usr/local/pcre -- with-apr =/usr/local/ Pr -- with-apr-util =/usr/local/apr-util # make install is complete, and the installation is successful, so we can enable the Apache service, but before enabling it, we need to modify the following: # cd/usr/local/apache/conf # vi httpd. conf find # ServerName www.example.com: 80 and add ServerName 192.168.9.122: 80 to save and exit. Then let's start It. Next we can view It in the browser: It Works appears! It indicates that your Apache server is successfully installed.

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.