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
ba879f Tebby Dog 2025-07-17 22:57:38 31
wget 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
echo "Update First..." read answer
52
sudo apt update && sudo apt upgrade -y
53
echo "Install common packages?"
54
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
55
echo "Instaling known needed packages."
d42ca2 Tebby Dog 2025-07-28 02:39:46 56
sudo apt install nano curl git wget ufw mc htop tldr btop iotop ncdu duf nmon bmon nload iftop nethogs zoxide fzf ripgrep -y 1>&2
2f0fd3 Tebby Dog 2025-07-06 21:14:33 57
exit 1
58
fi
59
echo "Install tailscale?" read answer
60
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
61
echo "Installing tailscale."
62
curl -fsSL https://tailscale.com/install.sh | sh
63
sudo tailscale up
64
fi
65
echo "Install talosctl?" read answer
66
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
67
echo "Installing talosctl."
68
curl -sL https://talos.dev/install | sh 1>&2
69
exit 1
70
fi
71
echo "Install kubectl?" read answer
72
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
73
echo "Installing kubectl."
74
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
75
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
76
sudo cp ./kubectl /usr/local/bin/kubectl
77
chmod +x /usr/local/bin/kubectl
78
fi
79
echo "Install fish console?" read answer
80
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
81
echo "Installing fish."
82
sudo apt install fish
83
chsh -s $(which fish)
84
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09 85
########################################################################
86
# Pastey is below
2f0fd3 Tebby Dog 2025-07-06 21:14:33 87
echo "Install pastey?"
88
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
e58e73 Tebby Dog 2025-07-28 02:50:18 89
wget https://somewebsite.com/pastey
2f0fd3 Tebby Dog 2025-07-06 21:14:33 90
sudo cp ./pastey /usr/local/bin/pastey
91
sudo chmod +x /usr/local/bin/pastey
92
fi
7eb0b4 Tebby Dog 2025-07-06 21:50:09 93
# Pastey is above
94
########################################################################
2f0fd3 Tebby Dog 2025-07-06 21:14:33 95
echo "Do you want to reboot now?" read answer
96
if [[ "$answer" == "yes" ]] || [[ "$answer" == "y" ]]; then
97
echo "Rebooting now..."
98
sudo reboot
99
fi
100
```