Installing SSL on CentOS | My Virtual Time Capsule

Installing SSL on CentOS | My Virtual Time Capsule

Installing SSL on CentOS

Extracted from the Source with modification:

Recently on a couple of older CentOS machines I’ve found that the stock Python doesn’t have SSL support, which obviously makes trying to make a HTTPS connection impossible.

The error that comes back from the socket module is:

    AttributeError: 'module' object has no attribute 'ssl'

To get SSL support you will have to compile Python from source and it’s not the most intuitive problem to solve. First up check you have OpenSSL installed correctly. OpenSSL is normally installed in "/usr/bin/openssl", you can use yum to check if it’s installed;

    yum list installed | grep ssl

if for some reason you don’t have it, you can easily install it using yum.

    yum install openssl openssl-devel

Then you will need to get a copy of the Python source, which you can find from the download site.

You then need to edit the Modules/Setup.dist file and uncomment the following (starting on line number 215 in my 2.6 source):

    SSL=/urs/local/ssl

    _ssl _ssl.c

        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl

        -L$(SSL)/lib -lssl -lcrypto

(You might also need to uncomment the line above starting SSL to point it to your openssl instillation if it can’t be found in your $PATH)

Then run the standard setup:

    ./configure

    make altinstall prefix=~/python2.6.5 exec-prefix=~/python2.6.5

(NOTE: If you are installing a separate Python version from the one

that comes with the distro, it's normally sensible to use the

 altinstall option and not throttle the existing instillation.

That way you don't interfere with OS specific stuff using

Python - such as yum on CentOS)

Once it’s all done, you can test by running the following:

    python -c 'from socket import ssl'

All done! probably shouldn’t be as tricky as that…
About these ads


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值