Centos6.5安装python3.5+pip3配合walle部署测试环境

作者: admin 分类: 运维那些事 发布时间: 2017-06-16 15:46

目标

由于使用第三方walle部署系统,测试机器使用虚拟机,性能差,故测试服务器使用新机器

安装环境

Centos6.5+python3.5.2+pip3

安装步骤

安装python3

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xf Python-3.5.0.tgz
cd Python-3.5.0
./configure --prefix=/usr/local --enable-shared #出现问题,参考下文
make
make install

configure后出错解决

 configure: error: no acceptable C compiler found in $PATH

解决办法:

# yum install gcc #安装GCC软件套件

安装pip3

[root@testServer2 pip-1.5.5]# python3 setup.py install#出错,安装setuptools

[root@testServer2 setuptools-36.0.1]# python3 setup.py install

......
RuntimeError: Compression requires the (missing) zlib module

安装zlib

[root@testServer2 setuptools-36.0.1]# yum install zlib-devel
[root@testServer2 setuptools-36.0.1]# yum install zlib
Setting up Install Process
Package zlib-1.2.3-29.el6.x86_64 already installed and latest version
Nothing to do

[root@testServer2 ~]# wget http://www.zlib.net/zlib-1.2.11.tar.gz

# tar zxvf zlib-1.2.8.tar.gz
# cd zlib-1.2.8

# ./configure --prefix=/usr/local/zlib

# make && make install

#重新编译安装python3
# make && make install

#安装成功setuptools
[root@testServer2 setuptools-36.0.1]# python3 setup.py install

.....
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-36.0.1-py3.5.egg
Copying setuptools-36.0.1-py3.5.egg to /usr/local/lib/python3.5/site-packages
Adding setuptools 36.0.1 to easy-install.pth file
Installing easy_install-3.5 script to /usr/local/bin
Installing easy_install script to /usr/local/bin

Installed /usr/local/lib/python3.5/site-packages/setuptools-36.0.1-py3.5.egg
Processing dependencies for setuptools==36.0.1
Finished processing dependencies for setuptools==36.0.1


安装openssl,openssl-devel

出现错误

ImportError: cannot import name HTTPSHandler

原因在于openssl,openssl-devel两个文件包未正确安装。用下来的命令来安装:

yum install openssl -y
yum install openssl-devel -y

重新编译Python3,再重新安装pip3!

walle相关配置

ssh信任

#当前机器
[root@testServer2 /]# useradd www
[root@testServer2 /]# passwd www
[root@testServer2 /]# su www
#walle安装机器
[www@TestServer .ssh]$ scp -r id_rsa.pub www@192.168.1.251:/home/www/.ssh/authorized_keys

#当前机器
[www@testServer2 .ssh]$ ls -ll
总用量 12
-rw-r--r--. 1 www www  396 6月  16 19:26 authorized_keys
-rw-------. 1 www www 1675 6月  16 19:23 id_rsa
-rw-r--r--. 1 www www  397 6月  16 19:23 id_rsa.pub

上线单报错

Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!

解决办法:

[root@testServer2 ~]# yum install libselinux-python -y #部署机器安装

安装Pillow报错:

The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

解决办法:

yum install python-devel
yum install libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-devel
yum install python-imaging

参考:http://www.cnblogs.com/ccdc/p/4069112.html
参考官方文档没有给出解决方案:http://pillow.readthedocs.io/en/latest/installation.html

开放80端口

#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#/etc/rc.d/init.d/iptables save
(完)

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注