安装python3
1、wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz2
2、yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
3、tar -zxvf Python-3.6.6.tgz
4、cd Python-3.6.6
5、make && make install
6、vim ~/.bashrc
7、export PATH=/opt/python36/bin:$PATH
8、source ~/.bashrc
9、echo $PATH
10、pyhon3
安装pip
1、wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
2、tar -zxvf setuptools-19.6.tar.gz
3、cd setuptools-19.6
4、python3 setup.py build
5、python3 setup.py install
6、wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
7、tar -zxvf pip-8.0.2.tar.gz
8、cd pip-8.0.2
9、python3 setup.py build
10、python3 setup.py install
11、ln -s /usr/local/python3/bin/pip /usr/bin/pip
12、pip -V
13、pip install --upgrade pip
14、pip install -r requirement.txt
安装nginx CentOS7安装Nginx - boonya - 博客园
1、wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
2、tar -zxvf nginx-1.12.0.tar.gz
3、cd nginx-1.12.0
4、./configure
5、make
6、make install
7、cd /usr/local/nginx/sbin/
8、启动./nginx 停止./nginx -s stop 退出./nginx -s quit 重启./nginx -s reload
9、杀进程 lsof -i:8080
nginx网站目录:/usr/local/nginx/html
配置文件目录:vim /usr/local/nginx/conf/nginx.conf
413 to large:client_max_body_size 10m;
#------------------------------------分割线 下面是负载均衡配置 --------------------------------
# 负载均衡配置内容 upstream xxx 需要和下面 http://xxx 一致
# 例如 upstream test = http://test;
upstream test{
# 配置格式: server IP地址:端口号 weight=X (weight总数为10,自己配置即可)
server 127.0.0.1:8020 weight=3;
# 第二个服务配置最好写内网地址
server 170.168.1.125:8030 weight=7;
}
location / {
# 注意这里的名字要和 负载均衡的名字保持一致 upstream 后面为 test,
# 所以这里也是 upstream test
proxy_pass http://test;
proxy_redirect off;
# 这里配置的是转发的真实变量
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
安装mysql
1、wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、yum -y install mysql57-community-release-el7-10.noarch.rpm
3、yum -y install mysql-community-server
4、systemctl start mysqld.service
5、systemctl status mysqld.service
6、mysql -uroot -p123456 db_name < \data\yzl_oa1.sql
vi /etc/my.cnf
在[mysqld]下加上 skip-grant-tables,如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
重启mysql
service mysqld restart
登陆mysql后就可以修改密码了
mysql -u root
update mysql.user set authentication_string=PASSWORD(‘123456’) where User=‘root’;
flush privileges;
然后改回my.cnf重启mysql。
redis安装
1、cd /usr/local/src
2、wget http://download.redis.io/releases/redis-4.0.9.tar.gz
3、tar zxf redis-4.0.9.tar.gz
4、cd src
5、./redis-server 开启服务
6、./redis-cli 进入数据库
7、ping
8、set name "lisi"
9、get name
10、退出src目录 vim redis.conf
11、修改进程,no改为yes
12、后台启动 ./redis-server ../redis.conf
git安装
1、yum -y install git
2、ssh-keygen -t rsa -C “xxxxx@xxxxx.com”
3、cat ~/.ssh/id_rsa.pub
4、将它添加到码云,添加地址 https://gitee.com/profile/sshkeys
5、git clone git@gitee.com:vvfar/yzl_oa.git
启动项目
1、mysql 8.0不兼容
pip install MySQL-connector-python
2、pip install gunicorn
3、gunicorn --workers=5 server_linux:app -b 0.0.0.0:8000 &
4、结束进程 PS
5、kill PID
6、字体文件目录 /usr/share/fonts/dejavu
nginx+gunicorn
1、修改nginx下conf,增加以下内容
####增加##############
server {
listen 80;
server_name 1.116.218.162;
location / {
proxy_pass http://0.0.0.0:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
alias /root/WWW/YZL_OA3.7/static;
}
}
2、cd /usr/local/nginx/sbin/
3、./nginx -s reload