Setup basic environment

Config Interface

sudo vi /etc/network/interface

Update the config like this

iface eth0 inet static
    address 172.16.2.1
    netmask 255.255.255.0
    gateway 172.16.2.254
    dns-nameservers 1.1.1.1 8.8.8.8

Restart services and flush the ip binded to interface before

sudo ip addr flush dev eth0
sudo systemctl restart networking

How to bring interface up/down

  1. Using ip

    Usage:

     # ip link set dev <interface> up
     # ip link set dev <interface> down

    Example:

     # ip link set dev eth0 up
     # ip link set dev eth0 down
  2. Using ifconfig

    Usage:

     # /sbin/ifconfig <interface> up
     # /sbin/ifconfig <interface> down

    Example:

     # /sbin/ifconfig eth0 up
     # /sbin/ifconfig eth0 down

Update apt-get repo list and set timezone

sudo apt-get upgrade && sudo apt-get update
tzselect

Update HWE

Mainly for Ubuntu 16.04

You may use lsb_release -a to check the OS version first

$ sudo apt-get update && sudo apt-get upgrade

$ sudo apt-get install --install-recommends linux-generic-hwe-16.04 xserver-xorg-hwe-16.04

Install docker and docker compose

Install Docker

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    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 docker-ce

Reference

Install Docker Compose

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

$ sudo chmod +x /usr/local/bin/docker-compose

Reference

Install Space VIM

# Linux
$ sudo apt-get install -y build-essential
# For both Linux and mac
$ curl -sLf https://spacevim.org/install.sh | bash
# After the installation, run `vim`, it will automatically down the plugin. 
$ vim

Quick start guide | SpaceVim

Trouble-shot

SpaceVim中vimproc的vimproc_linux64.so未找到

# For Linux, execute in vim 
:VimProcInstall
# For mac
$ cd ~/.cache/vimfiles/repos/github.com/Shougo/vimproc.vim && sudo make
# OR
$ cd ~/.vim/bundle/vimproc.vim && git pull & sudo make

Login to the docker hub

This part will be conducted by Danny sudo docker login

Install htop

$ sudo apt-get install htop

Set ulimit

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Set max virtual memory

set the parameters vm.max_map_countin /etc/sysctl.conf echo vm.max_map_count=262144 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

OR

run command (will be reset after reboot): sudo sysctl -w vm.max_map_count=262144

Reference 1 / Reference 2

Setup the log rotation for docker

Configure the default logging driver This can be done by adding the following values in /etc/docker/daemon.json. Create this file if it doesn’t exist.

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "10"
  }
}

Execute the following commands to reload the updated daemon.json. The new configuration will apply to all newly created containers after restart.

$ sudo systemctl restart docker

Last updated