Last active
December 7, 2022 20:16
-
-
Save samber/26657ff723fb9569157696ce281b6c00 to your computer and use it in GitHub Desktop.
Debian quick setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick debian install scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOT >> /usr/bin/clean | |
#!/bin/sh -e | |
clean() | |
{ | |
rm -rfv "$1"/.*~ | |
rm -rfv "$1"/*~ | |
rm -rfv "$1"/*.default | |
rm -rfv "$1"/*.sample | |
} | |
if [ "$1" ] | |
then | |
if [ -d "$1" ] | |
then | |
clean "$1" | |
else | |
echo "$1 not a directory" | |
fi | |
else | |
clean `pwd` | |
fi | |
EOT | |
chmod +x /usr/bin/clean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://linuxize.com/post/how-to-add-swap-space-on-debian-9/ | |
fallocate -l 4G /swapfile | |
mkswap /swapfile | |
chmod 600 /swapfile | |
swapon /swapfile | |
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab | |
swapon --show |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ | |
| tee -a /etc/apt/sources.list.d/caddy-fury.list | |
apt-get update | |
apt-get install -y caddy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update repos + system | |
apt-get update | |
apt-get upgrade | |
# install minimal stuff | |
apt-get install -y apt-transport-https \ | |
ca-certificates \ | |
ntp \ | |
libcap2-bin \ | |
net-tools \ | |
util-linux \ | |
lsof \ | |
tzdata \ | |
ssh \ | |
sudo | |
# install cool tools: sysadmin, network admin, basic operations | |
apt-get install -y git \ | |
htop \ | |
curl \ | |
wget \ | |
unzip \ | |
tar \ | |
tree \ | |
netcat \ | |
dnsutils \ | |
whois \ | |
traceroute \ | |
socat \ | |
nmap \ | |
jq \ | |
patch \ | |
vim \ | |
gnupg \ | |
gnupg2 \ | |
rsync \ | |
openvpn \ | |
ftp \ | |
logrotate \ | |
fail2ban \ | |
cron \ | |
coreutils \ | |
zsh \ | |
tmux \ | |
apache2-utils | |
# best editor e.v.e.r | |
apt-get install -y emacs-nox | |
# build tools | |
apt-get install -y build-essential \ | |
python \ | |
python3 \ | |
python-setuptools \ | |
python3-setuptools \ | |
make \ | |
gcc \ | |
g++ \ | |
clang | |
# change shell | |
chsh -s /bin/zsh | |
# system-wide alias 🤘 | |
ln -s /usr/bin/emacs /usr/bin/ne | |
# red prompt for root user on servers | |
echo 'export PS1="\e[0;31m[\u@\h \W]\$ \e[m"' >> /root/.bashrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg2 \ | |
software-properties-common \ | |
lsb-release | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt-get update | |
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
systemctl enable docker | |
# groupadd docker | |
# usermod -aG docker <user> | |
# config docker daemon | |
cat <<EOT >> /etc/docker/daemon.json | |
{ | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "256m" | |
} | |
} | |
EOT | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://go.dev/dl/go1.17.3.linux-amd64.tar.gz | |
tar -xvf go1.17.3.linux-amd64.tar.gz | |
mv go /usr/local | |
ln -s /usr/local/go/bin/go /usr/local/bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - | |
apt update | |
apt install -y nodejs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install libffi-dev python3-dev python3-pip python3-setuptools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment