Download and Run a Shell Script from a Site or Github

So when I find a script from sites or Github, I can use wget or curl to not only download the file but install it in the same command.

Here is a file that is on a different server that we can install OpenVPN with.

The following command downloads and installs OpenVPN on a server:

wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh

Here is another one for running an update and upgrade for Rocky Linux (You need to be root for this). Since files served from raw.githubusercontent.com, you can download them directly through wget or curl.

In Github, go over to the file you want to download and click “Raw.”

This will open up a page with a direct link to the file.

You can copy the URl and add to the wget command. Format as follows:

wget https://raw.githubusercontent.com/geekdecoder/aws/master/update-centos.sh && bash update-centos.sh

Be careful that you know what you are installing before running these commands!!

How to use Curl to download and execute a script.

curl https://raw.githubusercontent.com/geekdecoder/aws/master/update-centos.sh | bash

Leave a Comment