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
f6c4ae Tebby Dog 2025-07-06 21:16:56
Update
32
Bootstrap Script
33
34
```bash bootstrap.sh
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
35
echo "Check if running as root..."
36
if [[ $EUID -ne 0 ]]; then
37
echo "This script must be run as root." 1>&2
38
exit 1
39
fi
40
This script segment first prints the message "Check if running as root""
41
echo "Update First..." read answer
42
sudo apt update && sudo apt upgrade -y
43
echo "Install common packages?"
44
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
45
echo "Instaling known needed packages."
46
sudo apt install nano curl git wget ufw mc -y 1>&2
47
exit 1
48
fi
49
echo "Install tailscale?" read answer
50
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
51
echo "Installing tailscale."
52
curl -fsSL https://tailscale.com/install.sh | sh
53
sudo tailscale up
54
fi
55
echo "Install talosctl?" read answer
56
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
57
echo "Installing talosctl."
58
curl -sL https://talos.dev/install | sh 1>&2
59
exit 1
60
fi
61
echo "Install kubectl?" read answer
62
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
63
echo "Installing kubectl."
64
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
65
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
66
sudo cp ./kubectl /usr/local/bin/kubectl
67
chmod +x /usr/local/bin/kubectl
68
fi
69
echo "Install fish console?" read answer
70
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
71
echo "Installing fish."
72
sudo apt install fish
73
chsh -s $(which fish)
74
fi
75
echo "Install pastey?"
76
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
77
curl https://pastey.tebplex.tv/pastey
78
sudo cp ./pastey /usr/local/bin/pastey
79
sudo chmod +x /usr/local/bin/pastey
80
fi
81
echo "Do you want to reboot now?" read answer
82
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
83
echo "Rebooting now..."
84
sudo reboot
85
fi
86
```