Choosing the right download
So you went to download a file and you were presented with a list of options similar to the following
You know you're on Linux. But which one of these Linux downloads is right for you?
Run the uname
tool to help you find out
$ uname -a
x86_64
m
means tell us the hardware type
If you see x86_64
that means you want the download that says amd64
.
Installing it
When you're presented with a tarball (.tar.*
) you'll want to download it and
untar it using either your browser, wget
, curl
or whatever you want.
Be careful when you extract the tarball! People usually leave all the files in the top level directory and when you extract it all the sudden you'll have files all over the place!
I recommend creating a temporary directory first and changing your directory into it. We can do this all at once with the following command
cd $(mktemp -d)
cd
is change directorymktemp
is a utility for creating temporary files and directories. It will output the name, which we capture and use as the place we want to change our current working directory to using the$( )
operator.-d
tells it to make a directory
Here's an example of downloading Hugo which is shown in the screenshot above.
curl -LO https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.tar.gz
L
means follow any redirects, you'll usually want this, especially with GitHub since it likes to redirectO
means save the file with the same name as it has in the URL
We then extract the downloaded file
tar -xvz hugo_0.74.3_Linux-64bit.tar.gz
x
means extractv
means be verbose, print all extracted filesz
means the file will be.gz
compressed, and we'll need to decompress it using the gzip decompression algorithm. If you run into other file types, do a search to figure out what to replace this with.
We should have extracted 3 files.
You now want to put the binary, the command line program you want to run, in one
of the directories in the PATH
environment variable.
You can run
echo $PATH
To get a :
separated list of directories you can move the hugo
file to so
that you'll be able to use it from anywhere.
We'll move it into the /usr/bin
directory, a common place for executable files
to live.
mv hugo /usr/bin/
Now you can return to where you we're before you created the temporary directory by running
cd -
We can now run hugo!
$ hugo version
Hugo Static Site Generator v0.74.3-DA0437B4 linux/amd64 BuildDate: 2020-07-23T16:22:34Z