A few of the closing steps got rushed for time, so here's the full sequence again — from a manual curl → chmod → systemd setup to the one-line install script that replaces all of it.
Before writing any automation, this is the sequence we ran ourselves to get the server running as a proper background service.
curl.Doing this manually is fine for a single machine, but becomes tedious when deploying to hundreds of systems — which is exactly the problem a shell script solves.
Bash is the default scripting language of the shell on most Linux distributions, which makes it the natural choice for a portable install script. The one written here does a bit more than we covered in class — here's the full thing.
Three things it adds beyond what we discussed live:
cowserver) to run the service as. This is best practice — if the service is ever compromised, the attacker is confined to that low-privilege user instead of the whole system.755 for the binary, 644 for the service file). I'll get into what those numbers mean in the next class if I get a chance.daemon-reload, enable, and restart — just scripted instead of typed by hand.First, tear down the service we installed manually earlier in class:
Confirm it's really gone:
Now run the install script directly from the internet:
curl downloads the script, and the pipe (|) hands its output straight
to bash, which executes it as it streams in.
bash is convenient
for a classroom demo, but it means you're trusting the source completely — there's no chance to
read the script first. Fine here; worth a second thought in the wild.
Once it's running, find your machine's IP and check the server in a browser:
Visit YOUR-IP:8080/say in a browser.
One of the biggest advantages of using systemd is centralized logging:
journalctl reads logs from every service on the system; -u narrows it to
one unit, and -f ("follow") streams new lines live instead of just showing history.
Refresh the page in your browser and watch new lines appear.
The best way to learn Linux is still to keep tinkering with it.