Installing Python 2.7.9 or higher on Linux

Install Python 2.7.9 or higher (but lower than Python 3) to run Guardium® Application Framework SDK on the Linux operating system.

About this task

Procedure

  1. Log in as root or use sudo.
  2. Verify your system is up to date: yum update
  3. Install development tools: yum groupinstall -y "development tools"
  4. Install development tools and extra libraries (not strictly needed to compile Python but required for the Python interpreter):
    • Ubuntu: yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel
    • CentOS: yum install -y zlib-devel, openssl-devel, openssl, libffi-devel
  5. If you have a clean "minimal" install of CentOS, install the wget tool: yum install -y wget
  6. Download, compile and install Python.
    # Python 2.7.0:
    wget http://python.org/ftp/python/2.7.0/Python-2.7.0.tar.xz
    tar xf Python-2.7.0.tar.xz
    cd Python-2.7.0
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    make && make altinstall
    The newly installed Python interpreter is available as /usr/local/bin/python2.7. The system version of Python 2.6.6 continues to be available as /usr/bin/python, /usr/bin/python2 and /usr/bin/python2.6.
  7. To strip symbols from the shared library to reduce the memory footprint, enter: strip /usr/local/lib/libpython2.7.so.1.0
  8. Make sure Python command points to the latest Python you installed. Then, to make the latest Python installation the default Python engine, run source ~/.bash_profile