Skip to content

Instantly share code, notes, and snippets.

@levlaz
Last active July 11, 2019 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levlaz/0e137faa6065d8b2c8ca8f94def3a3a0 to your computer and use it in GitHub Desktop.
Save levlaz/0e137faa6065d8b2c8ca8f94def3a3a0 to your computer and use it in GitHub Desktop.
Ubuntu Init Notes

Add New User

adduser $USERNAME

Make vim default editor

sudo update-alternatives --config editor

Select /usr/bin/vim.basic

Allow passwordless sudo

visudo 

... 

# User privilege specification
$USER ALL=(ALL) NOPASSWD:ALL

Disable root login and remote password login

sudo vim /etc/ssh/sshd_config

PermitRootLogin no 
PasswordAuthentication no

Restart sshd with sudo systemctl restart sshd

Add all your GitHub keys

mkdir .ssh
wget https://github.com/$USER.keys
mv $USER.keys authorized_keys

Set Hostname

sudo vim /etc/hostname 

...

hostname -F /etc/hostname

Log out and log back in to take effect.

Add Some swap

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Docker

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
sudo apt install docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment