CentOS 部署 Python3 的一些注意事项
环境:centos6.7
https://github.com/vinta/awesome-python
https://github.com/PyMySQL/PyMySQL
https://github.com/kennethreitz/requests
http://flask.pocoo.org/
http://flask-json.readthedocs.org/en/latest/
http://www.pythondoc.com/flask-cache/index.html
# json_data=json.dumps(hqs,cls=__default)
# 安装Nginx
yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl--devel pcre pcre-devel
cd /opt
wget http://nginx.org/download/nginx-1.9.14.tar.gz
mkdir nginx
tar zxvf nginx-1.9.14.tar.gz
cd nginx-1.9.14
./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_gzip_static_module
make && make install
# 启动nginx
/opt/nginx/sbin/nginx
# 拷贝文件至远程主机
scp -r //Users/Irving/Desktop/python/stockhq/ root@139.196.185.215:/opt/
scp -r //Users/Irving/Desktop/python/stockhq/data/ root@139.196.185.215:/opt/stockhq/data/
# 升级python3
yum install gcc zlib-devel make
# 下载python
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
解压缩、编译和安装
tar -zxvf Python-3.5.1.tgz
cd Python-3.5.1
./configure –prefix=/opt/python3
make all
make install
清除之前编译的可执行文件及配置文件。
make clean
清除所有生成的文件
make distclean
查看安装的新版本信息
/opt/python3/bin/python3 -V
做个软连接到当前用户的bin目录(注意:如果已安装了puython2.6 先删除执行 rm -rf /usr/bin/python)
ln -s /opt/python3/bin/python3 /usr/bin/python
升级了默认的python导致报错 File “/usr/bin/yum”, line 30
vim /usr/bin/yum #将!/usr/bin/python改成!/usr/bin/python2.6即可。
# 安装pip3
ln -s "/opt/python3/bin/pip3" /usr/local/bin/pip3
# 安装包
pip3 install requests pymysql sqlalchemy flask flask_json simplejson
#安装
yum install supervisor
# 查看配置信息
cat /etc/supervisord.conf
[supervisord]
http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET)
;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700)
;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores)
;umask=022 ; (process file creation umask;default 022)
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (logging level;default info; others: debug,warn)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200) ;nocleanup=true ; (don't clean up tempfiles at start;default false)
;http_username=user ; (default is no username (open system))
;http_password=123 ; (default is no password (open system))
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
;user=chrism ; (default is current user, required if root)
;directory=/tmp ; (default is not to cd during start)
;environment=KEY=value ; (key value pairs to add to environment) [supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor") ; The below sample program section shows all possible program subsection values,
; create one or more 'real' program: sections to be able to control them under
; supervisor. ;[program:theprogramname]
;command=/bin/cat ; the program (relative uses PATH, can take args)
;priority=999 ; the relative start priority (default 999)
;autostart=true ; start at supervisord start (default: true)
;autorestart=true ; retstart at unexpected quit (default: true)
;startsecs=10 ; number of secs prog must stay running (def. 10)
;startretries=3 ; max # of serial start failures (default 3)
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs=10 ; max num secs to wait before SIGKILL (default 10)
;user=chrism ; setuid to this UNIX account to run the program
;log_stdout=true ; if true, log program stdout (default true)
;log_stderr=true ; if true, log program stderr (def false)
;logfile=/var/log/cat.log ; child log path, use NONE for none; default AUTO
;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;logfile_backups=10 ; # of logfile backups (default 10) [root@iZ11fek1j6cZ etc]# cat /etc/supervisord.conf [supervisord]
http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET)
;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700)
;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores)
;umask=022 ; (process file creation umask;default 022)
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (logging level;default info; others: debug,warn)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200) ;nocleanup=true ; (don't clean up tempfiles at start;default false)
;http_username=user ; (default is no username (open system))
;http_password=123 ; (default is no password (open system))
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
;user=chrism ; (default is current user, required if root)
;directory=/tmp ; (default is not to cd during start)
;environment=KEY=value ; (key value pairs to add to environment) [supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor") ; The below sample program section shows all possible program subsection values,
; create one or more 'real' program: sections to be able to control them under
; supervisor. ;[program:theprogramname]
;command=/bin/cat ; the program (relative uses PATH, can take args)
;priority=999 ; the relative start priority (default 999)
;autostart=true ; start at supervisord start (default: true)
;autorestart=true ; retstart at unexpected quit (default: true)
;startsecs=10 ; number of secs prog must stay running (def. 10)
;startretries=3 ; max # of serial start failures (default 3)
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs=10 ; max num secs to wait before SIGKILL (default 10)
;user=chrism ; setuid to this UNIX account to run the program
;log_stdout=true ; if true, log program stdout (default true)
;log_stderr=true ; if true, log program stderr (def false)
;logfile=/var/log/cat.log ; child log path, use NONE for none; default AUTO
;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;logfile_backups=10 ; # of logfile backups (default 10)
# 增加文件
vi /etc/supervisord.conf
[program:stockhq]
command=/opt/stockhq/data/__stockhq.py
directory=/opt/stockhq
autostart=true
autorestart=true
#保存
:qw
# 配置Nginx
#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; gzip on; server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; # location / {
# root html;
# index index.html index.htm;
#}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:8080;
}
location ~*.(js|css)$ {
root /opt/stockhq/data;
expires 1h;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#}
}
Tmux是一个终端复用软件,BSD协议发布。一般用于在一个命令行窗口中访问多个命令行会话
#安装:
yum install tmux (apt-get install tmux)
#基本使用
tmux ls # 显示已有tm(C-b s)
tmux attach-session -t name
tmux new-session -s name
tmux new -s name
tmux kill-session -t name
REFER:
http://unix.stackexchange.com/questions/549/tmux-vs-gnu-screen
CentOS 部署 Python3 的一些注意事项的更多相关文章
- Ubuntu部署python3.5的开发和运行环境
Ubuntu部署python3.5的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用目前最新的 python3.5.1) ,之前的云主机的的默认python ...
- 跳过 centos部署 webpy的各种坑
用centos部署webpy发现的各种坑: 1.python 版本: 2.中文编码: 3.web模块路径: 在命令行里输入python,能import web,但是网站错误报告一直报告没有找到web模 ...
- 【Linux】Centos部署MySQL
将CentOS部署MySQL需要本地配置环境.本地编译MySQL,耗时较长的情况,优化为编译成型MySQL并打包,推送并按配置部署. 首先需要在一台机器配置好环境,搭个YUM源,并将所需要的包取出备用 ...
- Tigase XMPP Server在CentOS部署和配置
Tigase XMPP Server在CentOS部署与配置 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 以下讲述Tigase XMPP Server ...
- ASP.NET MVC 使用MSBuild部署的几个注意事项
ASP.NET MVC 使用MSBuild部署的几个注意事项 做新项目,当时参考NopCommerce的结构,后台Nop.Admin是一个独立的Area Web Site,但部署的时候发现,使用一键发 ...
- deepin系统下部署Python3.5的开发及运行环境
deepin系统下部署Python3.5的开发及运行环境 1 概述 由于最近要学习python接口自动化测试,所以记录一下相关学习经过及经验,希望对大家可以有所帮助. 2 下载 在python官网下载 ...
- Ubuntu部署python3.7的开发和运行环境
Ubuntu部署python3.7的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用 python3.7.1) ,之前的云主机的的默认python版本都面临 ...
- SpringBoot入门教程(二)CentOS部署SpringBoot项目从0到1
在之前的博文<详解intellij idea搭建SpringBoot>介绍了idea搭建SpringBoot的详细过程, 并在<CentOS安装Tomcat>中介绍了Tomca ...
- CentOS7.4部署Python3+Django+uWSGI+Nginx
CentOS7.4部署Python3+Django+uWSGI+Nginx http://www.showerlee.com/archives/2590
随机推荐
- ubuntu 出现device not managed,解决方法
1. 编辑/etc/NetworkManager/NetworkManager.conf: sudo vi /etc/NetworkManager/NetworkManager.conf将其中的man ...
- VIP之Scaler
VIP Scaller II 从以前的时序来看 当把2160p分辨率经过Scaller之后,变换为1080p输出的数据再经过CVO处理之后,输出的帧结构不正常,有效数据组成一个行,无效数据也是 ...
- kepware http接口 nodejs开发
读取某变量的值(native var http = require("http"); var options = { "method": "GET&q ...
- python迭代器实例
1. 迭代器 迭代器是访问集合元素的一种方式.迭代器对象从集合的第一个元素开始访问,知道所有的元素被访问完结束.迭代器只能往前不会后退,不过这也没什么,因为人们很少在迭代途中往后退. 1.1 使用迭代 ...
- linux 下载文件
工作流程 1.tar pczvf file.tar.gz file 2.sz file.tar.gz:下载. 3.rm -i file.tar.gz: 删除.
- C# 使用Queue<T>代替递归算法遍历树
递归时候每次调用自身在堆栈上要记录返回地址,而堆栈的空间很少,调用次数多了后会产生堆栈溢出,以下代码是实际项目中,通过Queue<T>来避免递归算法的代码: /// <summary ...
- RxSwift学习笔记4:disposeBag/scheduler/AnyObserver/Binder
let disposeBg = DisposeBag() //直接在创建 //在 subscribe 方法中创建 let ofObserval = Observable.of("a" ...
- 2.虚拟机安装的ubuntu全屏显示
虚拟机下面安装了ubuntu系统,显示的屏幕只有那么一小块儿,不知道如何才能全屏,那么如何全屏呢?且看下面经验. 方法/步骤 打开虚拟机,并点击要更改成全屏的那个ubuntu系统的电源 我的虚拟机名字 ...
- uniGUI 通过SessionList操作另外的登录用户
参照bbs,写了这个方法,检查是否有同名用户已经登录:procedure TUniMainModule.CheckSameUser(aUserLoginCode: string);var ASess ...
- cxgrid过滤使用心得
uses cxFilter; cxgrid过滤条件清除:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.AutoDataSetFilter:=Tr ...