How to install Google Cloud SDK in CentOS6 without breaking things
The long and short of it is that Python 2.6 is no longer supported. While RedHat will obviously continue to backport security fixes for a while, developers have to also consider this when they write their code. RHEL/CentOS are consumed by people who dont want the rug pulled out from under them with a huge change. Upgrading from Python 2.6 to 2.7 can actually break some things. As such, they likely wont ever upgrade it within version 6.
Okay, so I just can’t use the google cloud sdk in CentOS6? I didn’t say that. Besides, I am always up for a challenge.
We have a few options here.
- We can upgrade the system Python from 2.6 to 2.7 and cross our fingers.
- This usually isnt a realistic option for most businesses. The reason being, the outcome is kind of unpredictable. It all depends on what you have installed, and whether it will work under Python 2.7.
- We can install the Python 2.7 binary with an alternate name.
- This is a pretty good alternative, and it gets us about half way there. But we just need to be able to ensure we dont cross our libraries between the two versions. There has to be a better way.
- We can install it in an alternate location entirely, and use our bashrc to change it per session.
- This seems like the ideal solution. Our changes will only exist within our sessions, and we install in an alternate location. We can make it relatively permanent by putting it in our users .bashrc.
Since we are going with option 3, we need to start by installing the EPEL Repository. Then, using the EPEL Repository to install the CentOS-SCL Repository. From there, we can install the SCL build of Python2.7, which will put it in /opt, with a rather clever way to enable it.
Install EPEL
[root@c95d49d56cde /]# yum -y update
Loaded plugins: fastestmirror, ovl
Setting up Update Process
Determining fastest mirrors
* base: mirror.oss.ou.edu
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
No Packages marked for Update
[root@c95d49d56cde /]# yum -y install epel-release
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
epel-release noarch 6-8 extras 14 k
Transaction Summary
=================================================================================================================================================================================================
Install 1 Package(s)
Total download size: 14 k
Installed size: 22 k
Downloading Packages:
epel-release-6-8.noarch.rpm | 14 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : epel-release-6-8.noarch 1/1
Verifying : epel-release-6-8.noarch 1/1
Installed:
epel-release.noarch 0:6-8
Complete!
[root@c95d49d56cde /]#
Install CentOS SCL Repository
[root@c95d49d56cde /]# yum install centos-release-scl
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* epel: pubmirror1.math.uh.edu
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
Resolving Dependencies
--> Running transaction check
---> Package centos-release-scl.noarch 10:7-3.el6.centos will be installed
--> Processing Dependency: centos-release-scl-rh for package: 10:centos-release-scl-7-3.el6.centos.noarch
--> Running transaction check
---> Package centos-release-scl-rh.noarch 0:2-3.el6.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
centos-release-scl noarch 10:7-3.el6.centos extras 12 k
Installing for dependencies:
centos-release-scl-rh noarch 2-3.el6.centos extras 12 k
Transaction Summary
=================================================================================================================================================================================================
Install 2 Package(s)
Total download size: 24 k
Installed size: 39 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): centos-release-scl-7-3.el6.centos.noarch.rpm | 12 kB 00:00
(2/2): centos-release-scl-rh-2-3.el6.centos.noarch.rpm | 12 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 309 kB/s | 24 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : centos-release-scl-rh-2-3.el6.centos.noarch 1/2
Installing : 10:centos-release-scl-7-3.el6.centos.noarch 2/2
Verifying : centos-release-scl-rh-2-3.el6.centos.noarch 1/2
Verifying : 10:centos-release-scl-7-3.el6.centos.noarch 2/2
Installed:
centos-release-scl.noarch 10:7-3.el6.centos
Dependency Installed:
centos-release-scl-rh.noarch 0:2-3.el6.centos
Complete!
[root@c95d49d56cde /]#
Install Python2.7
[root@c95d49d56cde /]# yum --enablerepo=centos-scl* install python27
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* epel: fedora-epel.mirror.lstn.net
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
centos-sclo-rh | 2.9 kB 00:00
centos-sclo-rh/primary_db | 1.2 MB 00:00
centos-sclo-rh-debuginfo | 2.9 kB 00:00
centos-sclo-rh-debuginfo/primary_db | 175 kB 00:00
centos-sclo-rh-source | 2.9 kB 00:00
centos-sclo-rh-source/primary_db | 963 kB 00:00
centos-sclo-rh-testing | 3.0 kB 00:00
centos-sclo-rh-testing/primary_db | 3.1 MB 00:00
centos-sclo-sclo | 2.9 kB 00:00
centos-sclo-sclo/primary_db | 149 kB 00:00
centos-sclo-sclo-debuginfo | 2.9 kB 00:00
centos-sclo-sclo-debuginfo/primary_db | 175 kB 00:00
centos-sclo-sclo-source | 2.9 kB 00:00
centos-sclo-sclo-source/primary_db | 80 kB 00:00
centos-sclo-sclo-testing | 2.9 kB 00:00
centos-sclo-sclo-testing/primary_db | 197 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package python27.x86_64 0:1.1-25.el6 will be installed
--> Processing Dependency: python27-runtime for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-wheel for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-werkzeug for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-virtualenv for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-sqlalchemy for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-sphinx for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-simplejson for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-setuptools for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-pip for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-nose for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python-jinja2 for package: python27-1.1-25.el6.x86_64
--> Processing Dependency: python27-python for package: python27-1.1-25.el6.x86_64
--> Running transaction check
---> Package python27-python.x86_64 0:2.7.13-3.el6 will be installed
--> Processing Dependency: python27-python-libs(x86-64) = 2.7.13-3.el6 for package: python27-python-2.7.13-3.el6.x86_64
--> Processing Dependency: libpython2.7.so.1.0()(64bit) for package: python27-python-2.7.13-3.el6.x86_64
---> Package python27-python-jinja2.noarch 0:2.6-10.sc1.el6 will be installed
--> Processing Dependency: python27-python-babel >= 0.8 for package: python27-python-jinja2-2.6-10.sc1.el6.noarch
--> Processing Dependency: python27-python-markupsafe for package: python27-python-jinja2-2.6-10.sc1.el6.noarch
---> Package python27-python-nose.noarch 0:1.3.0-1.sc1.el6 will be installed
---> Package python27-python-pip.noarch 0:8.1.2-2.el6 will be installed
---> Package python27-python-setuptools.noarch 0:0.9.8-4.el6 will be installed
---> Package python27-python-simplejson.x86_64 0:3.2.0-2.el6 will be installed
---> Package python27-python-sphinx.noarch 0:1.1.3-7.sc1.el6 will be installed
--> Processing Dependency: python27-python-pygments for package: python27-python-sphinx-1.1.3-7.sc1.el6.noarch
--> Processing Dependency: python27-python-docutils for package: python27-python-sphinx-1.1.3-7.sc1.el6.noarch
---> Package python27-python-sqlalchemy.x86_64 0:0.7.9-3.sc1.el6 will be installed
---> Package python27-python-virtualenv.noarch 0:13.1.0-2.el6 will be installed
--> Processing Dependency: python27-python-devel for package: python27-python-virtualenv-13.1.0-2.el6.noarch
---> Package python27-python-werkzeug.noarch 0:0.8.3-5.sc1.el6 will be installed
---> Package python27-python-wheel.noarch 0:0.24.0-2.el6 will be installed
---> Package python27-runtime.x86_64 0:1.1-25.el6 will be installed
--> Processing Dependency: scl-utils for package: python27-runtime-1.1-25.el6.x86_64
--> Running transaction check
---> Package python27-python-babel.noarch 0:0.9.6-7.sc1.el6 will be installed
---> Package python27-python-devel.x86_64 0:2.7.13-3.el6 will be installed
--> Processing Dependency: scl-utils-build for package: python27-python-devel-2.7.13-3.el6.x86_64
---> Package python27-python-docutils.noarch 0:0.11-2.el6 will be installed
---> Package python27-python-libs.x86_64 0:2.7.13-3.el6 will be installed
---> Package python27-python-markupsafe.x86_64 0:0.11-11.sc1.el6 will be installed
---> Package python27-python-pygments.noarch 0:1.5-2.sc1.el6 will be installed
---> Package scl-utils.x86_64 0:20120927-29.el6_9 will be installed
--> Running transaction check
---> Package scl-utils-build.x86_64 0:20120927-29.el6_9 will be installed
--> Processing Dependency: redhat-rpm-config for package: scl-utils-build-20120927-29.el6_9.x86_64
--> Processing Dependency: iso-codes for package: scl-utils-build-20120927-29.el6_9.x86_64
--> Running transaction check
---> Package iso-codes.noarch 0:3.16-2.el6 will be installed
--> Processing Dependency: xml-common for package: iso-codes-3.16-2.el6.noarch
---> Package redhat-rpm-config.noarch 0:9.0.3-51.el6.centos will be installed
--> Processing Dependency: perl(Getopt::Long) for package: redhat-rpm-config-9.0.3-51.el6.centos.noarch
--> Processing Dependency: /usr/bin/perl for package: redhat-rpm-config-9.0.3-51.el6.centos.noarch
--> Running transaction check
---> Package perl.x86_64 4:5.10.1-144.el6 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-144.el6 for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-144.el6.x86_64
---> Package xml-common.noarch 0:0.6.3-33.el6 will be installed
--> Running transaction check
---> Package perl-Module-Pluggable.x86_64 1:3.90-144.el6 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-144.el6 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-144.el6.x86_64
---> Package perl-libs.x86_64 4:5.10.1-144.el6 will be installed
---> Package perl-version.x86_64 3:0.77-144.el6 will be installed
--> Running transaction check
---> Package perl-Pod-Escapes.x86_64 1:1.04-144.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
python27 x86_64 1.1-25.el6 centos-sclo-rh 5.2 k
Installing for dependencies:
iso-codes noarch 3.16-2.el6 base 2.4 M
perl x86_64 4:5.10.1-144.el6 base 10 M
perl-Module-Pluggable x86_64 1:3.90-144.el6 base 41 k
perl-Pod-Escapes x86_64 1:1.04-144.el6 base 33 k
perl-Pod-Simple x86_64 1:3.13-144.el6 base 213 k
perl-libs x86_64 4:5.10.1-144.el6 base 579 k
perl-version x86_64 3:0.77-144.el6 base 52 k
python27-python x86_64 2.7.13-3.el6 centos-sclo-rh 84 k
python27-python-babel noarch 0.9.6-7.sc1.el6 centos-sclo-rh 1.4 M
python27-python-devel x86_64 2.7.13-3.el6 centos-sclo-rh 389 k
python27-python-docutils noarch 0.11-2.el6 centos-sclo-rh 1.6 M
python27-python-jinja2 noarch 2.6-10.sc1.el6 centos-sclo-rh 550 k
python27-python-libs x86_64 2.7.13-3.el6 centos-sclo-rh 5.8 M
python27-python-markupsafe x86_64 0.11-11.sc1.el6 centos-sclo-rh 24 k
python27-python-nose noarch 1.3.0-1.sc1.el6 centos-sclo-rh 290 k
python27-python-pip noarch 8.1.2-2.el6 centos-sclo-rh 1.7 M
python27-python-pygments noarch 1.5-2.sc1.el6 centos-sclo-rh 801 k
python27-python-setuptools noarch 0.9.8-4.el6 centos-sclo-rh 423 k
python27-python-simplejson x86_64 3.2.0-2.el6 centos-sclo-rh 174 k
python27-python-sphinx noarch 1.1.3-7.sc1.el6 centos-sclo-rh 1.1 M
python27-python-sqlalchemy x86_64 0.7.9-3.sc1.el6 centos-sclo-rh 2.1 M
python27-python-virtualenv noarch 13.1.0-2.el6 centos-sclo-rh 1.7 M
python27-python-werkzeug noarch 0.8.3-5.sc1.el6 centos-sclo-rh 555 k
python27-python-wheel noarch 0.24.0-2.el6 centos-sclo-rh 76 k
python27-runtime x86_64 1.1-25.el6 centos-sclo-rh 1.0 M
redhat-rpm-config noarch 9.0.3-51.el6.centos base 60 k
scl-utils x86_64 20120927-29.el6_9 base 23 k
scl-utils-build x86_64 20120927-29.el6_9 base 17 k
xml-common noarch 0.6.3-33.el6 base 18 k
Transaction Summary
=================================================================================================================================================================================================
Install 30 Package(s)
Total download size: 33 M
Installed size: 122 M
Is this ok [y/N]: y
Downloading Packages:
(1/30): iso-codes-3.16-2.el6.noarch.rpm | 2.4 MB 00:00
(2/30): perl-5.10.1-144.el6.x86_64.rpm | 10 MB 00:00
(3/30): perl-Module-Pluggable-3.90-144.el6.x86_64.rpm | 41 kB 00:00
(4/30): perl-Pod-Escapes-1.04-144.el6.x86_64.rpm | 33 kB 00:00
(5/30): perl-Pod-Simple-3.13-144.el6.x86_64.rpm | 213 kB 00:00
(6/30): perl-libs-5.10.1-144.el6.x86_64.rpm | 579 kB 00:00
(7/30): perl-version-0.77-144.el6.x86_64.rpm | 52 kB 00:00
(8/30): python27-1.1-25.el6.x86_64.rpm | 5.2 kB 00:00
(9/30): python27-python-2.7.13-3.el6.x86_64.rpm | 84 kB 00:00
(10/30): python27-python-babel-0.9.6-7.sc1.el6.noarch.rpm | 1.4 MB 00:00
(11/30): python27-python-devel-2.7.13-3.el6.x86_64.rpm | 389 kB 00:00
(12/30): python27-python-docutils-0.11-2.el6.noarch.rpm | 1.6 MB 00:00
(13/30): python27-python-jinja2-2.6-10.sc1.el6.noarch.rpm | 550 kB 00:00
(14/30): python27-python-libs-2.7.13-3.el6.x86_64.rpm | 5.8 MB 00:00
(15/30): python27-python-markupsafe-0.11-11.sc1.el6.x86_64.rpm | 24 kB 00:00
(16/30): python27-python-nose-1.3.0-1.sc1.el6.noarch.rpm | 290 kB 00:00
(17/30): python27-python-pip-8.1.2-2.el6.noarch.rpm | 1.7 MB 00:00
(18/30): python27-python-pygments-1.5-2.sc1.el6.noarch.rpm | 801 kB 00:00
(19/30): python27-python-setuptools-0.9.8-4.el6.noarch.rpm | 423 kB 00:00
(20/30): python27-python-simplejson-3.2.0-2.el6.x86_64.rpm | 174 kB 00:00
(21/30): python27-python-sphinx-1.1.3-7.sc1.el6.noarch.rpm | 1.1 MB 00:00
(22/30): python27-python-sqlalchemy-0.7.9-3.sc1.el6.x86_64.rpm | 2.1 MB 00:00
(23/30): python27-python-virtualenv-13.1.0-2.el6.noarch.rpm | 1.7 MB 00:00
(24/30): python27-python-werkzeug-0.8.3-5.sc1.el6.noarch.rpm | 555 kB 00:00
(25/30): python27-python-wheel-0.24.0-2.el6.noarch.rpm | 76 kB 00:00
(26/30): python27-runtime-1.1-25.el6.x86_64.rpm | 1.0 MB 00:00
(27/30): redhat-rpm-config-9.0.3-51.el6.centos.noarch.rpm | 60 kB 00:00
(28/30): scl-utils-20120927-29.el6_9.x86_64.rpm | 23 kB 00:00
(29/30): scl-utils-build-20120927-29.el6_9.x86_64.rpm | 17 kB 00:00
(30/30): xml-common-0.6.3-33.el6.noarch.rpm | 18 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 6.9 MB/s | 33 MB 00:04
warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Importing GPG key 0xF2EE9D55:
Userid : CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <[email protected]>
Package: centos-release-scl-rh-2-3.el6.centos.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 1/30
Installing : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 2/30
Installing : 4:perl-libs-5.10.1-144.el6.x86_64 3/30
Installing : 1:perl-Pod-Simple-3.13-144.el6.x86_64 4/30
Installing : 3:perl-version-0.77-144.el6.x86_64 5/30
Installing : 4:perl-5.10.1-144.el6.x86_64 6/30
Installing : redhat-rpm-config-9.0.3-51.el6.centos.noarch 7/30
Installing : xml-common-0.6.3-33.el6.noarch 8/30
Installing : iso-codes-3.16-2.el6.noarch 9/30
Installing : scl-utils-build-20120927-29.el6_9.x86_64 10/30
Installing : scl-utils-20120927-29.el6_9.x86_64 11/30
Installing : python27-runtime-1.1-25.el6.x86_64 12/30
Installing : python27-python-setuptools-0.9.8-4.el6.noarch 13/30
Installing : python27-python-libs-2.7.13-3.el6.x86_64 14/30
Installing : python27-python-pip-8.1.2-2.el6.noarch 15/30
Installing : python27-python-2.7.13-3.el6.x86_64 16/30
Installing : python27-python-babel-0.9.6-7.sc1.el6.noarch 17/30
Installing : python27-python-werkzeug-0.8.3-5.sc1.el6.noarch 18/30
Installing : python27-python-sqlalchemy-0.7.9-3.sc1.el6.x86_64 19/30
Installing : python27-python-pygments-1.5-2.sc1.el6.noarch 20/30
Installing : python27-python-nose-1.3.0-1.sc1.el6.noarch 21/30
Installing : python27-python-devel-2.7.13-3.el6.x86_64 22/30
Installing : python27-python-virtualenv-13.1.0-2.el6.noarch 23/30
Installing : python27-python-markupsafe-0.11-11.sc1.el6.x86_64 24/30
Installing : python27-python-jinja2-2.6-10.sc1.el6.noarch 25/30
Installing : python27-python-docutils-0.11-2.el6.noarch 26/30
Installing : python27-python-sphinx-1.1.3-7.sc1.el6.noarch 27/30
Installing : python27-python-wheel-0.24.0-2.el6.noarch 28/30
Installing : python27-python-simplejson-3.2.0-2.el6.x86_64 29/30
Installing : python27-1.1-25.el6.x86_64 30/30
Verifying : python27-runtime-1.1-25.el6.x86_64 1/30
Verifying : 3:perl-version-0.77-144.el6.x86_64 2/30
Verifying : 4:perl-5.10.1-144.el6.x86_64 3/30
Verifying : python27-python-babel-0.9.6-7.sc1.el6.noarch 4/30
Verifying : python27-python-jinja2-2.6-10.sc1.el6.noarch 5/30
Verifying : python27-python-setuptools-0.9.8-4.el6.noarch 6/30
Verifying : python27-python-werkzeug-0.8.3-5.sc1.el6.noarch 7/30
Verifying : python27-python-sqlalchemy-0.7.9-3.sc1.el6.x86_64 8/30
Verifying : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 9/30
Verifying : python27-python-libs-2.7.13-3.el6.x86_64 10/30
Verifying : scl-utils-20120927-29.el6_9.x86_64 11/30
Verifying : 4:perl-libs-5.10.1-144.el6.x86_64 12/30
Verifying : python27-python-pygments-1.5-2.sc1.el6.noarch 13/30
Verifying : python27-python-nose-1.3.0-1.sc1.el6.noarch 14/30
Verifying : python27-1.1-25.el6.x86_64 15/30
Verifying : redhat-rpm-config-9.0.3-51.el6.centos.noarch 16/30
Verifying : python27-python-devel-2.7.13-3.el6.x86_64 17/30
Verifying : python27-python-virtualenv-13.1.0-2.el6.noarch 18/30
Verifying : 1:perl-Pod-Simple-3.13-144.el6.x86_64 19/30
Verifying : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 20/30
Verifying : iso-codes-3.16-2.el6.noarch 21/30
Verifying : python27-python-markupsafe-0.11-11.sc1.el6.x86_64 22/30
Verifying : scl-utils-build-20120927-29.el6_9.x86_64 23/30
Verifying : python27-python-docutils-0.11-2.el6.noarch 24/30
Verifying : python27-python-wheel-0.24.0-2.el6.noarch 25/30
Verifying : python27-python-pip-8.1.2-2.el6.noarch 26/30
Verifying : python27-python-simplejson-3.2.0-2.el6.x86_64 27/30
Verifying : python27-python-sphinx-1.1.3-7.sc1.el6.noarch 28/30
Verifying : python27-python-2.7.13-3.el6.x86_64 29/30
Verifying : xml-common-0.6.3-33.el6.noarch 30/30
Installed:
python27.x86_64 0:1.1-25.el6
Dependency Installed:
iso-codes.noarch 0:3.16-2.el6 perl.x86_64 4:5.10.1-144.el6 perl-Module-Pluggable.x86_64 1:3.90-144.el6
perl-Pod-Escapes.x86_64 1:1.04-144.el6 perl-Pod-Simple.x86_64 1:3.13-144.el6 perl-libs.x86_64 4:5.10.1-144.el6
perl-version.x86_64 3:0.77-144.el6 python27-python.x86_64 0:2.7.13-3.el6 python27-python-babel.noarch 0:0.9.6-7.sc1.el6
python27-python-devel.x86_64 0:2.7.13-3.el6 python27-python-docutils.noarch 0:0.11-2.el6 python27-python-jinja2.noarch 0:2.6-10.sc1.el6
python27-python-libs.x86_64 0:2.7.13-3.el6 python27-python-markupsafe.x86_64 0:0.11-11.sc1.el6 python27-python-nose.noarch 0:1.3.0-1.sc1.el6
python27-python-pip.noarch 0:8.1.2-2.el6 python27-python-pygments.noarch 0:1.5-2.sc1.el6 python27-python-setuptools.noarch 0:0.9.8-4.el6
python27-python-simplejson.x86_64 0:3.2.0-2.el6 python27-python-sphinx.noarch 0:1.1.3-7.sc1.el6 python27-python-sqlalchemy.x86_64 0:0.7.9-3.sc1.el6
python27-python-virtualenv.noarch 0:13.1.0-2.el6 python27-python-werkzeug.noarch 0:0.8.3-5.sc1.el6 python27-python-wheel.noarch 0:0.24.0-2.el6
python27-runtime.x86_64 0:1.1-25.el6 redhat-rpm-config.noarch 0:9.0.3-51.el6.centos scl-utils.x86_64 0:20120927-29.el6_9
scl-utils-build.x86_64 0:20120927-29.el6_9 xml-common.noarch 0:0.6.3-33.el6
Complete!
[root@c95d49d56cde /]#
Make it permanent for our user
Now that python2.7 is installed. We need to set some variables to actually use it when we login. Note, we have not changed the rest of the systems default python. Our install went to /opt/rh/python27.
In your .bashrc, put the following:
. /opt/rh/python27/enable
export set CLOUDSDK_PYTHON=/opt/rh/python27/root/usr/bin/python2
Now you can either log out, and log back in for it to take effect, or you can just type ‘source ~/.bashrc’. This will reload your .bashrc along with our new variables.
Install Google Cloud SDK
now lets follow the directions from google… kind of. https://cloud.google.com/sdk/docs/downloads-yum
tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM
this will add te google-cloud-sdk repo. Unfortunately we cant just yum install it. Take a look:
[root@c95d49d56cde /]# yum --enablerepo=google* -y install google-cloud-sdk
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* epel: fedora-epel.mirror.lstn.net
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
google-cloud-sdk/signature | 454 B 00:00
Retrieving key from https://packages.cloud.google.com/yum/doc/yum-key.gpg
Importing GPG key 0xA7317B0F:
Userid: "Google Cloud Packages Automatic Signing Key <[email protected]>"
From : https://packages.cloud.google.com/yum/doc/yum-key.gpg
Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
google-cloud-sdk/signature | 1.4 kB 00:07 ...
google-cloud-sdk/primary | 36 kB 00:00
google-cloud-sdk 227/227
Resolving Dependencies
--> Running transaction check
---> Package google-cloud-sdk.noarch 0:211.0.0-1.el7 will be installed
--> Processing Dependency: python2 >= 2.7 for package: google-cloud-sdk-211.0.0-1.el7.noarch
--> Finished Dependency Resolution
Error: Package: google-cloud-sdk-211.0.0-1.el7.noarch (google-cloud-sdk)
Requires: python2 >= 2.7
Installed: python-2.6.6-66.el6_8.x86_64 (@CentOS/6.10)
python2 = 2.6.6
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@c95d49d56cde /]#
Wait, I thought we had python 2.7 installed? Well, we do.. But its called python27, and the actual “python” package installed is still 2.6. So RPM thinks this would be incompatible. Although, if we work with RPM directly we can ask it to just trust us. So lets grab the RPM using yumdownloader(yum install yum-utils).
[root@c95d49d56cde /]# yum -y install yum-utils
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* epel: fedora-epel.mirror.lstn.net
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.30-42.el6_10 will be installed
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.30-42.el6_10.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.7.6-21.el6_8.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
yum-utils noarch 1.1.30-42.el6_10 updates 114 k
Installing for dependencies:
libxml2-python x86_64 2.7.6-21.el6_8.1 base 325 k
Transaction Summary
=================================================================================================================================================================================================
Install 2 Package(s)
Total download size: 439 k
Installed size: 2.2 M
Downloading Packages:
(1/2): libxml2-python-2.7.6-21.el6_8.1.x86_64.rpm | 325 kB 00:00
(2/2): yum-utils-1.1.30-42.el6_10.noarch.rpm | 114 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 959 kB/s | 439 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libxml2-python-2.7.6-21.el6_8.1.x86_64 1/2
Installing : yum-utils-1.1.30-42.el6_10.noarch 2/2
Verifying : yum-utils-1.1.30-42.el6_10.noarch 1/2
Verifying : libxml2-python-2.7.6-21.el6_8.1.x86_64 2/2
Installed:
yum-utils.noarch 0:1.1.30-42.el6_10
Dependency Installed:
libxml2-python.x86_64 0:2.7.6-21.el6_8.1
Complete!
[root@c95d49d56cde /]# yumdownloader google-cloud-sdk
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.oss.ou.edu
* epel: mirror.compevo.com
* extras: mirror.oss.ou.edu
* updates: www.gtlib.gatech.edu
5630add21629cdaac198c6988c71693fc1642898e4c0c6d7cc0ffc8468cbd55d-google-cloud-sdk-211.0.0-1.el7.noarch.rpm | 28 MB 00:01
[root@c95d49d56cde /]#
We used yumdownloader to actually download the google-cloud-sdk rpm from their repository.
It is imporant that you have set your environment variables at this point, to enable the SCL version of python. If you have not, this next part will fail.
[root@c95d49d56cde /]# rpm -i --nodeps 5630add21629cdaac198c6988c71693fc1642898e4c0c6d7cc0ffc8468cbd55d-google-cloud-sdk-211.0.0-1.el7.noarch.rpm
warning: 5630add21629cdaac198c6988c71693fc1642898e4c0c6d7cc0ffc8468cbd55d-google-cloud-sdk-211.0.0-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 3e1ba8d5: NOKEY
[root@c95d49d56cde /]# gcloud -h
Usage: gcloud [optional flags] <group | command>
group may be alpha | app | auth | beta | builds | components |
composer | compute | config | container | dataflow |
dataproc | datastore | debug | deployment-manager |
dns | domains | endpoints | firebase | functions |
iam | iot | kms | logging | ml | ml-engine |
organizations | projects | pubsub | services | source |
spanner | sql | topic
command may be docker | feedback | help | info | init | version
[root@c95d49d56cde /]#
We used rpm to install the .rpm file we downloaded. We used –nodeps to tell rpm not to worry about the dependencies. Make sure to only use “–nodeps” when you know what you are doing.
Authenticate and test
Now let give it a try to make sure it works.
First, you authenticate, it will give you a URL. You visit that URL and log into your google account. This returns a code that you then provide to the gcloud CLI to authenticate you.
[root@c95d49d56cde /]# gcloud auth login
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&prompt=select_account&response_type=code&client_id=0000000000.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline
Enter verification code: 4/OQAFhrLAME19APSlam91TbST-JDPj9f5LAMEwzImeLAMEmx501XNMqE
WARNING: `gcloud auth login` no longer writes application default credentials.
If you need to use ADC, see:
gcloud auth application-default --help
You are now logged in as [[email protected]].
Your current project is [None]. You can change this setting by running:
$ gcloud config set project PROJECT_ID
[root@c95d49d56cde /]#
Now lets set our project to be default:
[root@c95d49d56cde /]# gcloud config set project test-project
Updated property [core/project].
[root@c95d49d56cde /]#
And last, lets confirm we can list the instances to make sure it works.
[root@c95d49d56cde /]# gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
james-instance-1 us-west1-a n1-standard-2 10.138.0.3 TERMINATED
james-test-1 us-west1-a n1-standard-2 10.138.0.2 TERMINATED
[root@c95d49d56cde /]#
Interested in more information?