{"id":726,"date":"2016-08-13T08:36:03","date_gmt":"2016-08-13T00:36:03","guid":{"rendered":"https:\/\/shuran.cn\/?p=726"},"modified":"2016-08-13T08:36:03","modified_gmt":"2016-08-13T00:36:03","slug":"centos-6x-install-the-python","status":"publish","type":"post","link":"https:\/\/www.shuran.cn\/?p=726","title":{"rendered":"centos  6x install the Python"},"content":{"rendered":"<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tThe Let\u2019s Encrypt client requires Python 2.7, which is not installed on CentOS 6.x by default. Simply upgrading Python will break several system utilities, like yum, so we\u2019ll start by installing Python 2.7 in an alternate location. If you\u2019re using a distro that includes Python 2.7, or you already have it installed, you can skip the next several steps.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tFirst, using yum, install the development tools and libraries we\u2019ll need to build Python from source.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tyum groupinstall \"Development tools\"<br \/>\nyum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tDownload the latest version of the Python 2.7 branch (2.7.11 as of this writing, but check<a href=\"http:\/\/python.org\/downloads\/\">http:\/\/python.org\/downloads\/<\/a>&nbsp;and update the version numbers as appropriate.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\twget http:\/\/python.org\/ftp\/python\/2.7.11\/Python-2.7.11.tar.xz\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tUnzip the Python tarball and change into the newly create source directory.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\ttar xf Python-2.7.11.tar.xz<br \/>\ncd Python-2.7.11<\/p>\n<p>Run the configure script.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\t.\/configure --prefix=\/usr\/local --enable-shared LDFLAGS=\"-Wl,-rpath \/usr\/local\/lib\"\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tBuild and install the new Python binary. We\u2019re using \u201cmake altinstall\u201d to ensure that we don\u2019t interfere the system version of Python (this will name the binary python2.7 instead of just python).\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tmake<br \/>\nmake altinstall\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\t<em>Thanks to Daniel Eriksson and&nbsp;<a href=\"http:\/\/www.toomuchdata.com\/\">Too Much Data<\/a>&nbsp;for the&nbsp;<a href=\"http:\/\/toomuchdata.com\/2014\/02\/16\/how-to-install-python-on-centos\/\">How to install Python 2.7 and Python 3.3 on CentOS 6<\/a>&nbsp;post, from which my instructions are based. I highly recommend reading that post, as my instructions are only the bare minimum needed to get Let\u2019s Encrypt working.<\/em>\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\t<strong>Installing Let\u2019s Encrypt<\/strong>\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tNow that we have the right Python version, we can install the Let\u2019s Encrypt ACME client. We\u2019ll also install my installation tool (which isn\u2019t much more than a bash script).\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\t\/usr\/local is intended for locally installed software (as opposed to system provided software), so it seems like a good place to put these tools.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tcd \/usr\/local<\/p>\n<p>Clone the official Let\u2019s Encrypt ACME client and my installation tool from GitHub.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tgit clone https:\/\/github.com\/letsencrypt\/letsencrypt<br \/>\ngit clone https:\/\/github.com\/interbrite\/letsencrypt-vesta\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tLet\u2019s Encrypt\u2019s ACME protocol validates that a requestor is in control of the domain by checking for a the availability of a randomly named file over the web. It can do this with its own web server, or it can write a file to the web root of an existing server running on the domain. Since a Vesta server has many different web roots, we\u2019ll tell let\u2019s Encrypt to write these files to a central location and then configure Apache to look there for incoming validation requests.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tFirst, create the Let\u2019s Encrypt webroot directory.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tmkdir -p \/etc\/letsencrypt\/webroot\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tThen create a symlink to the letsencrypt.conf file in my GitHub repository.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tln -s \/usr\/local\/letsencrypt-vesta\/letsencrypt.conf \/etc\/httpd\/conf.d\/letsencrypt.conf\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tFinally, restart Apache so it will pick up the configuration change.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tservice httpd restart\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tEverything is installed and ready to go, but to run the tools you\u2019ll need to specify the full path to them, since they aren\u2019t in your PATH environment variable. A quick fix for this is to symlink them inside \/usr\/local\/bin.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tln -s \/usr\/local\/letsencrypt\/letsencrypt-auto \/usr\/local\/bin\/letsencrypt-auto<br \/>\nln -s \/usr\/local\/letsencrypt-vesta\/letsencrypt-vesta \/usr\/local\/bin\/letsencrypt-vesta\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tNow you\u2019re ready to create your first certificate.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tlets encrypt-vesta USERNAME DOMAIN\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tSubstitute a valid Vesta user account for USERNAME and a domain hosted on that account for DOMAIN. The script will look up the account and pull the email address listed with it, using that as the contact email used in the certificate request. It will also look up the list of domain aliases associated with the domain and will include all of them as subject alternate names (SANs) in the certificate request. SANs function as additional domains on the certificate\u2014each one will be recognized as a trusted domain by users\u2019 browsers.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tThe first time you run the script, the Let\u2019s Encrypt client will do some setup work, so it may take a minute or two. Future runs won\u2019t require this additional work and should complete faster.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tThe certificates issued by Let\u2019s Encrypt are valid for 90 days. It is recommended that you renew them every 60 days to allow ample time to mitigate issues such as reissue errors and service interruptions that might occur and leave you with an expired cert.\n<\/p>\n<p style=\"font-size:13px;font-family:Arial, Helvetica, sans-serif;vertical-align:baseline;background-color:#FFFFFF;\">\n\tLet\u2019s Encrypt is currently in beta and, while they offer unlimited certificates, they do have some limitations in place, at least for now. As of this writing, they currently only allow ten certificate requests from a single IP address over a three hour period and limit the number of SANs on a single certificate to 100. There are also limits on the number of unverified requests (as in a certificate is requested, but the validation process fails) allowed, though this shouldn\u2019t be ann issue for most admins. These numbers may change over time as the technology platform matures and demand for the service adjusts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Let\u2019s Encrypt client requires Python 2.7, which is \u2026 <span class=\"read-more\"><a href=\"https:\/\/www.shuran.cn\/?p=726\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-726","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=726"}],"version-history":[{"count":1,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":727,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/726\/revisions\/727"}],"wp:attachment":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}