Local user python with SSL & s3 install — Part 2

Sobhan Narayanan
2 min readDec 12, 2019

if you get an urllib3.util.ssl_ import when using aws here is the steps to install s3 with the local python compiled with local ssl

Install local open ssl in you RHEL system

Step 1: export https_proxy=”corporate.proxy.com:80"
Step 2: curl https://www.openssl.org/source/openssl-1.0.2g.tar.gz | tar xz && cd openssl-1.0.2g && ./config shared — prefix=/company/bluedot/usr/local/ && make && make install

Compile Python with the openssl local, if you have already install python and aws s3 as part of Part 1 article please using the follow steps(3–5) to remove the python and aws, if not go to step 6

Step 3: rm -Rf Python-2.7.11.tgz
Step 4: rm -Rf Python-2.7.11/
Step 5: rm -Rf .local/

Compile Python with the openssl local & S3 installtion

Step 6:export LDFLAGS=”-L/Company/bluedot/usr/local/lib/”
Step 7:export LD_LIBRARY_PATH=”/Company/bluedot/usr/local/lib/”
Step 8:export CPPFLAGS=”-I/Company/bluedot/usr/local/include -I/Company/bluedot/usr/local/include/openssl”
Step 9:export CFLAGS=”-I/Company/bluedot/usr/local/include -I/Company/bluedot/usr/local/include/openssl”
Step 10:cd
Step 11:curl https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz | tar xzf Python-2.7.11.tgz
Step 12:cd Python-2.7.11
Step 13: vim Modules/Setup.dist # Find SSL Update the SSL path and uN comment line as below
SSL=/Company/bluedot/usr/local
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto `
Step 14 :wq
Step 15:./configure — prefix=/Company/bluedot/usr/local/
Step 16:make altinstall
Step 17: cd && cd ~/usr/local/bin
Step 18: ln -s python2.7 python
Step 19:export PATH=~/usr/local/bin:$PATH
Step 20:export PYTHONPATH=$HOME/Python-2.7.11
Step 21:cd
Step 22:curl “https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o “awscli-bundle.zip”
Step 23:unzip awscli-bundle.zip
Step 24:./awscli-bundle/install -b ~/bin/aws

~~~~~~~~~~~~===All — Done.. !!!, ===~~~~~~~~~~~~

In case if you have any issue please check if you have set properly the environment variables PATH, PYTHONPATH.., etc

If you get the error as below

aws/bin/python: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory

LDFLAGS=”-L/Company/bluedot/usr/local/lib/”

is not set properly.

--

--