CentOS下源代码编译和安装Apache

2022-07-29 14:24:00 浏览数 (1)

如何从CentOS中源码编译和安装Apache

1、下载最新的Apache版本

wget http://mirror.downloadvn.com/apache//httpd/httpd-2.4.41.tar.gz

2、安装软件包

yum install apr* gcc

3、编译安装

tar -zxvf httpd-2.4.41.tar.gz cd httpd-2.4.41 ./configure –prefix=/usr/local/apache –enable-vhost-alias –enable-rewrite –enable-info make make install

复制初始化文件并将Apache设置为启动

cp build/rpm/httpd.init /etc/init.d/httpd chmod 755 /etc/init.d/httpd chkconfig –add httpd chkconfig –level 35 httpd on

创建一个符号链接

ln -s /usr/local/apache/ httpd cd /usr/sbin/ ln -fs /usr/local/apache/bin/httpd ln -fs /usr/local/apache/bin/apachectl cd /var/log rm -rf httpd/ /etc/init.d/httpd start

启动/停止httpd服务

service httpd restart service httpd start /usr/local/apache/bin/apachectl start /usr/local/apache/bin/apachectl stop /usr/local/apache/bin/apachectl status /etc/init.d/httpd start /etc/init.d/httpd stop /etc/init.d/httpd restart

使用pgrep查找启动的进程

pgrep httpd

Apache配置文件

vi /usr/local/apache/conf/httpd.conf

0 人点赞