使用Ubuntu, Docker, Hexo, Caddy更新服务器日志

初始配置服务器

使用的是一个Ubuntu 14.04 KVM 1G RAM 20G Raid10 SSD
修改SSH登录端口,密码。

安装docker

1
2
3
4
5
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

Add Docker’s official GPG key:

1
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add

Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.

1
2
3
4
5
6
$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker@docker.com>
sub 4096R/F273FCD8 2017-02-22

Use the following command to set up the stable repository. You always need the stable repository, even if you want to install edge builds as well.

Note: The lsb_release -cs sub-command below returns the name of your Ubuntu distribution, >such as xenial.

Sometimes, in a distribution like Linux Mint, you might have to change $(lsb_release -cs) to >your parent Ubuntu distribution. For example: If you are using Linux Mint Rafaela, you could use >trusty.

amd64:

1
2
3
4
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Install Docker

1
2
$ sudo apt-get update
$ sudo apt-get install docker-ce

On production systems, you should install a specific version of Docker instead of always using the latest. This output is truncated. List the available versions. For Docker EE customers, use docker-ee where you see docker-ce.

1
2
3
$ apt-cache madison docker-ce
docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd6

本节内容参考https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository

安装Shadowsocks

使用docker

1
2
$ sudo docker pull oddrationale/docker-shadowsocks
$ sudo docker run --name shadowsocks -d -p 57:38518 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 38518 -k your_password -m aes-256-cfb -t 600

看一下是不是在运行

1
$ sudo docker ps

看一下所有容器,不管是不是在运行

1
$ sudo docker ps -a