Blame

2f0fd3 Tebby Dog 2025-07-06 21:14:33 1
# Server-Init-Script
2
7756a3 Tebby Dog 2025-07-06 22:31:17 3
Skip the fairy-tale, just give me the code already --> [Click Here](https://teb.codes/2-Code/Bash/Bootstrap-Script#bootstrap-script)
214fe0 Tebby Dog 2025-07-06 22:30:58 4
87beef Tebby Dog 2025-07-06 21:39:41 5
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 6
e0bfeb Tebby Dog 2025-07-06 21:15:35 7
# WARNING:
8
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 9
10
```python
11
def download_and_execute_random_code_from_the_internet():
12
import os
13
import sys
14
15
print("Downloading code from shadyforum.biz/mystery_script.py...")
16
# 🚨 DO NOT DO THIS 🚨
17
# os.system("curl http://shadyforum.biz/mystery_script.py | python3")
18
19
print("Just kidding! Let's be smarter than that.")
20
print("✨ Always read and understand code before you run it!")
21
print("Malicious code can delete files, steal data, or worse—")
22
print("...make you start using tabs instead of spaces 🫢")
23
24
download_and_execute_random_code_from_the_internet()
25
```
26
27
I host this on one of my domains so it is accessible at something akin to https://somewebsite.com/bootstrap.sh
28
When I set up a new server I can run:
29
30
```bash
e98b35 Tebby Dog 2025-07-06 21:17:50 31
curl https://somewebsite.com/bootstrap.sh && sudo chmod +x ./bootstrap.sh && sudo ./bootstrap.sh
2f0fd3 Tebby Dog 2025-07-06 21:14:33 32
```
33
27b7cb Tebby Dog 2025-07-06 21:20:51 34
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.
35
36
One-shot
37
```bash
38
curl -sSL https://somewebsite.com/bootstrap.sh | sudo bash
39
```
40
214fe0 Tebby Dog 2025-07-06 22:30:58 41
# Bootstrap Script
f6c4ae Tebby Dog 2025-07-06 21:16:56 42
6b2049 Tebby Dog 2025-07-06 21:50:44 43
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 44
b706a0 Tebby Dog 2025-07-06 21:17:26 45
```bash
2f0fd3 Tebby Dog 2025-07-06 21:14:33 46
echo "Check if running as root..."
47
if [[ $EUID -ne 0 ]]; then
48
echo "This script must be run as root." 1>&2
49
exit 1
50
fi
51
This script segment first prints the message "Check if running as root""
52
echo "Update First..." read answer
53
sudo apt update && sudo apt upgrade -y
54
echo "Install common packages?"
55
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
56
echo "Instaling known needed packages."
57
sudo apt install nano curl git wget ufw mc -y 1>&2
58
exit 1
59
fi
60
echo "Install tailscale?" read answer
61
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
62
echo "Installing tailscale."
63
curl -fsSL https://tailscale.com/install.sh | sh
64
sudo tailscale up
65
fi
66
echo "Install talosctl?" read answer
67
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
68
echo "Installing talosctl."
69
curl -sL https://talos.dev/install | sh 1>&2
70
exit 1
71
fi
72
echo "Install kubectl?" read answer
73
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
74
echo "Installing kubectl."
75
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
76
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
77
sudo cp ./kubectl /usr/local/bin/kubectl
78
chmod +x /usr/local/bin/kubectl
79
fi
80
echo "Install fish console?" read answer
81
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
82
echo "Installing fish."
83
sudo apt install fish
84
chsh -s $(which fish)
85
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09 86
########################################################################
87
# Pastey is below
2f0fd3 Tebby Dog 2025-07-06 21:14:33 88
echo "Install pastey?"
89
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
7eb0b4 Tebby Dog 2025-07-06 21:50:09 90
curl https://somewebsite.com/pastey
2f0fd3 Tebby Dog 2025-07-06 21:14:33 91
sudo cp ./pastey /usr/local/bin/pastey
92
sudo chmod +x /usr/local/bin/pastey
93
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09 94
# Pastey is above
95
########################################################################
2f0fd3 Tebby Dog 2025-07-06 21:14:33 96
echo "Do you want to reboot now?" read answer
97
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
98
echo "Rebooting now..."
99
sudo reboot
100
fi
101
```