Create An Easy to Use, Locally Hosted Bash Script Repository
i12bretro
#Linux #Bash #Self-host
Full steps can be found at https://i12bretro.github.io/tutorials/0477.html
In this example I'll be installing Apache2 on a Debian VM, but the server can be hosted on any OS or web server capable of serving .sh files.
Installing a Web Server
- Log into the Linux device
- Run the following commands in a terminal window:
update software repositories
sudo apt updateinstall available software updates
sudo apt upgrade -yinstall apache2 webserver and curl
sudo apt install apache2 curl -ycreate a subfolder in the webroot to store .sh files
sudo mkdir /var/www/html/bash -p
Creating a Sample Bash Script
- Continue with the following command to create a sample bash script sudo nano /var/www/html/bash/whoami.sh
- Paste the following script into whoami.sh #!/bin/bash echo "hello, today is $(date '+%A'). You are running me as $(whoami)."
- Press CTRL+O, Enter, CTRL+X to write the changes to whoami.sh
Executing the Sample Bash Script
- Continue with the following command to execute the sample script curl http://DNSorIP/bash/whoami.sh | bash ... https://www.youtube.com/watch?v=jvh3REyA-sM
2021-08-15
0.0 LBC
Copyrighted (contact publisher)
9053249 Bytes