引言:
安装了 Ubuntu 系统想要来配置一下 Shadowsocks
,才发现 KiwiVM 控制面板上 【KiwiVM Extras
】 中 【Shadowsocks Server
】的安装说明:
Shadowsocks server is currently not installed.
This page allows you to install and automatically configure the Shadowsocks server.
Supported OS: Centos 6 (32 or 64 bit)
即只支持 CentOS 6.x 的版本(难怪默认安装 CentOS 6.8 的系统),并不支持 Ubuntu 系列,下面是 Ubuntu 配置 Shadowsocks
的过程。
环境准备:
1.安装 Docker :
docker 是个好东西,一方面可以让我们在同一台机器上为不同应用构建各自独立的配置环境,另一方面又方便我们直接使用别人配置好的配置环境镜像,所以先要安装 Docker,Ubuntu 下安装 Docker 的操作如下:
先更新一下
apt-get
的资源库:sudo apt-get update
安装 http 请求工具:
sudo apt-get install apt-transport-https ca-certificates
添加新的 GPG 密钥:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
向系统的 source 列表中添加或修改其
docker.list
文件:sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
此操作的功能就是将
/etc/apt/source.list.d
列表中的docker.list
的内容设置为deb https://get.docker.io/ubuntu docker main\
。
再次更新
apt-get
删掉老的repo
(资源),并根据上面docker.list
中的配置拉取 docker 的资源:root@ubuntu:~# sudo apt-get update Ign:1 https://get.docker.io/ubuntu docker InRelease Get:2 https://get.docker.io/ubuntu docker Release [1,525 B] Get:3 https://get.docker.io/ubuntu docker Release.gpg [473 B] Get:4 https://get.docker.io/ubuntu docker/main amd64 Packages [6,507 B] Hit:5 http://us.archive.ubuntu.com/ubuntu xenial InRelease Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB] Get:7 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB] Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Fetched 315 kB in 33s (9,500 B/s) Reading package lists... Done W: https://get.docker.io/ubuntu/dists/docker/Release.gpg: Signature by key 36A1D7869245C8950F966E92D8576A8BA88D21E9 uses weak digest algorithm (SHA1)
直接使用
apt-get
工具安装:sudo apt-get install docker-engine
版本查询:
docker --version
2.安装 Shadowsocks :
可以直接到 Docker Hub 搜索可用的 shadowsocks 镜像,这里我选择了 oddrationale/docker-shadowsocks
这个镜像,直接使用 docker 指令下载镜像:
docker pull oddrationale/docker-shadowsocks
启动一个 shadowsocks 服务:
docker run -d --name shadowsocks1 -p 2017:2017 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 2017 -k 123456 -m aes-256-cfb
-name
是通过镜像生成的容器的名称;-p
连接到此服务的端口号;-k
连接的 ssh 密码;-m
是加密方式。
启动完成后,可以通过 docker 指令查询正在运行的服务:
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f023a6d6db97 oddrationale/docker-shadowsocks "/usr/local/bin/ss..." 13 minutes ago Up 13 minutes 0.0.0.0:2017->2017/tcp shadowsocks1
到此服务就启动完毕了,接下来就是使用自己的 ssh 客户端工具,设置连接服务器:
- IP 地址为:服务器 IP
- 远程端口:2017
- 密码:123456
- 加密方式:
aes-256-cfb