Friday, July 19, 2013

Compile Python2.7 on CentOS 6

[ These steps may work on CentOS 5.*  too]

Prepare your OS for it

$ sudo yum groupinstall "Development tools"

$ sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel

Now Download python 2.7 at any location [say make a directory name py in your home directory]
$ wget
Unzip it:
$ tar xf Python-2.7.5.tar.bz2
Change directory:
$ cd Python-2.7.5
inside Python-2.7.5 directory run these command one by one:
$ ./configure --prefix=/usr/local
$ make

when make command finishes at the end you will see something like this:
Python build finished, but the necessary bits to build these modules were not found:
bsddb185           dl           imageop
To find the necessary bits, look in in detect_modules() for the module's name.
NOTE: sunaudiodev is for Sun platforms,dl for 32bit platforms, imageop is deprecated and bsddb185 is undocumented.

$ sudo make altinstall

** you must use [make altinstall] otherwise you will corrupt the system
(CentOS comes with python 2.6 and yum is dependent on it if you use [make install] it will replace python 2.6 and yum may not work)

to test your installation run this command:
$ python2.7

list open ports and unix sockets

To do this I use netstat command to list all open ports: $ sudo netstat -tuplen to list open ports and unix sockets: $ sudo netstat -...