服务器环境配置
下载安装anaconda
wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
bash Anaconda3-5.3.1-Linux-x86_64.sh
source /root/anaconda3/etc/profile.d/conda.sh
echo “. /root/anaconda3/etc/profile.d/conda.sh” >> ~/.bashrc
conda update conda
创建环境
cd /root/codedir
conda create -n py38 python=3.8
conda env list
conda activate py38
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
更新nodejs
初次拿到服务器 node版本可能不是最新的 建议更新一下。
下载npm
apt-get update
apt install npm
更新nodejs 并且查看版本
sudo npm install -g n
sudo n stable
node -v
安装pm2
apt-get update
apt install npm
npm install pm2 -g
后台模式运行
nohup python -u startup.py > output.txt 2>&1 &
查询进程
pgrep -f startup.py
杀死进程
kill -9 xxx
pm2 运行
pm2 start startup.json
pm2 status
pm2 delete {id}