mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup && curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo && sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo yum clean all && yum makecache && yum update -y
yum install -y -q postfix
yum install -y epel-release mariadb-server gcc gcc-c++ wget libpcap-devel bzip2 zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel make libffi-devel nmap masscan nginx initscripts postgresql-devel python3-devel redis
mkdir /root/python
wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz
tar -zxvf Python-3.10.4.tgz
cd Python-3.10.4 && ./configure prefix=/usr/local/python3.10 --enable-shared --enable-optimizations LDFLAGS="-Wl,--rpath=/usr/local/python3.10/lib" make && make install
rm -rf /usr/bin/python3 && rm -rf /usr/bin/pip3
ln -s /usr/local/python3.10/bin/python3.10 /usr/bin/python3 && ln -s /usr/local/python3.10/bin/pip3.10 /usr/bin/pip3
yum -y install git make gcc && git clone https://github.com/robertdavidgraham/masscan && cd masscan && make && make install
pip3 install -r /root/python/requirements.txt
如果你使用的是低于python3.10版本的python3,请把run.py文件中第16行注释去掉,并注释掉第17行
systemctl start nginx
useradd -s /sbin/nologin -M nginx
gunicorn配置文件已配置好,可以直接使用,可以根据自己的需求修改文件路径及端口.conf.ini配置数据库
在/etc/nginx/conf.d目录下放入vue.conf文件
在/etc/nginx目录下放入nginx.conf文件
conf配置文件中有注释
把vue目录移到/usr/share/nginx/html中
systemctl start mariadb
mysql_secure_installation(具体步骤略去,可参考https://www.cnblogs.com/yhongji/p/9783065.html) 配置数据库密码后需要在python/conf.ini文件中配置连接maridab数据库的用户名,密码等信息
sed -i "s|bind 127.0.0.1 ::1|bind 127.0.0.1|" /etc/redis/redis.conf
sed -i "s|# requirepass foobared|requirepass '你的redis密码'|" /etc/redis/redis.conf
配置数据库密码后需要在python/conf.ini文件中配置连接redis数据库的密码信息
systemctl start redis
redis-server /etc/redis.conf
把gunicorn.conf文件放到python文件夹的根目录下
进入到/root/python/目录下执行以下命令
nohup python3 worker.py > log.log 2>&1 &
nohup gunicorn -c gunicorn.conf main:app -k uvicorn.workers.UvicornWorker > gunicorn.log 2>&1 &