{"id":7616,"date":"2023-02-23T18:20:22","date_gmt":"2023-02-23T18:20:22","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=7616"},"modified":"2023-02-23T18:20:22","modified_gmt":"2023-02-23T18:20:22","slug":"download-and-run-a-shell-script-from-github","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/02\/23\/download-and-run-a-shell-script-from-github\/","title":{"rendered":"Download and Run a Shell Script from a Site or Github"},"content":{"rendered":"\n<p>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.  <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Here is a file that is on a different server that we can install OpenVPN with.<\/p>\n\n\n\n<p>The following command downloads and installs OpenVPN on a server:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget https:\/\/git.io\/vpn -O openvpn-install.sh &amp;amp;&amp;amp; bash openvpn-install.sh\n<\/pre><\/div>\n\n\n<p>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.<\/p>\n\n\n\n<p>In Github, go over to the file you want to download and click &#8220;Raw.&#8221; <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-22-35.png\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"505\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-22-35.png\" alt=\"\" class=\"wp-image-7627\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-22-35.png 910w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-22-35-300x166.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-22-35-768x426.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"246\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57-1024x246.png\" alt=\"\" class=\"wp-image-7620\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57-1024x246.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57-300x72.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57-768x184.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-10-57.png 1242w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>This will open up a page with a direct link to the file. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-12-13.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-12-13.png\" alt=\"\" class=\"wp-image-7621\" width=\"545\" height=\"31\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-12-13.png 545w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-23_15-12-13-300x17.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/a><\/figure>\n\n\n\n<p>You can copy the URl and add to the wget command. Format as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget https:\/\/raw.githubusercontent.com\/geekdecoder\/aws\/master\/update-centos.sh &amp;amp;&amp;amp; bash update-centos.sh\n<\/pre><\/div>\n\n\n<p>Be careful that you know what you are installing before running these commands!!<\/p>\n\n\n\n<p>How to use Curl to download and execute a script.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl https:\/\/raw.githubusercontent.com\/geekdecoder\/aws\/master\/update-centos.sh | bash\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-7616","post","type-post","status-publish","format-standard","hentry","category-kb"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=7616"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7616\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=7616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=7616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=7616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}