环境: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 的一些注意事项的更多相关文章

  1. Ubuntu部署python3.5的开发和运行环境

    Ubuntu部署python3.5的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用目前最新的 python3.5.1) ,之前的云主机的的默认python ...

  2. 跳过 centos部署 webpy的各种坑

    用centos部署webpy发现的各种坑: 1.python 版本: 2.中文编码: 3.web模块路径: 在命令行里输入python,能import web,但是网站错误报告一直报告没有找到web模 ...

  3. 【Linux】Centos部署MySQL

    将CentOS部署MySQL需要本地配置环境.本地编译MySQL,耗时较长的情况,优化为编译成型MySQL并打包,推送并按配置部署. 首先需要在一台机器配置好环境,搭个YUM源,并将所需要的包取出备用 ...

  4. Tigase XMPP Server在CentOS部署和配置

    Tigase XMPP Server在CentOS部署与配置 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 以下讲述Tigase XMPP Server ...

  5. ASP.NET MVC 使用MSBuild部署的几个注意事项

    ASP.NET MVC 使用MSBuild部署的几个注意事项 做新项目,当时参考NopCommerce的结构,后台Nop.Admin是一个独立的Area Web Site,但部署的时候发现,使用一键发 ...

  6. deepin系统下部署Python3.5的开发及运行环境

    deepin系统下部署Python3.5的开发及运行环境 1 概述 由于最近要学习python接口自动化测试,所以记录一下相关学习经过及经验,希望对大家可以有所帮助. 2 下载 在python官网下载 ...

  7. Ubuntu部署python3.7的开发和运行环境

    Ubuntu部署python3.7的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用 python3.7.1) ,之前的云主机的的默认python版本都面临 ...

  8. SpringBoot入门教程(二)CentOS部署SpringBoot项目从0到1

    在之前的博文<详解intellij idea搭建SpringBoot>介绍了idea搭建SpringBoot的详细过程, 并在<CentOS安装Tomcat>中介绍了Tomca ...

  9. CentOS7.4部署Python3+Django+uWSGI+Nginx

    CentOS7.4部署Python3+Django+uWSGI+Nginx http://www.showerlee.com/archives/2590

随机推荐

  1. 微信小程序之下拉加载和上拉刷新

    微信小程序下拉加载和上拉刷新两种实现方法 方法一:onPullDownRefresh和onReachBottom方法实现小程序下拉加载和上拉刷新 首先要在json文件里设置window属性       ...

  2. oss+上传文件夹

    最近公司做工程项目,实现文件夹云存储上传. 网上找了一天,发现网上很多代码都存在相似问题,最后终于找到了一个满足我需求的项目. 工程如下: 这里对项目的文件夹传输功能做出分析,怎么实现文件夹上传的,如 ...

  3. DataGuard 配置须知

    风不停,绿树荫,阳光晃眼,天真蓝,我们在奔跑,沿着斜阳,是你喘息,起伏不停...  ——朴树 1.确认primary库处于归档模式 命令:archive log list; 如果没有启用归档,请先将数 ...

  4. 笔记本真机安装centos7

    突然有一天,想要装linux系统,所以就是去装,网上百度说的都很多,而且说来说去都是那几篇,大同小异,所以想通过自己本次装真机的一些经验提供给各位朋友参考一下. 一安装系统: 1先制作启动盘,用个比较 ...

  5. windows类型

    _IN_ 输入型参数  _OUT_ 输出型参数 typedef unsigned long DWORD;//double wordtypedef int BOOL;//因为cpu原因4字节的int运行 ...

  6. Hdu2255 奔小康赚大钱(二分图最大权匹配KM算法)

    奔小康赚大钱 Problem Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子. 这可是一件大事,关系到人民的住房问题啊.村里共有n间房间,刚好 ...

  7. hadoop两大核心之一:MapReduce总结

    MapReduce是一种分布式计算模型,由Google提出,主要用于搜索领域,MapReduce程序 本质上是并行运行的,因此可以解决海量数据的计算问题. MapReduce任务过程被分为两个处理阶段 ...

  8. 怎样去写线程安全的代码(Java)

    使用多线程就可能会存在线程安全的问题.很多 java 程序员对写多线程都很挣扎,或者仅仅理解那些是线程安全的代码,那些不是.这篇文章我并不是详述线程安全,详述同步机制的文章,相反我只是用一个简单的非线 ...

  9. caffe 训练imagenet

    1.整理得到自己的数据库,并生成自己数据库的列表文件.txt 2.将数据库转成lmbp格式 3.计算图像均值 4.修改网络参数 5.得到结果 1.整理得到自己的数据库 因为前面博文提到的原因,技术水平 ...

  10. cnn的说明

    概述 前面的练习中,解决了一些有关低分辨率图像的问题,比如:小块图像,手写数字小幅图像等.在这部分中,我们将把已知的方法扩展到实际应用中更加常见的大图像数据集. 全联通网络 在稀疏自编码章节中,我们介 ...