Can't install Letsencrypt Certificate on Ubuntu 16.04


#1

With command

ee site update domainname.tld --letsencrypt

I’ve got this message:

(ERROR) ee : Unable to setup, Let's Encrypt
(ERROR) ee : Please make sure that your site is pointed to same server on which you are running Let's Encrypt Client to allow it to verify the site automatically.

This is the last part of ee log file

Command Error: The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Exception:
Traceback (most recent call last):
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    logger.critical(str(exc))
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/commands/install.py", line 350, in run
    requirement_set.cleanup_files()
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/commands/install.py", line 436, in get_lib_location_guesses
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/locations.py", line 140, in distutils_scheme
    d = Distribution(dist_args)
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/setuptools/dist.py", line 365, in __init__
    if key not in keep:
  File "/home/ubuntu/.local/share/letsencrypt/local/lib/python2.7/site-packages/setuptools/dist.py", line 372, in _finalize_requires
    install_dir = self.get_egg_cache_dir()
AttributeError: Distribution instance has no attribute 'install_requires'
Traceback (most recent call last):
  File "/tmp/tmp.m39EnHYx0y/pipstrap.py", line 146, in <module>
    exit(main())
  File "/tmp/tmp.m39EnHYx0y/pipstrap.py", line 133, in main
    shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'pip install --no-index --no-deps -U /tmp/pipstrap-q2G0fN/pip-8.0.3.tar.gz /tmp/pipstrap-q2G0fN/setuptools-20.2.2.tar.gz /tmp/pipstrap-q2G0fN/wheel-0.29.0.tar.gz' returned non-zero exit status 2
2017-07-20 20:39:51,712 (ERROR) ee : Unable to setup, Let's Encrypt
2017-07-20 20:39:51,712 (ERROR) ee : Please make sure that your site is pointed to
same server on which you are running Let's Encrypt Client
 to allow it to verify the site automatically.

Thank you in advance.


#2

Not sure how new the domain/DNS is - but make sure you’ve allowed enough time for the DNS to propogate to your server as well as you client machine - that’s bitten me before ;-). Also make sure you’ve set DNS for both www and @.

Otherwise my post yesterday may help (or confuse…).


#3

Run ee and letsencrypt command as root. On ubuntu, just use sudo bash to login as root.


#4

Ahh, so you need to elevate to the root user first then run ‘ee site update’ - ‘sudo ee site update’ is not sufficient?


#5

Hi virtubox, I’ve fixed it following this post

and using sudo -H:

sudo apt-get install python-pip
pip install setuptools
pip install --upgrade pip
pip install --upgrade setuptools
sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
export LC_ALL="en_US.UTF-8"
sudo -H ee site update domainname.tld --letsencrypt

I don’t know if the last one is enough, because it’s the last one. Thank you again for you kind support. Today I’ll face a phpmyadmin problem. :wink:


#6

I will check that on a fresh install, but the previous issue was not related only to EE, I have never used any ee command with a normal user. When you need to have permission, just login as root, and exit when it’s done.

@davideradice For phpmyadmin : https://kb.virtubox.net/knowledgebase/fix-phpmyadmin-errors-composer/


#7

@davideradice there is no issue with ee. before installation of let’s Encrypt you must have dns setup with your host. the domain must point to the same server where you want to setup ssl.


#8

I didn’t change dns and only after these commands I’ve succeded in installing SSL certificate. Your comment is not pertinent at all.


#9

Dear virtubox,

before applying HSTS header, with URL

https://www.domainname.tld:22222/db/pma/

I’ve had Error establishing database connection.

Now, after applying HSTS header I’ve this message:

NET::ERR_CERT_AUTHORITY_INVALID

Thank you again.


#10

You can’t use domain with HSTS enabled to access to phpmyadmin. (self-signed certificate used for the backend). Just use https://YOUR-VPS-IP:22222 instead


#11

Thanks. It shows me an alert in Chrome. I can add an exception… After that it shows me a prompt for user and password but mysql root credentials don’t allow me to go forward.


#12

It will always display an alert because it’s a self-signed certificate, but after visiting your website, HSTS force your browser to block any requests to your domain without a valid certificate. That’s why you have to use the vps ip or the domain to access to 22222 to edit the ACL credentials :

ee secure --auth 

#13

I understand it. Now I’ve managed to access phpmyadmin using easeyengine credentials and then mysql users ones.

Thank you again dear virtubox


#14