源码安装httpd
1、下载httpd源码包
apache.org
- httpd
- apr ??? //apache portable runtime
- apr-util
wget命令下载 httpd arp arp-util
2、创建一个系统账号
useradd -r -M -s /sbin/nologin apache
[root@localhost apr-1.7.0]
[root@localhost apr-1.7.0]
uid=995(apache) gid=992(apache) groups=992(apache)
-r ? ? 创建系统账号 -M? ?不创建用户的主目录 -s ?? 不允许登入
3、解压源码包
-c :创建一个压缩文件 -x :解压缩 -t :查看
-z : 是否同时具有gzip -j : 是否同时具有bzip2 -v : 显示过程 -f : 使用文档名,f放最后一位
[root@localhost c]
[root@localhost c]
[root@localhost c]
4、安装依赖包
yum 命令安装依赖包 openssl-devel 、pcre-devel、expat-devel、libtool 、gcc、gcc-c++
yum -y install openssl-devel pcre-devel expat-devel libtool
注释 configure 下
5、./configure 配置执行安装
使用–prefix参数指定nginx安装的目录
apr路径下
./configure --prefix=/usr/local/apr
make && make insatll
apr-util路径下
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make insatll
安装apache httpd
[root@192 httpd-2.4.53]
修改环境变量
[root@192 profile.d]
[root@192 profile.d]
[root@192 profile.d]
[root@192 apache]
[root@192 apache]
/usr/local/apache/bin/httpd
[root@192 apache]
/usr/local/apache/bin/apachectl
[root@192 apache]# pwd //路径 /usr/local/apache
[root@192 apache]# ln -s /usr/local/apache/include /usr/include/apache //映射 [root@192 apache]# vim /etc/man_db.conf
关闭防火墙
systemctl disable --now firewalld //开机不自启,立马关闭
[root@192 apache]
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
systemctl status firewalld //查看防火墙状态
[root@192 apache]
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Apr 17 10:52:54 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 17 10:52:55 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 17 10:52:56 localhost.localdomain firewalld[1035]: WARNING: AllowZoneDrifting is enabled. Th>
Apr 17 16:47:25 192.168.133.134 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 17 16:47:26 192.168.133.134 systemd[1]: firewalld.service: Succeeded.
Apr 17 16:47:26 192.168.133.134 systemd[1]: Stopped firewalld - dynamic firewall daemon.
setenforce是Linux的selinux防火墙配置命令, 执行setenforce 0 表示关闭selinux防火墙
[root@192 apache]
[root@192 apache]
Permissive //关闭
改为disabled 永久关闭生效
[root@192 apache]# vim /etc/selinux/config
启动、查看端口
ss -ant //查看系统运行端口号 apachectl start //启动apache apachectl stop //停止apache 启动前 启动后
总结
|