CentOS6 Python2.6升级2.7

在给webserver安装Let’s Encrypt SSL证书时,遇到了错误

Failed to find apachectl in PATH: /usr/local/nginx/sbin:/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
  1. 经查询,是Python版本低于2.7的原因。因此在安装SSL证书前,要先升级Python查看当前Python版本
    • #python -V Python 2.6.6
  2. 下载Python-2.7.11
    • wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
  3. 解压并进入目录
    • tar zxvf Python-2.7.11.tgz cd
    • Python-2.7.1
  4. 编译安装
    • ./configure
      make all
      make install
      make clean
      make disclean
  5. 查看安装后版本
    • /usr/local/bin/python2.7 -V
      Python 2.7.11
  6. 建立软连接,使系统默认的 python指向 python2.7
    • mv /usr/bin/python /usr/bin/python2.6.6
      ln -s /usr/local/bin/python2.7 /usr/bin/python
      python -V
      Python 2.7.11

升级会引起yum挂掉,需要谨慎