# yum update
# yum install gcc 用来编译python3.6源码 # yum install lrzsz 用来上传文件
# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
# sudo yum install mysql-server
# chown root /var/lib/mysql/
# service mysqld restart
# mysql -u root -p (回车 无密码登陆) # mysql > use mysql; # mysql > update user set password=password('123456') where user='root'; # mysql > exit;
# service mysqld restart
mysql>use mysql; mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";
[client] default-character-set=utf8 [mysqld] character-set-server=utf8 collation-server=utf8_general_ci
重启mysql服务后才生效javascript
service mysqld restart
查看字符集php
show variables like 'character%';
# 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
# mkdir -p /usr/local/Python3
# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
# tar -zxvf Python-3.6.1.tgz # cd Python-3.6.5 # ./configure --prefix=/usr/local/Python3 # make # make install
# ln -s /usr/local/Python3/bin/python3 /usr/bin/python3
# vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/Python3/bin
# source ~/.bash_profile
# python3 -V # pip3 -V
# pip3 install —-upgrade pip
# pip3 install virtualenv
# mkdir -p /data # mkdir -p /data/pyenv # virtualenv -p /usr/local/Python3/bin/python3 /data/pyenv/
# ln -s /data/pyenv/bin/activate /usr/bin/activate
# source activate
# deactivate
# mkdir -p /data/wwwroot 用来存放项目文件 # pip3 install Django 3 pip3 install pymysql
# python3 manage.py makemigrations # python3 manage.py migrate # python3 mange.py runserver 0.0.0.0:80
# pip3 install uwsgi
# uwsgi --http 0.0.0.0:80 --file maci_proj/wsgi.py --static-map=/static=static
# cd /data/wwwroot/ # mkdir maci 建立项目目录 # cd maci # mkdir script # cd script # vim uwsgi.ini
编写启动文件:css
[uwsgi] # 项目目录 chdir=/data/wwwroot/maci/maci_proj # 指定项目的application module=军民.wsgi:application # 指定sock的文件路径 socket=/data/wwwroot/maci/script/uwsgi.sock # 进程个数 workers=5 pidfile=/data/wwwroot/maci/script/uwsgi.pid # 指定IP端口 http=172.18.43.213:8000 #http=47.106.128.221:80 # 指定静态文件 #static-map=/static=/data/wwwroot/smcic/smcic_pro/static static-map=/static=/data/wwwroot/maci/maci_proj/static # 启动uwsgi的用户名和用户组 uid=root gid=root # 启用主进程 master=true # 自动移除unix Socket和pid文件当服务中止的时候 vacuum=true # 序列化接受的内容,若是可能的话 thunder-lock=true # 启用线程 enable-threads=true # 设置自中断时间 harakiri=30 # 设置缓冲 post-buffering=4096 # 设置日志目录 daemonize=/data/wwwroot/maci/script/uwsgi.log
启动:uwsgi —ini 启动文件名.ini 中止:uwsgi —stop 启动文件名.pid
# vim /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo # 下面这行centos根据你本身的操做系统修改 好比:OS/rehel # 7是你本身Linux系统的版本,能够经过URL查看路径是否正确 baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enable=1
# yum -y install nginx
# nginx
# cd /etc/nginx/conf.d/
# vim xxx.conf
server { # 这个server标识我要配置了 listen 80; # 我要监听那个端口 server_name 47.106.128.221 ; # 你访问的路径前面的url名称 access_log /var/log/nginx/access.log main; # Nginx日志配置 charset utf-8; # Nginx编码 gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php application/json text/json image/jpeg image/gif image/png application/octet-stream; # 支持压缩的类型 error_page 404 /404.html; # 错误页面 error_page 500 502 503 504 /50x.html; # 错误页面 # 指定项目路径uwsgi location / { # 这个location就和我们Django的url(r'^admin/', admin.site.urls), include uwsgi_params; # 导入一个Nginx模块他是用来和uWSGI进行通信的 uwsgi_connect_timeout 30; # 设置链接uWSGI超时时间 uwsgi_pass unix:/data/wwwroot/maci/script/uwsgi.sock; # 指定uwsgi的sock>文件全部动态请求就会直接丢给他 } # 指定静态文件路径 location /static/ { alias /data/wwwroot/maci/maci_proj/static/; #index index.html index.htm; } }
# nginx 启动 # systemctl start nginx.service 启动 # systemctl enable nginx.service 开机自启动 # nginx -s reload 更新配置文件