环境: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. SpringBoot初探

    一:项目创建 个人用的是IDEA来做Demo的: 1.先创建一个空项目,然后创建一个基于Maven的java application项目: 2.创建好后配置pom.xml文件并最终reimport & ...

  2. php 16进制颜色代码转换为rgba,rgb格式

    <?php $rgb = hex2rgba('#FFFFFF', false, true); echo 'rgb: '.$rgb[0].','; echo $rgb[1].','; echo $ ...

  3. altera FIFO知识点

    虽然是很常用的IP,但经常用时还要看下文档,某些知识点如果能记住的话,还是可以节省很多时间的.   (1)输入输出位宽不相等 这里以输入16位数据输出为8位数据为例,写入两16位的数据,读出4个8位的 ...

  4. NoSQL世界的几个重要理论

    和所有事物一样,NoSQL的兴起也是由许多理论支撑作为前提的,正是由下面一些理论的支撑,NoSQL的方向才能如此明朗. 1.CAP理论 CAP理论无疑是导致技术趋势由关系数据库系统向NoSQL系统转变 ...

  5. Java学习--数组的定义和使用

    1. 数组分配了空间,未赋值 public class ArrayDemo01{ public static void main(String args[]){ int score[] = null ...

  6. 索引视图DEMO1

    --use tempdb ----------------------在创建视图和所有底层表时,必须打开ANSI_NULLS以及QUOTED_IDENTIFIER选项 --SET ANSI_NULLS ...

  7. C#基础——C#中问号的使用

    1. 可空类型修饰符(?): 引用类型可以使用空引用表示一个不存在的值,而值类型通常不能表示为空. 例如:string str=null; 是正确的,int i=null; 编译器就会报错. 为了使值 ...

  8. 一不小心发现了个Asp.Net Bug

    1. Ver是页面定义的变量 2. asp.net 页面定义为  <link href="/company/them/page.css?v=<%=Ver%>" r ...

  9. [leetcode.com]算法题目 - Gray Code

    The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...

  10. 【Java基础】反射和注解

    前言 在Java中,反射机制和注解机制一直是一个很重要的概念,那么他们其中的原理是怎么样呢,我们不仅仅需要会使用,更要知其然而之所以然. 目录 反射机制 反射如何使用 注解定义 注解机制原理 注解如何 ...