Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compile and install Apache Server on CentOS 6.5.How to compile and install Apache Server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article, Xiaobian introduces in detail how to compile and install Apache server on CentOS 6.5. the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to compile and install Apache server on CentOS 6.5" can help you solve your doubts.

Inux system: centos 6.5mini version, if it is a vmware virtual machine, the network card requires "bridging"

1. Before compiling and installing, first yum installs "Development Environment", "compatible Library" and "Chinese support", that is, execute the following command

# yum groupinstall "development tools"compatibility libraries"chinese support [zh]"-y

Install man, vim, wget tools

# yum install man vim wget-y

2. Because httpd2.4.25 is to be compiled and installed this time, this version requires a later version of apr and apr-util.

So compile and install apr and apr-util first.

Wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2

Wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2

2.1 compile and install apr

Tar xf apr-1.5.2.tar.bz2cd apr-1.5.2./configure-- prefix=/usr/local/aprecho $? # if the result is 0, continue to execute make & & make install

2.2 compile and install apr-util

Tar xf apr-util-1.5.4.tar.bz2cd apr-util-1.5.4./configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/aprecho $? # if the result is 0, continue to execute make & & make install

3. The heavyweight left the factory and officially began to compile httpd-2.4.25.

Wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.25.tar.bz2

According to many compiling experiences, lack of pcre-related files, openssl is too old

Execute the following command:

Yum install pcre-devel openssl openssl-devel-ytar xf httpd-2.4.25cd httpd-2.4.25./configure-prefix=/usr/local/apache-sysconfdir=/etc/httpd-with-apr=/usr/local/apr-with-apr-util=/usr/local/apr-util/

Continue as prompted above: make & & make install

Execute echo$? again If the result is 0, it means that httpd2.4.25 has been compiled successfully at this point, and then simply configured, you can use the

4. Configure httpd

Turn off linux Firewall

Service httpd stop

Close selinux

Setenforce 0

Copy startup file

Cp / usr/local/apache/bin/apachectl / etc/init.d/httpd

Add the environment variable of httpd to the environment variable

Echo 'export path=$path:/usr/local/apache/bin' > / etc/profile.d/httpd.sh

Chmod + x / etc/profile.d/httpd.sh

Source / etc/profile.d/httpd.sh

Edit the configuration file for httpd:

Vim / etc/httpd/httpd.conf

On the next line of serverroot, add servername localhost

If you want to add the apache service to boot, you can modify the service startup script:

Vim / etc/init.d/httpd

Add: # chkconfig:235 85 15 under the second line

# description: this is apache server

Save exit

Execute the command service httpd start # to prompt lynx that it can't be found. Then yum install lynx-y

Execute the command netstat-ntlp # to see if httpd is started and whether it has port 80

Finally, enter the virtual machine ip address in your browser

It works!

Then apache is installed successfully

1. Compile and install-the default index.html home page is / usr/local/apache/htdocs

2. Configuration file: / etc/httpd/httpd.conf

3. Startup script: / etc/init.d/httpd

4. Cgi-bin file directory: / etc/local/apache/cgi-bin

After reading this, the article "how to compile and install Apache server on CentOS 6.5" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about the article, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report