康乐_SH

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#安装前准备:关闭防火墙和SELinux
#1 安装相关包
[root@centos8 ~]#dnf install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config
#2 下载并解压缩包
[root@centos8 ~]#wget https://dlcdn.apache.org//httpd/httpd-2.4.46.tar.bz2
  [root@centos8 ~]#tar xvf httpd-2.4.46.tar.bz2 -C /usr/local/src
#3 配置
[root@centos8 ~]#cd /usr/local/src/httpd-2.4.46/
[root@centos8 httpd-2.4.46]#./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
#4 编译并安装
[root@centos8 httpd-2.4.46]#make -j 4 && make install
#5 配置环境
[root@centos8 ~]#echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@centos8 ~]#. /etc/profile.d/httpd.sh
#6 运行
[root@centos8 ~]#apachectl start
#7 指定用apache用户运行
[root@centos8 ~]#useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache
[root@centos8 ~]#vim /etc/httpd/httpd.conf
user apache
group apache
#8 配置生效和验证
[root@centos8 ~]#apachectl restart

#9 查看进程

[root@centos8 ~]#ps aux|grep apache
#10 用浏览器打开以下地址http://10.0.0.150,验证apache服务

 

posted on 2022-03-06 16:12  康乐_SH  阅读(69)  评论(0编辑  收藏  举报