Our Customers

新闻资讯

centos7.x源码安装Apache

发布时间 : 2021/04/30
浏览次数 : 590
文章来源 : 合众启航

1:下载apache tar.gz安装包

包含apr软件包  Apr-util软件包  Httpd软件包

进入apache官网 https://downloads.apache.org/

image.png

image.png

image.png

2:安装apr

a:如果没有gcc库,则需要安装gcc库,命令为

yum install gcc gcc-c++ -y

b:编译配置

./configure --prefix=/usr/local/apr

 ./configure是编译自定义配置 --prefix是安装目录

c:安装

make && make install

3:安装apr-util

a:编译安装

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

./configure是编译自定义配置 --prefix是安装目录,--with-apr是刚安装apr的安装目录,配置依赖

b:安装

make && make install

4:添加用户组和用户

groupadd apache
useradd -g apache apache -M -s /sbin/nologin

5:安装httpd

a:编译自定义配置

./configure
--prefix=/usr/local/httpd
--sysconfdir=/usr/local/httpd/etc/
--enable-so
--enable-ssl
--enable-cgi
--enable-rewrite
--enable-modules=most
--enable-mpms-shared=all
--with-mpm=prefork
--with-zlib
--with-pcre
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util

b:安装

make && make install

c:启动

进入安装目录的bin目录

./apachectl stop  停止
./apachectl start 启动
./apachectl restart 重启


18049412926