Skip to content

Instantly share code, notes, and snippets.

@phyng
Created January 17, 2020 16:53
Show Gist options
  • Save phyng/e5efe18a24a55f64ec5bffeb9f36c4d9 to your computer and use it in GitHub Desktop.
Save phyng/e5efe18a24a55f64ec5bffeb9f36c4d9 to your computer and use it in GitHub Desktop.

Revisions

  1. phyng created this gist Jan 17, 2020.
    73 changes: 73 additions & 0 deletions ubuntu-server-start.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,73 @@

    # Ubuntu Server Start

    ## login as root

    ```bash
    # base
    apt update
    apt upgrade
    apt install wget curl git vim htop tree byobu zsh

    # add user
    adduser ubuntu
    visudo
    # add new line in [User privilege specification] block:
    # ubuntu ALL=(ALL:ALL) ALL

    # exit and login as ubuntu
    ```

    ## config zsh

    ```bash
    # install oh my zsh
    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    # set default to zsh

    # add plugins
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions

    # zshrc config start
    plugins=(git zsh-autosuggestions zsh-completions colorize colored-man-pages)
    bindkey '^E' autosuggest-accept
    setopt EXTENDED_HISTORY
    export HISTSIZE=1000000000
    export SAVEHIST=$HISTSIZE
    export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=3"

    # end
    source /home/ubuntu/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    # zshrc config end
    ```

    ## install utils

    ```
    sudo apt-get install silversearcher-ag
    ```

    ## install docker

    ```bash
    # https://docs.docker.com/install/linux/docker-ce/ubuntu/
    sudo apt-get remove docker docker-engine docker.io containerd runc
    sudo apt-get update
    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 apt-key fingerprint 0EBFCD88
    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 docker-ce docker-ce-cli containerd.io
    sudo docker run hello-world
    ```