–with-apr-util=/usr/local/apr-util/ \
–enable-modules=most \
–enable-mpms-shared=all \
–with-mpm=prefork
make && make install
fi
if [ $? -eq 0 ];then
echo “apache 编译完成”
else
echo “apache 编译失败,请检查”
fi
ln -s /usr/local/apache/include/ /usr/include/httpd
echo ‘export PATH=/usr/local/apache/bin:$PATH’ > /etc/profile.d/httpd.sh
cd $route/apache/conf/
sed -i ‘203s///g’ httpd.conf
touch /usr/lib/systemd/system/httpd.service
sum=$(cat /usr/lib/systemd/system/httpd.service | wc -l)
if [ $sum -lt 2 ];then
cat > /usr/lib/systemd/system/httpd.service << EOF
[Unit]
Description=httpd server daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecStop=/usr/local/apache/bin/apachectl stop
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
EOF
fi
systemctl daemon-reload
systemctl enable --now httpd
echo “安装mysql”
id mysql &> /dev/null
if [ $? -ne 0 ];then
useradd -r -M -s /sbin/nologin mysql
fi
chown -R mysql.mysql $route/mysql
echo ‘export PATH=/usr/local/mysql/bin:$PATH’ > /etc/profile.d/mysql.sh
mkdir -p /opt/data
chown -R mysql.mysql /opt/data/
look=$( ls $data | wc -l)
if [ $look -eq 0 ];then
$route/mysql/bin/mysqld --initialize-insecure --user mysql --datadir /opt/data/
cat > /etc/my.cnf << EOF
[mysqld]
basedir = $route/mysql
datadir = $data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
EOF
sed -ri “s^(basedir=).*\1$route/mysqlg” /usr/local/mysql/support-files/mysql.server
sed -ri “s^