91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

一鍵實現基于LNMP架構的zabbix基本安裝

發布時間:2020-02-26 05:32:41 來源:網絡 閱讀:168 作者:qq5d47f509174fe 欄目:云計算
#!/bin/bash
#簡易安裝zabbix+LNMP
#
lnmp(){

#關閉防火墻&核心安全功能
systemctl stop firewalld.service
systemctl disable firewalld.service &> /dev/null
setenforce 0
sed -i "7cSELINUX=disabled" /etc/sysconfig/selinux

#yum安裝nginx
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

#手動創建nginx安裝源(centos可以根據不同系統進行替換,后面的版本同樣)
echo "[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/\$basearch/
gpgcheck=0
enabled=1" > /etc/yum.repos.d/nginx.repo
yum install nginx -y

#啟動nginx
systemctl start nginx
systemctl enable nginx

#安裝mysql 5.7并啟動
yum install -y mariadb-server mariadb expect
systemctl enable mariadb.service
systemctl start mariadb.service

#設定數據庫初始密碼
/usr/bin/expect <<EOF
spawn mysqladmin -u root -p password 123123 
expect {
    "Enter*"
    {send "\r"}
}
expect eof
EOF

#安裝PHP 7.2
yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
for ((i=1;i>0;i++));do
rpm -q php72w-cli &> /dev/null
if [ $? -ne 0 ];then
    yum install -y php72w php72w-devel php72w-fpm php72w-gd php72w-mbstring php72w-mysql
else
    break
fi
done

#修改fpm模塊使其支持nginx
sed -i -e "8cuser = nginx" -e "10cgroup = nginx" /etc/php-fpm.d/www.conf

#更改nginx配置文件使其能識別php動態文件
sed -i "10s/index.html/index.html index.php/" /etc/nginx/conf.d/default.conf
sed -i -e "30,36s/#//" -e "31s/html/\/usr\/share\/nginx\/html/" -e "34s/\/scripts/\$document_root/" /etc/nginx/conf.d/default.conf

#配置PHP
sed -i -e "359s/On/Off/" -e "202s/Off/On/" /etc/php.ini

#重啟服務
systemctl start php-fpm
systemctl enable php-fpm
systemctl restart nginx
}

#檢測LNMP架構是否已經安裝完畢
systemctl restart nginx &> /dev/null
service mysqld restart &> /dev/null
systemctl restart mariadb &> /dev/null
netstat -atnp | egrep '(nginx|3306)' &> /dev/null
if [ $? -ne 0 ];then
    lnmp
fi

#配置PHP以適應zabbix
sed -i -e "368s/30/300/" -e "378s/60/300/" -e "656s/8/16/" -e "799aalways_populate_raw_post_data = -1" -e "877cdate.timezone = Asia/Shanghai" /etc/php.ini
systemctl restart php-fpm

#建立zabbix數據庫和管理用戶
mysql  -uroot -p123123 -e "CREATE DATABASE zabbix character set utf8 collate utf8_bin;"
mysql  -uroot -p123123 -e "GRANT all privileges ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'zhy94666';"
mysql  -uroot -p123123 -e "flush privileges;"

#解決本地無法登錄問題
mysql -uroot -p123123 -e "drop user ''@localhost;"
mysql -uroot -p123123 -e "drop user ''@localhost.localdomain;"
mysql -uroot -p123123 -e "flush privileges"  

#安裝zabbix
rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
for ((k=1;k>0;k++));do
    rpm -q zabbix-agent &> /dev/null
    if [ $? -ne 0 ];then
        yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
    else
        break
    fi
done

#生成數據庫文件
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzhy94666 zabbix

#修改zabbix服務端配置文件
sed -i -e "91s/# //" -e "125cDBPassword=zhy94666" /etc/zabbix/zabbix_server.conf

#提權
cp -r /usr/share/zabbix/ /usr/share/nginx/html/
chown -R zabbix:zabbix /etc/zabbix/
chown -R zabbix:zabbix /usr/share/nginx/
chown -R zabbix:zabbix /usr/lib/zabbix/
chmod -R 755 /etc/zabbix/web/
chmod -R 777 /var/lib/php/session/

#啟動zabbix
systemctl start zabbix-server.service
systemctl enable zabbix-server.service
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service

#所有服務重啟
systemctl restart php-fpm nginx mariadb zabbix-server zabbix-agent

#檢查服務是否均啟動
test=`netstat -atnp | egrep '(nginx|3306|10051|10050)' | grep -v "TIME_WAIT" | wc -l`
if [ $test -ge 5 ];then
    echo "zabbix服務端設置完成"
fi
dizhi=`ifconfig ens33 | awk 'NR==2{print $2}'`
echo "請使用瀏覽器登陸${dizhi}/zabbix/進行安裝
默認登陸用戶名為:Admin
默認登陸密碼為:zabbix"
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

镇江市| 峨眉山市| 沙田区| 新竹市| 渭源县| 祥云县| 仲巴县| 弋阳县| 图们市| 牟定县| 上林县| 恩施市| 上杭县| 高尔夫| 天水市| 沁水县| 九江县| 崇州市| 吉林市| 九龙坡区| 定州市| 信宜市| 宜良县| 红安县| 阳曲县| 泸西县| 榆林市| 辽阳县| 石泉县| 丹寨县| 尉氏县| 宝应县| 兖州市| 鞍山市| 尼勒克县| 牟定县| 长葛市| 方山县| 靖边县| 漳州市| 津南区|