Skip to content

Instantly share code, notes, and snippets.

@samber
Last active December 7, 2022 20:16
Show Gist options
  • Save samber/26657ff723fb9569157696ce281b6c00 to your computer and use it in GitHub Desktop.
Save samber/26657ff723fb9569157696ce281b6c00 to your computer and use it in GitHub Desktop.
Debian quick setup
# Quick debian install scripts
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
# 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
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
# 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
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
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/
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt update
apt install -y nodejs
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