代码拉取完成,页面将自动刷新
#!/bin/bash
echo "-----开放防火墙端口"
systemctl start firewalld
systemctl enable firewalld
firewall-cmd --add-port=22/tcp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=3100/tcp --permanent
firewall-cmd --add-port=514/tcp --permanent
firewall-cmd --add-port=514/udp --permanent
firewall-cmd --reload
setenforce 0
sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
echo "-----防火墙端口开放完毕selinux已关闭"
echo "-----开始安装yum源"
yum -y install epel-release
yum -y install unzip lrzsz vim
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel gcc gcc-c++ make wget gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
yum -y install nginx
yum -y install nginx-all-modules.noarch
cd /root/rizhi
yum -y install grafana-10.2.2-1.x86_64.rpm
echo "-----所有yum都已成功安装"
echo "-----开始启动日志审计服务和路由转发服务"
cd /root/rizhi/rizhishenji
mkdir /home/loki
mkdir /home/promtail
rm -rf /etc/grafana/grafana.ini
cp loki-start.sh promtail-start.sh /opt
chmod +x /opt/loki-start.sh
chmod +x /opt/promtail-start.sh
cp /root/rizhi/loki-linux-amd64 /usr/bin/loki
chmod +x /usr/bin/loki
cp /root/rizhi/promtail-linux-amd64 /usr/bin/promtail
chmod +x /usr/bin/promtail
cp grafana.ini /etc/grafana/grafana.ini
cp config.yml /home/promtail
cp local-config.yaml /home/loki
rm -rf /etc/rsyslog.conf
rm -rf /etc/nginx/nginx.conf
cp rsyslog.conf /etc/rsyslog.conf
cp nginx.conf /etc/nginx/nginx.conf
systemctl restart rsyslog
systemctl start grafana-server
systemctl enable grafana-server
echo "-----日志审计服务和路由转发服务启动成功"
echo "-----开始编译安装python3.9和web服务"
mkdir /usr/local/python3.9
cp /root/rizhi/rizhishenji/Python-3.9.9.tgz /usr/local/python3.9
cp /root/rizhi/rizhishenji/loki.service /etc/systemd/system
cp /root/rizhi/rizhishenji/flask.service /etc/systemd/system
cp /root/rizhi/rizhishenji/promtail.service /etc/systemd/system
systemctl daemon-reload
cd /usr/local/python3.9
tar -zxvf Python-3.9.9.tgz
cd Python-3.9.9
./configure --prefix=/usr/local/python3.9
make && make install
unlink /usr/bin/python3
unlink /usr/bin/pip3
ln -s /usr/local/python3.9/bin/python3.9 /usr/bin/python3
ln -s /usr/local/python3.9/bin/pip3.9 /usr/bin/pip3
cp -rvf /root/rizhi/rizhishenji/rizhishenji /mnt/
cd /mnt/rizhishenji
chmod +x start.sh
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
ln -s /usr/local/python3.9/bin/gunicorn /usr/bin/gunicorn
sh start.sh
echo "-----python3.9和web服务已成功安装"
echo "-----正在启动最后收尾工作"
ip=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
sed -i "s/192.168.3.92/$ip/g" /mnt/rizhishenji/app.py
sed -i "s/192.168.3.92/$ip/g" /etc/nginx/nginx.conf
systemctl start nginx
systemctl enable nginx
systemctl start loki
systemctl enable loki
systemctl start flask
systemctl enable flask
systemctl start promtail
systemctl enable promtail
echo "-----日志审计服务安装完成"
echo "-----访问web:$ip"
echo "-----用户名:rzsjadmin"
echo "-----密码:rzsj@#\$2023.."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。