Tuesday, June 28, 2016

Running GSUtil 4.19 on Python 2.7 on Centos 6.6

This post is a reminder of how to install and  run gsutil on Centos 6.6 running python 2.7

Introduction

just a note so all the technical things below make sense:
- gsutil a python application that lets you access Cloud Storage from the command line, I use this to download google playstore data and statistics.
- python is a widely used high-level, general-purpose, interpreted, dynamic programming language
- Centos is Community ENTerprise Operating System. A free rebuild of source packages from the Red Hat Enterprise Linux

By default Centos 6.6 is shipped with python 2.6 which shows the following reminder when you run gsutil 4.19

Warning: You are running Python 2.6, which stopped receiving security
patches as of October 2013. gsutil will stop supporting Python 2.6 on
September 1, 2016. Please update your Python installation to 2.7 to
ensure compatibility with future gsutil versions

Install python 2.7 on Centos 6.6

Centos 6.6 has many tools and process which runs above python 2.6, so its not wise to thoroughly uninstall python 2.6 because some tools and process can be broken. What we're going to do is to install python 2.7 which runs in parallel with python 2.6


wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs2 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

There will be many sample on the internet which suggest to --enable-unicode=ucs4, but somehow gsutil is not compatible with it. When you're done, you can run python 2.7 from /usr/local/bin/python2.7, after you reboot the computer even using python command it will by default run python 2.7.

Install gsutil

you can get latest gsutil on https://pypi.python.org/pypi/gsutil
just download and extract it
then you can run it with ./gsutil, which will show the following message
[user@servername ~]$ /home/gsutil --version
gsutil version: 4.19

Since this notes does not discuss about how to use gsutil, here's some good gsutil tutorial


No comments :

Post a Comment