centos
使用 yum 管理包
yum update
sudo yum install yum-utils
yum install python3
Ubuntu 16.04
一条命令安装python3.7
https://blog.csdn.net/jaket5219999/article/details/80894517(没有用了)
https://blog.csdn.net/qq_35933777/article/details/84325856(编译十几分钟 ./configure 生成编译文件)
pip3的问题 /usr/bin/文件夹下的pip3文件
将原来的:
from pip import main
if name == ‘main‘:
sys.exit(main())
改成:
from pip import main
if name == ‘main‘:
sys.exit(main._main())
https://blog.csdn.net/tintinetmilou/article/details/80091630
mysql
https://blog.csdn.net/weixx3/article/details/80782479
apt-get update
apt-get install screen
apt-get install git
apt install python3-pip
sudo apt-get remove python3
apt-get install python3
sudo apt-get install python3-pip
apt-get install mysql-server
创建数据库
进入数据库 基础教程https://www.jianshu.com/p/3e399c76b132
mysql -uroot -p
show databases;// 查看当前数据库
create DATABASE RUNOOB; //创建一个名为 RUNOOB的数据库
跑python flask项目
git clone..
cd ...
pip3 install -r requirements.txt
跑80端口服务:python3 main.py runserver -h 0.0.0.0 -p 80
常用命令
ps命令查找与进程相关的PID号:
ps a 显示现行终端机下的所有程序,包括其他用户的程序。
kill 杀死线程
screen -S name #创建一个窗口,并且为这个窗口命名
screen -ls #可以查看已创建的所有窗口
apt autoremove
没有MYSQLdb
sudo apt-get install libmysqlclient-dev
pip3 install mysqlclient
apt-get install mysql-server
raise EnvironmentError(“%s not found” % (_mysql_config_path,)) OSError: mysql_config not found
修改 mysql 中文编码问题
show variables like ‘%char%’;
set character_set_server=utf8;
set character_set_database=utf8;
show variables like ‘%char%’;
中文编码问题
https://blog.csdn.net/luoweifu/article/details/8832492
create DATABASE yqy CHARACTER SET ‘utf8’ COLLATE ‘utf8_general_ci’;
react 项目 build 与上传
sudo scp -i ~/yqy.pem -r ./build/* root@59.110.237.244:/var/www/html
nginx
$ sudo yum -y install nginx # 安装 nginx
$ sudo yum remove nginx # 卸载 nginx
检测两个目录下的东西
include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/;
server {
# server_name abc.test.com;
listen 80;
location / {
root /var/www/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /api {
proxy_pass http://127.0.0.1:8088/api;
}
}
Nginx 测试
nginx -t
nginx -s reload 重启
基础配置
https://juejin.cn/post/6844903575210967048#heading-15
80 端口问题
https://serverfault.com/questions/842492/nginx-duplicate-listen-options-for-80-error/842515
https://stackoverflow.com/questions/14972792/nginx-nginx-emerg-bind-to-80-failed-98-address-already-in-use