Skip to content

Instantly share code, notes, and snippets.

@Nakilon
Last active July 28, 2023 00:42
Show Gist options
  • Save Nakilon/0c0cef36c44f4b1ce9319616ca877ec4 to your computer and use it in GitHub Desktop.
Save Nakilon/0c0cef36c44f4b1ce9319616ca877ec4 to your computer and use it in GitHub Desktop.
ubuntu
if configured openssh during installation with 'ubuntu' user:
edit dev:~/.ssh/config and then: ssh ubuntu@...
$ sudo useradd nakilon
$ adduser nakilon sudo
$ echo "nakilon ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/dont-prompt-nakilon-for-sudo-password && chmod 440 /etc/sudoers.d/dont-prompt-nakilon-for-sudo-password
$ mkdir -p /home/nakilon/.ssh
$ sudo cp ~/.ssh/authorized_keys /home/nakilon/.ssh/
$ sudo chmod 700 /home/nakilon/.ssh
$ sudo chmod 600 /home/nakilon/.ssh/authorized_keys
$ sudo chown -R nakilon:nakilon /home/nakilon
else:
$ sudo su
$# mkdir ~/.ssh
$# curl https://github.com/nakilon.keys >> .ssh/authorized_keys
$# useradd nakilon
$# adduser nakilon sudo
$# echo "nakilon ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/dont-prompt-nakilon-for-sudo-password && chmod 440 /etc/sudoers.d/dont-prompt-nakilon-for-sudo-password
#$ mkdir -p /home/nakilon/.ssh
$# cp ~/.ssh/authorized_keys /home/nakilon/.ssh/
$# chmod 700 /home/nakilon/.ssh
$# chmod 600 /home/nakilon/.ssh/authorized_keys
$# chown -R nakilon:nakilon /home/nakilon
then
edit dev:~/.ssh/config and ressh as nakilon
$ sudo chsh -s /bin/bash $(whoami)
ressh
# $ sudo apt install -y curl
$ sudo apt install -y tree htop nano rsync screen git
$ nano ~/.bash_profile
export HISTFILESIZE=100500
export HISTSIZE=100500
export HISTCONTROL=ignoredups:ignorespace
export HISTTIMEFORMAT='%F %T '
export PROMPT_COMMAND="history -a; if [[ -e CATME.txt && \"\$PWD\" != \"\$HOME\" && \"\$(history 1 | awk '{print \$4;}')\" == 'cd' ]]; then cat CATME.txt; fi;"
export EDITOR=nano
append some stuff about color and such from ~/.bashrc or /home/ubuntu/.bashrc
$ source ~/.bash_profile
(https://help.ubuntu.com/community/SwapFaq)
check swap
$ cat /proc/swaps
$ free
$ htop
$ swapon --show
if there is no swap
$ sudo fallocate -l 8g /mnt/disks/swap/swapfile
$ sudo chmod 600 /mnt/disks/swap/swapfile
$ sudo mkswap /mnt/disks/swap/swapfile
$ sudo swapon /mnt/disks/swap/swapfile
check swap
$ echo '/mnt/disks/swap/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
else resize /swap.img if needed
$ sudo swapoff /swap.img
$ sudo rm /swap.img
$ sudo fallocate -l 1g /swap.img
$ sudo chmod 600 /swap.img
$ sudo mkswap /swap.img
$ sudo swapon /swap.img
check swap
generate keys (for example, for github deploy access)
(https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
$ ssh-keygen -t ed25519 -C ubuntu
docker
install
(https://stackoverflow.com/q/61401626/322020)
$ sudo apt install -y docker.io
to disable shutting down on Ubuntu's "daily upgrade": $ sudo apt-mark hold docker.io
check autorun
$ sudo systemctl is-enabled docker.service
$ sudo systemctl is-enabled containerd.service
ability to not prepend sudo
$ sudo usermod -aG docker $USER # 'Log out and log back in so that your group membership is re-evaluated.'
$ newgrp docker # not sure why it asked password and now just logs me in as root -- maybe because I didn't relogin
check: $ docker ps
$ sudo apt install -y docker-compose
compose-launcher
(https://github.com/rbenv/rbenv)
$ sudo apt install -y rbenv
$ ssh-keygen -C <machine name>
$ git clone git@github.com:Nakilon/trash.git ~/_/compose-launcher
$ cd ~/_/compose-launcher/servers/... && ruby ../compose-launcher.rb
for hotfixes do the edits in the corresponding ~/_/ dir, not in the ~/_/compose-launcher/servers/...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment