Let's do it step by step. First step is to change the working directory to a temporary folder in order to not download files in other locations and keep the system organized:
Once located in this directory, you should download the lego code, for that run the following command
curl -s https://api.github.com/repos/xenolf/lego/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -i -
To check if the file was properly downloaded, you can execute
ls -l and find a file named
lego_vX.Y.Z_linux_amd64.tar.gz, in my case:
-rw-r--r-- 1 crhernandez crhernandez 4727915 May 31 17:51 lego_v1.0.1_linux_amd64.tar.gz
drwx------ 2 crhernandez crhernandez 4096 Oct 12 08:28 ssh-skj42Flgm8
drwx------ 3 root root 4096 Oct 12 08:25 systemd-private-838783b5d74b4b4db538e8be207e0778-haveged.service-5i8UWM
At this moment, I downloaded a compressed file that contains lego_v1.0.1 code.
Next step is extract the code from the compressed file:
tar xf lego_vX.Y.Z_linux_amd64.tar.gz
in my case
tar xf lego_v1.0.1_linux_amd64.tar.gz
Now, if you run again
ls -l you should see new files and folders (apart of the rest of files present in
-rw-r--r-- 1 crhernandez crhernandez 11155 May 31 17:41 CHANGELOG.md
-rwxr-xr-x 1 crhernandez crhernandez 14711584 May 31 17:45 lego
-rw-r--r-- 1 crhernandez crhernandez 1088 May 31 17:41 LICENSE
As you can see, an executable file named
lego appears. At this point, you can execute
to check if this executable file works. Note that you are running it adding a
./ before the command, this means that you're running it "locally" in the same folder where the executable is, but if you move your working directory to another place, the command wouldn't work.
The last step is to move this executable to
/usr/local/bin/ in order to allow you to execute it everywhere, for that, you should execute
sudo mv lego /usr/local/bin/lego
After that, you should be able to go to another directory, for example, your home directory and run lego globally:
Can you follow the above steps? If yes, you can continue with the other steps in the guide.
Please let us know if this solves the issue.
Carlos R. Hernández