Redhat6.5-Python2.7及插件安装
# 1.修改环境变量
#echo '****** 1.修改PATH环境变量增加jdk1.7.0_65路径*******'
#echo '
#
#export PATH=/JAVA/jdk1.7.0_65/bin:$PATH
#' >> /etc/profile
#
#source /etc/profile
#echo '成功添加jdk1.7.0_65路径到PATH环境变量'
#java -version
#echo
# 2.解压安装文件
echo '****** 2.解压安装文件*******'
unzip -o installer.zip
chmod 777 -R ./installer
cd installer
echo '成功解压安装文件到路径:'`pwd`
echo
# 3.安装Python2.7
echo '****** 3.开始安装Python2.7 *******'
tar -zxvf 00_Python-2.7.13.tgz
chmod 777 -R ./Python-2.7.13
cd Python-2.7.13
./configure
make all
sudo make install
make clean
make distclean
cd ..
unzip -o ./installer/01_site-packages.zip -d /usr/local/lib/python2.7/site-packages/
echo -n '成功安装'
python2.7 -V
Echo
#pip安装前需要安装一些Redhat缺少的系统包,本环境有自定义的本地yum源
#因此,先执行yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
#此处参考文章: https://www.zhihu.com/question/30279880
# 4.安装pip-9.0.1
echo '****** 4.开始安装pip-9.0.1 *******'
tar -xzvf 02_pip-9.0.1.tar.gz
chmod 777 -R ./pip-9.0.1
cd pip-9.0.1
sudo python2.7 setup.py install
cd ..
echo -n '成功安装'
pip -V
echo
# 5.安装Python模块setuptools-34.4.1
echo '****** 5.开始安装setuptools-34.4.1 *******'
pip install 03_setuptools-34.4.1.zip
echo '成功安装setuptools-34.4.1'
echo
# 6.安装Python模块six-1.10.0
echo '****** 6.开始安装six-1.10.0 *******'
pip install 04_six-1.10.0.tar.gz
echo '成功安装six-1.10.0'
echo
# 7.安装Python模块thrift-0.9.0
echo '****** 7.开始安装thrift-0.9.0 *******'
pip install 05_thrift-0.9.0.tar.gz
echo '成功安装thrift-0.9.0'
echo
# 8.安装Python模块docopt-0.6.2
echo '****** 8.开始安装docopt-0.6.2 *******'
pip install 06_docopt-0.6.2.tar.gz
echo '成功安装docopt-0.6.2'
echo
# 9.安装Python模块bitarray-0.8.1
echo '****** 9.开始安装bitarray-0.8.1 *******'
pip install 07_bitarray-0.8.1.tar.gz
echo '成功安装bitarray-0.8.1'
echo
# 10.安装Python模块impyla-0.14.0
echo '****** 10.开始安装impyla-0.14.0 *******'
pip install 08_impyla-0.14.0.tar.gz
echo '成功安装impyla-0.14.0'
echo
# 11.安装Python模块hdfs-2.0.16
echo '****** 11.开始安装hdfs-2.0.16 *******'
pip install 09_hdfs-2.0.16.tar.gz
echo '成功安装hdfs-2.0.16'
echo
# 12.安装Python模块simplejson-3.10.0
echo '****** 12.开始安装simplejson-3.10.0 *******'
pip install 10_simplejson-3.10.0.tar.gz
echo '成功安装simplejson-3.10.0'
echo
# 13.安装Python模块cx_Oracle-5.3
#echo '****** 13.开始安装PyHDFS-0.1.2 *******'
#export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/client
#pip install 11_cx_Oracle-5.3.tar.gz
#echo '成功安装cx_Oracle-5.3'
#echo
# 14.安装Python模块PyHDFS-0.1.2
echo '****** 14.开始安装PyHDFS-0.1.2 *******'
pip install 12_PyHDFS-0.1.2.tar.gz
echo '成功安装PyHDFS-0.1.2'
echo
# 15.安装Python模块libpyhdfs
echo '****** 15.开始安装libpyhdfs *******'
ln -s /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 /usr/lib64/libhdfs.so.0.0.0
ln -s /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 /usr/lib64/libhdfs.so
unzip 13_libpyhdfs-master.zip
chmod 777 -R ./libpyhdfs-master
cd libpyhdfs-master
/usr/local/bin/python2.7 setup.py install
cd ..
echo '成功安装libpyhdfs'
echo
# 创建目录、设置权限
chmod -R 644 /usr/local/include/python2.7
chmod -R 777 /usr/local/lib/pkgconfig
chmod -R 777 /usr/local/lib/python2.7
exit
cd ..
# 删除临时目录
rm -Rf ./installer
echo
echo
echo '环境部署成功!'
exit 0