Skip to content

Instantly share code, notes, and snippets.

@cactaceae21
Last active January 7, 2022 15:08
Show Gist options
  • Save cactaceae21/7f627e527d59a1d09f7494fa7cffa27e to your computer and use it in GitHub Desktop.
Save cactaceae21/7f627e527d59a1d09f7494fa7cffa27e to your computer and use it in GitHub Desktop.
Linux New Systems

Debian mods

Install "ssh" and "standard system utilities" only

Vim

apt install -y vim vim-runtime
echo -e "colorscheme murphy\nsyntax on" > .vimrc

Utils

apt install -y git curl sudo open-vm-tools uuid-runtime
echo -e "\nalias ll='ls -lah'" >> /etc/bash.bashrc

usermod -a -G sudo <user>
usermod -a -G sudo debian

SSH Keys

mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
vi .ssh/authorized_keys

sudo vi /root/.ssh/authorized_keys

Installing Docker & Portainer

Docker (Ubuntu)

https://docs.docker.com/engine/install/ubuntu/

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install -y ca-certificates curl gnupg lsb-release
    
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Docker (Debian)

https://docs.docker.com/engine/install/debian/

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install ca-certificates curl gnupg lsb-release
    
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg    
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null  

Docker completion

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

sudo usermod -a -G docker <username>
sudo usermod -a -G docker debian

Docker Compose

https://docs.docker.com/compose/install/

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Portainer

https://docs.portainer.io/v/ce-2.9/start/install/agent/docker/linux

docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent

Ubuntu mods

SSH Keys

mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
vi .ssh/authorized_keys

sudo vi /root/.ssh/authorized_keys

Static IP

sudo vi /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      dhcp4: false
      addresses: [192.168.1.2/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [192.168.1.1]
      optional: false
  version: 2

Stop DNS Stub

sudo ln -rfs /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo vi /etc/systemd/resolved.conf
DNSStubListener=no

Tools

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