Flask 之linux部署
1.装python >
`[root ~]# yum install gcc
[root ~]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
[root ~]# gunzip Python-3.6.5.tgz
[root ~]# tar -xvf Python-3.6.5.tar
[root ~]# cd Python-3.6.5
[root ~]# ./configure --prefix=/usr/local/python36 --enable-optimizations
[root ~]# 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
[root ~]# make && make install
...
[root ~]# ln -s /usr/local/python36/bin/python3.6 /usr/bin/python3
[root ~]# python3 --version
Python 3.6.5
这里可能需要手动配置pip软连接:
ln -s /usr/local/python36/bin/pip /usr/bin/pip
ln -s /usr/local/python36/bin/pip3 /usr/bin/pip3
[root ~]# python3 -m pip install -U pip
[root ~]# pip3 --version
`
2.装nginx
yum -y install nginx
设置nginx自启动
3.装redis
'
[root ~]# wget http://download.redis.io/releases/redis-3.2.12.tar.gz
[root ~]# gunzip redis-3.2.12.tar.gz
[root ~]# tar -xvf redis-3.2.12.tar
[root ~]# cd redis-3.2.12
[root ~]# make && make install
[root ~]# redis-server --version
Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=5bc5cd3c03d6ceb6
[root ~]# redis-cli --version
redis-cli 3.2.12'
4.安装git
yum -y install git
5.安装docker
参考:
https://www.cnblogs.com/zhangyinhua/p/10286507.html
*5.1 docker 镜像构建
*5.2 项目根目录新建 *.dockerfile
*5.3 docker镜像文件built
sudo docker build -t $tag_name -f $dockerfile_name
*5.4 docker镜像文件推送到远程仓库
'docker push coilan/confsrv:tagname'