Linux – Installing binaries on centos

centoscentos7linux

When I install stuff on my CentoS server I usually follow tutorials, where I can simply install a package using "yum install xy" viola everything is done. Sometimes I need to get a more recent version which is usually only offered at compiled binary (from Github). So what I get there is a .tar.gz and I am not sure how I should properly install it.

What I did:

cd /opt
mkdir packagename
cd packagename
wget fileurl.tar.gz
tar -xvfz fileurl.tar.gz

My problem:

Even though I am able to run the library (this time "dotnet" for example) the command is not globally available. Am I doing something wrong or is there just a missing step so that the command becomes available globally?

Best Answer

The 'PATH' environmental variable controls what commands are globally accessible. By default it'll include /usr/bin and probably /usr/local/bin, you can see the current setting with echo $PATH. You can usually add directories to your path by modifying $HOME/.bashrc or $HOME/.bash_profile and adding export PATH=$PATH:/the/new/directory and re-opening your shell.