加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rzstart.sh 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
liumengqi 提交于 2024-01-02 05:08 . update rzstart.sh.
#!/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.."
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化