Blame

2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
1
# Server-Init-Script
2
eb9e08 Tebby Dog 2025-07-06 21:15:09
Update
3
This is a script I wrote that I can curl when setting up a new server to install tools I use on most of my machines.
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
4
e0bfeb Tebby Dog 2025-07-06 21:15:35
Update
5
# WARNING:
6
Copying code from the internet without reading it is like eating a mysterious burrito you found on a park bench. Sure, it might work... but there's a 404% chance of regret.
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
7
8
```python
9
def download_and_execute_random_code_from_the_internet():
10
import os
11
import sys
12
13
print("Downloading code from shadyforum.biz/mystery_script.py...")
14
# 🚨 DO NOT DO THIS 🚨
15
# os.system("curl http://shadyforum.biz/mystery_script.py | python3")
16
17
print("Just kidding! Let's be smarter than that.")
18
print("✨ Always read and understand code before you run it!")
19
print("Malicious code can delete files, steal data, or worse—")
20
print("...make you start using tabs instead of spaces 🫢")
21
22
download_and_execute_random_code_from_the_internet()
23
```
24
25
I host this on one of my domains so it is accessible at something akin to https://somewebsite.com/bootstrap.sh
26
When I set up a new server I can run:
27
28
```bash
29
curl https://somewebsite.com/bootstrap.sh && sudo chmod +x ./bootstrap.sh && ./bootstrap.sh
30
```
31
32
```bash
33
echo "Check if running as root..."
34
if [[ $EUID -ne 0 ]]; then
35
echo "This script must be run as root." 1>&2
36
exit 1
37
fi
38
This script segment first prints the message "Check if running as root""
39
echo "Update First..." read answer
40
sudo apt update && sudo apt upgrade -y
41
echo "Install common packages?"
42
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
43
echo "Instaling known needed packages."
44
sudo apt install nano curl git wget ufw mc -y 1>&2
45
exit 1
46
fi
47
echo "Install tailscale?" read answer
48
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
49
echo "Installing tailscale."
50
curl -fsSL https://tailscale.com/install.sh | sh
51
sudo tailscale up
52
fi
53
echo "Install talosctl?" read answer
54
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
55
echo "Installing talosctl."
56
curl -sL https://talos.dev/install | sh 1>&2
57
exit 1
58
fi
59
echo "Install kubectl?" read answer
60
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
61
echo "Installing kubectl."
62
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
63
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
64
sudo cp ./kubectl /usr/local/bin/kubectl
65
chmod +x /usr/local/bin/kubectl
66
fi
67
echo "Install fish console?" read answer
68
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
69
echo "Installing fish."
70
sudo apt install fish
71
chsh -s $(which fish)
72
fi
73
echo "Install pastey?"
74
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
75
curl https://pastey.tebplex.tv/pastey
76
sudo cp ./pastey /usr/local/bin/pastey
77
sudo chmod +x /usr/local/bin/pastey
78
fi
79
echo "Do you want to reboot now?" read answer
80
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
81
echo "Rebooting now..."
82
sudo reboot
83
fi
84
```