虽然以前安装过但是没有记录,这次重新安装,趁机记录下来,省得满世界地找
环境: centos7
安装nginx
参考资料
使用yum list nginx会发现nginx是1.6的版本,但现在nginx已经到了1.9,虽然不必那么新,
但是过旧的版本说不定会出现安全问题
1# vim /etc/yum.repos.d/nginx.repo
输入
1[nginx]
2name=nginx repo
3baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
4gpgcheck=0
5enabled=1
然后
1# yum list nginx #你会发现nginx已经是1.8的版本
2# yum install nginx
3# systemctl start nginx #启动nginx
安装python3
centos7默认安装了python2.7的版本,但我习惯用python3,但是centos无法通过yum install python3安装, 只好自己编译了
安装必要的文件
1# yum groupinstall "Development tools"
2# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
3readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
下载python3源码
python3已到的python3.5,请按自己的需求下载
1$ wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
2$ tar xz Python-3.4.4.tgz
3$ cd Python-3.4.4
4$ ./configure
5$ make
6# make install
如果提示c 编译器未找到
yum install gcc gcc-c++
安装supervisor
编译安装python3的时候python3-pip就已经安装好了
1# pip3 install supervisor
2Collecting supervisor
3 Downloading supervisor-3.2.0.tar.gz (409kB)
4 100% |################################| 413kB 972kB/s
5 Complete output from command python setup.py egg_info:
6 Supervisor requires Python 2.4 or later but does not work on any version of Python 3. You are using version 3.4.4 (default, Jan 6 2016, 11:01:55)
7 [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]. Please install using a supported version.
8
9 ----------------------------------------
10Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qp0f7ft9/supervisor
报错,错误提示很明显,supervisor不支持python3
安装python2的pip
1# yum install python-pip
2# yum install python-devel #最好把这个也装上,以后会用到的
3# pip install supervisor # 这里又有一个提示
4You are using pip version 7.1.0, however version 7.1.2 is available.
5You should consider upgrading via the 'pip install --upgrade pip' command.
6# pip install --upgrade pip
安装python的虚拟环境virtualenv
1# pip3 install virtualenv
2$ mkdir www
3$ cd www
4$ virtualenv-3.4 venv
5Using base prefix '/usr/local'
6New python executable in venv/bin/python3.4
7Also creating executable in venv/bin/python
8Installing setuptools, pip, wheel...done.
建议在~/.bashrc中添加
1alias ve='. venv/bin/activate'
以后只要使用ve就能进入虚拟环境
关于数据库的安装请参考我的另一篇文章postgresql学习1——安装
知识共享署名-非商业性使用-相同方式共享4.0国际许可协议