wiki:PyGammaHowToSetUpCentOs

Version 1 (modified by flip, 3 years ago) (diff)

--

CentOS 5.11 Setup

This document describes how I set up CentOS 5.11 to build Linux PyGamma wheels. I used CentOS as a VirtualBox guest.

This document makes no distinction between 32- and 64-bit Linux. The instructions are the same for each. If you want to build 32-bit PyGamma wheels, you need 32-bit CentOS. If you want to build 64-bit PyGamma wheels, you need 64-bit CentOS. It's probably possible to build 32-bit binaries on the 64-bit platform, but I haven't worked out how.

Support

CentOS 5.x will be supported until 31 March, 2017 according to the CentOS FAQ https://wiki.centos.org/FAQ/General.

Installation

I downloaded the ISO and installed as one normally does under VirtualBox. During the installation, I opted to disable SELinux.

Post-Install Configuration

On the first reboot after installation was complete, CentOS will update itself with the latest patches.

Next, you'll want to install VirtualBox guest additions to make the guest OS easier to use. In order to do that, you first have to add yourself to the sudoers file.

Adding Yourself to sudoers

  1. su -
  2. vim /etc/sudoers
  3. At the end of the file, add this line: your_username ALL=(ALL) ALL
  4. Save the file with :wq!
  5. Type exit to exit the su - shell.

Building VirtualBox Guest Additions

First, install GCC --

sudo yum install gcc

Next --

  1. Insert the Guest Additions CD.
  2. Start a terminal and cd /media/VBOXADDITIONS_xxxx. Note that the exact name of the VBOXADDITIONS directory changes with each each version of VirtualBox.
  3. sudo ./VBoxLinuxAdditions.run
  4. Eject the Guest Additions CD and reboot.

Adding Packages

Install the things you'll need to build Python and swig, and to use pip --

sudo yum install xz zlib zlib-devel openssl-devel pcre-devel gcc-c++

Building Python

CentOS 5.11 comes with Python 2.4. To use a newer Python, download and untar the source code for the Python you want to use and then build it. For the Python 2.7.11 source that I used, I built with these steps --

sudo ./configure --enable-unicode=ucs4
sudo make altinstall

Using UCS4 (as opposed to the default UCS2) during the configure step is important. See here for details: https://www.python.org/dev/peps/pep-0513/#ucs-2-vs-ucs-4-builds

make altinstall tells Python to install itself in such a way that it doesn't interfere with the default (system) Python.

Once my Python was built, I added a symlink to make it the default Python in my shell --

sudo ln -s /usr/local/bin/python2.7 /usr/local/bin/python

At this point, if you start a new terminal and type python, you should get Python 2.7.11.

Download and Install pip

  1. wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
  2. sudo python get-pip.py

This also installs setuptools and wheel, both of which we need.

Download and Build SWIG

  1. Download and untar the SWIG source code. I was able to use the latest (3.0.8 as of this writing).
  2. Build with sudo ./configure && sudo make && sudo make install