Skip to content

Instantly share code, notes, and snippets.

@c18s
Last active March 2, 2024 06:09
Show Gist options
  • Save c18s/90cc63ad7d84378e3ffaf182a646940d to your computer and use it in GitHub Desktop.
Save c18s/90cc63ad7d84378e3ffaf182a646940d to your computer and use it in GitHub Desktop.
Debian environment packages
#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get -y dist-upgrade
apt-get -y purge rpcbind ntp
apt-get -y install curl mosh htop sudo git make tmux net-tools wget nload ntpdate iptraf-ng mtr \
iftop w3m vim locales tcpdump unzip bc hping3 vnstat bwm-ng bmon xz-utils python3-pip \
dnsutils nethogs iperf3 acl tree ca-certificates gnupg
apt-get -y autoremove && apt-get -y autoclean
update-alternatives --set editor /usr/bin/vim.basic
timedatectl set-timezone Asia/Bangkok 2>/dev/null
ntpdate-debian && date
echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment > /dev/null
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen > /dev/null
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf > /dev/null
sudo locale-gen en_US.UTF-8
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/swapfile/create_swap.sh | sh
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/swapfile/sysctl_swap.sh | sh
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/sudo-privileges/sudo-privileges.sh | USER=${USERNAME:-system} sh
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/securing-ssh/securing-ssh.sh | ROOT_LOGIN=${ROOT_LOGIN:-yes} PASSWORD_LOGIN=${PASSWORD_LOGIN:-yes} X11_FORWARDING=no sh
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/bash-it/bash-it.sh | USER=root sh
curl -fsSL https://raw.githubusercontent.com/c18s/LinuxScripts/master/bash-it/bash-it.sh | USER=${USERNAME:-system} sh
cat /root/.ssh/authorized_keys 2>/dev/null > /etc/ssh/authorized_keys
cat /etc/resolv.conf > /etc/resolv.conf.backup && rm -rf /etc/resolv.conf && cat /etc/resolv.conf.backup > /etc/resolv.conf
mkdir -p /root/.config/htop && echo "color_scheme=6" > /root/.config/htop/htoprc
su -c "mkdir -p /home/${USERNAME:-system}/.config/htop && echo 'color_scheme=6' > /home/${USERNAME:-system}/.config/htop/htoprc" ${USERNAME:-system}
echo "set-window-option -g mode-keys vi" > /root/.tmux.conf
su -c "echo 'set-window-option -g mode-keys vi' > /home/${USERNAME:-system}/.tmux.conf" ${USERNAME:-system}
curl -fsSL get.docker.com | sh
usermod -aG docker ${USERNAME:-system}
@c18s
Copy link
Author

c18s commented Apr 27, 2018

Install options

Env variable USERNAME=system

  • This script will creating user system
  • User system can access root permission with sudo
  • User system can access docker and docker compose

Default

apt-get update && apt-get install -y curl && curl -fsSL https://git.io/vpjP0 \
| USERNAME=system sh

Advanced

  • Disable root login
  • Disable password login
  • SSH keys path /etc/ssh/authorized_keys
apt-get update && apt-get install -y curl && curl -fsSL https://git.io/vpjP0 \
 | USERNAME=system ROOT_LOGIN=no PASSWORD_LOGIN=no sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment