Skip to content

Instantly share code, notes, and snippets.

@kylebarron
Last active October 6, 2019 19:56
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 kylebarron/1b4391c9bcc768fa1a2bf6f0cc5988a0 to your computer and use it in GitHub Desktop.
Save kylebarron/1b4391c9bcc768fa1a2bf6f0cc5988a0 to your computer and use it in GitHub Desktop.
Starter code for new DO droplet
  1. Log on with ssh root@<public ip>.
  2. Add new user with adduser <username>.
  3. Give that new user sudo permissions with usermod -aG sudo <username>
  4. Copy ssh keys from root user to new user
    mkdir /home/<username>/.ssh
    cp ~/.ssh/authorized_keys /home/<username>/.ssh/
    chown <username> /home/<username>/.ssh/authorized_keys
    
  5. Log out and log on with that new user ssh <username>@<public ip>
  6. Update and install packages
    sudo apt update
    sudo apt upgrade -y
    
    sudo apt install -y zsh make
    git clone https://github.com/kylebarron/dotfiles.git /tmp/dotfiles
    git clone --depth=1 git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    cp /tmp/dotfiles/zsh/materialshell.zsh-theme ~/.oh-my-zsh/themes/
    cp /tmp/dotfiles/zsh/zshrc_desktop ~/.zshrc
    
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda3.sh
    bash /tmp/miniconda3.sh -b -p ~/local/miniconda3
    export PATH=$HOME/local/miniconda3/bin:$PATH
    
    sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) \
        stable"
    sudo apt-get update
    sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
    
    link="$(curl -s https://api.github.com/repos/zyedidia/micro/releases/latest | grep 'browser_download_url' | grep 'linux64' | cut -d '"' -f 4)"
    wget $link -O /tmp/micro.tar.gz
    mkdir /tmp/micro
    tar -xzvf /tmp/micro.tar.gz -C /tmp/micro --strip-components 1
    
    mkdir -p ~/local/bin
    mv /tmp/micro/micro ~/local/bin/
    
    mkdir -p ~/.config/micro
    cp /tmp/dotfiles/micro/* ~/.config/micro/
    
    
  7. Set ZSH as default shell chsh -s $(which zsh). (Then log out and back in to take effect).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment