title: CentOS 安装 ss-server date: 2017-05-20 tag: 备忘录


由于 Digitalocean 位于旧金山的服务器实在是慢,ping 值高,就在网上瞎转,发现了 Google Cloud 位于台湾的服务器,无奈流量太贵,送的300美元的优惠也由于信息问题没有领到,气馁时发现三大运营商都可以直连日本,遂将服务器转至 Vultr ,同样是 CentOS 7 但是它与 Digitalocean 的配置方式有些不同,踩了很多坑,最后都通过 Google 解决了,将这些记录下来,下次可以参考。首先得感谢大家的分享精神。

首先需要安装pythonpipshadowcocks

yum install python-setuptools && easy_install pip
pip install shadowsocks

对SS进行配置

sudo vi /etc/shadowsocks.json

大概内容如下

{
    "server":"0.0.0.0", // 服务器IP 
    "server_port":8388, //服务器端口
    "local_address":"127.0.0.1", //本地地址
    "local_port":1080, //本地端口号
    "password":"MyPass", //密码
    "timeout":600, //超时时间
    "method":"chacha20" //加密方式,可选择 “bf-cfb”, “aes-256-cfb”, “des-cfb”, “rc4″
}

有需要的还可以配置多个端口

{
    "server":"你的 IP地址",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
          "8388":"123456",
          "8389":"123456",
             .......
      },
    "timeout":600,
    "method":"chacha20"
}

配置完成后就可以开启ss服务 ssserver -c /etc/shadowsocks.json -d start

设置开机启动

输入sudo vi /etc/rc.local,然后加入ssserver -c /etc/shadowsocks.json -d start,再:wq保存退出。

新版的centOS 7 默认打开了firewall防火墙,所以需要在进行端口设置才能科学上网。

防火墙开启需要设置的端口 firewall-cmd --zone=public --add-port=8388/tcp --permanent

命令含义:

–zone #作用域

–add-port=8388/tcp #添加端口,格式为:端口/通讯协议

–permanent #永久生效,没有此参数重启后失效

设置完防火墙后需要重启防火墙

firewall-cmd --reload

ok! 现在就可以科学上网了。