序号 | 主机 | 系统 | 作用 | 备注 |
1 | stu:192.168.3.81 | rockylinux8.6最小化安装 | LAMP | |
2 | stu:192.168.3.82 | rockylinux8.6最小化安装 | LNMP |
一、环境准备
1、关闭selinux及防火墙
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl disable firewalld
reboot
2、安装软件包
yum install -y wget vim net-tools bash-completion
二、LAMP搭建
1、下载源码包并安装aparch
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.54.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.38/pcre2-10.38.tar.gz
yum install make gcc gcc-c++ openssl openssl-devel expat-devel -y
tar -xvf apr-1.7.0.tar.gz -C /usr/local/src/
cd /usr/local/src/apr-1.7.0/
./configure --prefix=/usr/local/apr
make -j 4 && make install && cd
cd /usr/local/src/apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
tar -xvf pcre2-10.38.tar.gz -C /usr/local/src
cd /usr/local/src/pcre2-10.38/
./configure --prefix=/usr/local/pcre
make -j 4 && make install && cd
tar -xvf httpd-2.4.54.tar.gz -C /usr/local/src/
cd /usr/local/src/httpd-2.4.54/
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-ssl \
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre \
--enable-modules=most --enable-mpms-shared=all --with-mpm=event
make -j 4 && make install && cd
/usr/local/apache/bin/apachectl -V
cat /usr/local/apache/build/config.nice
生成启动脚本
cp /usr/local/apache/bin/apachectl /etc/init.d/
chmod +x /etc/init.d/apachectl
cat > /usr/lib/systemd/system/apache.service << EOF
[Unit]
Description=apache
After=network.target
[Service]
Type=forking
ExecStart=/etc/init.d/apachectl start
ExecReload=/etc/init.d/apachectl restart
ExecStop=/etc/init.d/apachectl stop
PrivateTmp=tru