sudo: /opt/bitnami/letsencrypt/lego: command not found

How to fix LetsEncrypt lego script not working (Bitnami AWS Lightsail / GCP Compute Engine)

I was helping a client through my Bitnami bug fix service when I came across sudo: /opt/bitnami/letsencrypt/lego: command not found. If you’ve came across the same error, this post will tell you how to solve it.

The Problem: Lego Script Missing

I was trying to setup Let’s Encrypt SSL auto renewal for a WordPress website that was using Bitnami stack. This was on Amazon Web Services, but it’s not related to that. You could experience this error on any platform Bitnami is available on.

You need to execute Lego script provided by Bitnami to generate and install free SSL certificate from Let’s Encript. The command responsible for that looks like following,

				
					sudo /opt/bitnami/letsencrypt/lego --tls --email="EMAIL-ADDRESS" --domains="DOMAIN" --path="/opt/bitnami/letsencrypt" renew --days 90
				
			

But this command wouldn’t execute as expected and throws the following error which we’re going to solve today.

				
					sudo: /opt/bitnami/letsencrypt/lego: command not found
				
			

The Solution: Install Lego Script

Fortunately for us, this is something easy to fix. The error sudo: /opt/bitnami/letsencrypt/lego: command not found suggests that Lego client is missing on the server. This is normal for some Bitnami instances. The solution is the install the Lego client.

How to Install Lego Script on Bitnami Server

Start by navigating to the /tmp directory,

				
					cd /tmp
				
			

Download the installation script from Github,

				
					curl -Ls https://api.github.com/repos/xenolf/lego/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -i -
				
			

Extract content,

				
					tar xf lego_vX.Y.Z_linux_amd64.tar.gz
				
			

Make a new directory and move extracted content to it,

				
					sudo mkdir -p /opt/bitnami/letsencrypt
sudo mv lego /opt/bitnami/letsencrypt/lego
				
			

Following above instructions will download, extract and copy the Lego client to the directory it’s supposed to be in. And the error sudo: /opt/bitnami/letsencrypt/lego: command not found should disappear now.

You can go back to generating the SSL certificate for your Bitnami website. If you still encounter errors, leave a comment below or reach us on Fiverr. We’ll help you resolve any error related to Bitnami or other server stacks.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button