shell脚本一键部署zabbix监控服务

–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^

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值