I am using a third-party script named "letsencrypt-vesta " to automate the process of applying and renewing LE certificates on my VestaCP panel.
From the code of letsencrypt-vesta script, I can see that it uses certbot-auto command:
LETSENCRYPT_COMMAND='/usr/local/certbot/certbot-auto -t --renew-by-default --agree-tos --webroot -w /etc/letsencrypt/webroot --server https://acme-v01.api.letsencrypt.org/directory '
Well, we know that Ubuntu Server 16.04.2 already installed both python 2.7 and python 3.5, while v2.7 is the default one. I can confirm this by running following command on my SSH client:
root@ubuntu:~# python -V
Python 2.7.12
root@ubuntu:~# python3 -V
Python 3.5.2
However, if I run letsencrypt-vesta script directly, it will end up with following error:
OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
Let's Encrypt returned an error status. Aborting.
The solution was introduced here:
opened 11:32PM - 15 Jan 17 UTC
closed 03:38AM - 17 Jan 17 UTC
Today I tried this script on a fresh installation of latest VestaCP 0.98-17 vers… ion. After VestaCP was installed, I created a new website (domain), without uploading any file.
Then I followed the installation guide of your script at:
https://github.com/interbrite/letsencrypt-vesta/blob/master/README.md
I exactly ran through those 5 steps in the "Installation" section. When running the 5th step, I got errors at the end:
> #letsencrypt-vesta myusername joomlagate.com
> Bootstrapping dependencies for Debian-based OSes...
> Hit:1 http://mirrors.aliyuncs.com/ubuntu xenial InRelease
> Hit:2 http://mirrors.aliyun.com/ubuntu xenial InRelease
> Get:3 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [102 kB]
> Get:4 http://mirrors.aliyuncs.com/ubuntu xenial-security InRelease [102 kB]
> Get:5 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [102 kB]
> Get:6 http://mirrors.aliyuncs.com/ubuntu xenial-updates InRelease [102 kB]
> Get:7 http://mirrors.aliyun.com/ubuntu xenial-proposed InRelease [253 kB]
> Get:8 http://mirrors.aliyuncs.com/ubuntu xenial-proposed InRelease [253 kB]
> Get:9 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease [102 kB]
> Get:10 http://mirrors.aliyuncs.com/ubuntu xenial-backports InRelease [102 kB]
> Get:11 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 Packages [378 kB]
> Get:12 http://mirrors.aliyuncs.com/ubuntu xenial-updates/universe amd64 Packages [378 kB]
> Get:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe i386 Packages [373 kB]
> Get:14 http://mirrors.aliyuncs.com/ubuntu xenial-updates/universe i386 Packages [373 kB]
> Hit:15 http://apt.vestacp.com/xenial xenial InRelease
> Hit:16 http://nginx.org/packages/mainline/ubuntu xenial InRelease
> Fetched 2,623 kB in 1s (1,655 kB/s)
> Reading package lists... Done
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> augeas-lenses is already the newest version (1.4.0-0ubuntu1).
> ca-certificates is already the newest version (20160104ubuntu1).
> gcc is already the newest version (4:5.3.1-1ubuntu1).
> libaugeas0 is already the newest version (1.4.0-0ubuntu1).
> libffi-dev is already the newest version (3.2.1-4).
> python is already the newest version (2.7.11-1).
> python-dev is already the newest version (2.7.11-1).
> libssl-dev is already the newest version (1.0.2g-1ubuntu4.5).
> openssl is already the newest version (1.0.2g-1ubuntu4.5).
> python-virtualenv is already the newest version (15.0.1+ds-3ubuntu1).
> virtualenv is already the newest version (15.0.1+ds-3ubuntu1).
> The following packages were automatically installed and are no longer required:
> linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic
> linux-image-extra-4.4.0-31-generic
> Use 'sudo apt autoremove' to remove them.
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> Creating virtual environment...
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module>
> main()
> File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main
> symlink=options.symlink)
> File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment
> download=download,
> File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel
> call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
> File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess
> % (cmd_desc, proc.returncode))
> OSError: Command /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
> Let's Encrypt returned an error status. Aborting.
>
Why? How to fix this?
My server OS is Ubuntu server 16.04.1 LTS 64-bit.
Thank you.
That is , just remove python3 completely, then letsencrypt-vesta will work smoothly.
But, I have a different oppinion:
We know that, Certbot already supports python3 .
So, why we need to remove python 3 ? Why not just let certbot-auto command choose to use python3 instead?
Now, I final question is:
Can I specify the python version (python3) when running "certbot-auto" command?
Or :
How to let certbot-auto command choose to use python 3 when the system default python version is 2.7?
Thank you.