{"id":194,"date":"2015-04-30T22:50:51","date_gmt":"2015-04-30T22:50:51","guid":{"rendered":"http:\/\/tuxlabs.com\/?p=194"},"modified":"2015-04-30T22:54:14","modified_gmt":"2015-04-30T22:54:14","slug":"upgrading-to-python-2-7-on-centos-6-5","status":"publish","type":"post","link":"https:\/\/tuxlabs.com\/?p=194","title":{"rendered":"Upgrading to Python 2.7 on CentOS 6.5"},"content":{"rendered":"<p>Hey Folks,<\/p>\n<p>The systems running\u00a0Tuxlabs are currently running CentOS 6.5 to emulate a production RHEL like setup for an Openstack Cloud. Running an operating system this old has it&#8217;s drawbacks such as dependencies. I was recently installing a well know Python framework and ran into compatibility issues. The framework required Python 2.7 and CentOS 6.5 comes with 2.6. The below is a step by step procedure for how to upgrade to Python 2.7 on CentOS 6.5 if \u00a0you ever should need it. However, as a reminder run a newer OS when possible and for god sakes if you don&#8217;t need Redhat support, run Ubuntu.<\/p>\n<p>Step one, we verify we are indeed running Python 2.6<\/p>\n<pre class=\"lang:default decode:true\">[tuxninja@diamond ~]$ python --version\r\nPython 2.6.6\r\n[tuxninja@diamond ~]$<\/pre>\n<p>Ok then, let&#8217;s\u00a0upgrade Python to 2.7. First let&#8217;s update all of our system applications, just in case for version dependencies and it&#8217;s good for security etc.<\/p>\n<pre class=\"lang:default decode:true\">[tuxninja@diamond ~]$ yum -y update\r\n<\/pre>\n<p>Next, we have to install Develop Tools, it is a required dependency to install Python.<\/p>\n<pre class=\"lang:default decode:true \">[tuxninja@diamond ~]$ yum groupinstall \"Development tools\"<\/pre>\n<p>Additionally, we will need these&#8230;<\/p>\n<pre class=\"lang:default decode:true\">[tuxninja@diamond ~]$ sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel<\/pre>\n<p>Now, let&#8217;s install Python 2.7<\/p>\n<pre class=\"lang:default decode:true\">[tuxninja@diamond ~]$ cd \/opt\r\n[tuxninja@diamond opt]$ sudo wget --no-check-certificate https:\/\/www.python.org\/ftp\/python\/2.7.6\/Python-2.7.6.tar.xz\r\n[tuxninja@diamond opt]$ sudo tar xf Python-2.7.6.tar.xz \r\n[tuxninja@diamond opt]$ cd Python-2.7.6\r\n[tuxninja@diamond Python-2.7.6]$ sudo .\/configure --prefix=\/usr\/local\r\n[tuxninja@diamond Python-2.7.6]$ sudo make &amp;&amp; sudo make altinstall<\/pre>\n<p>It is important to use &#8216;altinstall&#8217; otherwise you will end up with two\u00a0different versions of Python on your filesystem, both named &#8216;python&#8217;.<\/p>\n<p>You can verify the install like so<\/p>\n<pre class=\"lang:default decode:true \">[tuxninja@diamond Python-2.7.6]$ ls -la \/usr\/local\/bin\/python2.7*\r\n-rwxr-xr-x 1 root root 6214493 Apr 30 15:14 \/usr\/local\/bin\/python2.7\r\n-rwxr-xr-x 1 root root    1674 Apr 30 15:14 \/usr\/local\/bin\/python2.7-config\r\n[tuxninja@diamond Python-2.7.6]$ \/usr\/local\/bin\/python2.7 --version\r\nPython 2.7.6\r\n[tuxninja@diamond Python-2.7.6]$<\/pre>\n<p>That&#8217;s it ! Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/tuxlabs.com\/?p=194\" rel=\"bookmark\" title=\"Permalink to Upgrading to Python 2.7 on CentOS 6.5\"><p>Hey Folks, The systems running\u00a0Tuxlabs are currently running CentOS 6.5 to emulate a production RHEL like setup for an Openstack Cloud. Running an operating system this old has it&#8217;s drawbacks such as dependencies. I was recently installing a well know Python framework and ran into compatibility issues. The framework required Python 2.7 and CentOS 6.5 [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8,9],"tags":[46,42,55,44,43,45],"class_list":{"0":"post-194","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-howtos","7":"category-programming","8":"category-python","9":"tag-centos-6-5","10":"tag-gcc","11":"tag-python","12":"tag-python-2-7","13":"tag-python-upgrade","14":"tag-yum","15":"h-entry","16":"hentry"},"_links":{"self":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":2,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}