Blame

2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
1
# Server-Init-Script
2
87beef Tebby Dog 2025-07-06 21:39:41
Updated intro
3
This is a little script I whipped up that I can curl during a fresh server setup—it handles installing the usual set of tools I use across 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
e98b35 Tebby Dog 2025-07-06 21:17:50
Missing command
29
curl https://somewebsite.com/bootstrap.sh && sudo chmod +x ./bootstrap.sh && sudo ./bootstrap.sh
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
30
```
31
27b7cb Tebby Dog 2025-07-06 21:20:51
Added oneshot
32
There is also this version that will download and run the script all in one command, this is an even worse idea than the above if you don't trust the source.
33
34
One-shot
35
```bash
36
curl -sSL https://somewebsite.com/bootstrap.sh | sudo bash
37
```
38
f6c4ae Tebby Dog 2025-07-06 21:16:56
Update
39
Bootstrap Script
40
b706a0 Tebby Dog 2025-07-06 21:17:26
Formatting
41
```bash
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
42
echo "Check if running as root..."
43
if [[ $EUID -ne 0 ]]; then
44
echo "This script must be run as root." 1>&2
45
exit 1
46
fi
47
This script segment first prints the message "Check if running as root""
48
echo "Update First..." read answer
49
sudo apt update && sudo apt upgrade -y
50
echo "Install common packages?"
51
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
52
echo "Instaling known needed packages."
53
sudo apt install nano curl git wget ufw mc -y 1>&2
54
exit 1
55
fi
56
echo "Install tailscale?" read answer
57
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
58
echo "Installing tailscale."
59
curl -fsSL https://tailscale.com/install.sh | sh
60
sudo tailscale up
61
fi
62
echo "Install talosctl?" read answer
63
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
64
echo "Installing talosctl."
65
curl -sL https://talos.dev/install | sh 1>&2
66
exit 1
67
fi
68
echo "Install kubectl?" read answer
69
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
70
echo "Installing kubectl."
71
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
72
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
73
sudo cp ./kubectl /usr/local/bin/kubectl
74
chmod +x /usr/local/bin/kubectl
75
fi
76
echo "Install fish console?" read answer
77
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
78
echo "Installing fish."
79
sudo apt install fish
80
chsh -s $(which fish)
81
fi
82
echo "Install pastey?"
83
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
84
curl https://pastey.tebplex.tv/pastey
85
sudo cp ./pastey /usr/local/bin/pastey
86
sudo chmod +x /usr/local/bin/pastey
87
fi
88
echo "Do you want to reboot now?" read answer
89
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
90
echo "Rebooting now..."
91
sudo reboot
92
fi
93
```