安装Shadowsocks
我们安装的是shadowsocks-libev,基于C语言开发,速度和性能应该不错。 安装依赖库yum install epel-release -y yum install gcc gettext autoconf libtool automake make openssl-devel pcre-devel asciidoc xmlto zlib-devel openssl-devel libsodium-devel udns-devel libev-devel -y 更新repo添加yum仓库,以便下载Shadowsocks wget https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo 为避免链接失效,备注repo文件内容如下: [librehat-shadowsocks] name=Copr repo for shadowsocks owned by librehat baseurl=https://copr-be.cloud.fedoraproject.org/results/librehat/shadowsocks/epel-7-$basearch/ type=rpm-md skip_if_unavailable=True gpgcheck=1 gpgkey=https://copr-be.cloud.fedoraproject.org/results/librehat/shadowsocks/pubkey.gpg repo_gpgcheck=0 enabled=1 enabled_metadata=1 下载完成后,将文件复制到/etc/yum.repos.d/目录下面 cp librehat-shadowsocks-epel-7.repo /etc/yum.repos.d/ 更新yum源,安装Shadowsocks yum update yum install shadowsocks-libev 配置Shadowsocks配置文件路径为:/etc/shadowsocks-libev/config.json vi /etc/shadowsocks-libev/config.json 参考配置文件如下 { "server":"0.0.0.0", "server_port":8388, "password":"password", "method":"aes-256-cfb", "mode":"tcp_and_udp" } 各项作用的描述
配置完成之后,可以使用命令行启动Shadowsocks /usr/bin/ss-server -c /etc/shadowsocks-libev/config.json 添加成系统服务不想每次都使用命令行启动,可以考虑将之添加到系统服务,并加入自启动 vi /usr/lib/systemd/system/shadowsocks.service [Unit] Description=Shadowsocks Server Documentation=https://github.com/shadowsocks/shadowsocks After=network.target [Service] Type=simple User=nobody ExecStart=/usr/bin/ss-server -c /etc/shadowsocks-libev/config.json ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true KillMode=process [Install] WantedBy=multi-user.target 然后就可以以服务的方式管理 systemctl start shadowsocks systemctl enable shadowsocks systemctl stop shadowsocks 开启防火墙看系统使用的是什么防火墙,我系统中使用的是firewall firewall-cmd --zone=public --add-port=8388/tcp --permanent firewall-cmd --zone=public --add-port=8388/udp --permanent firewall-cmd --reload 查看日志journalctl | grep ss-server 进一步了解查看https://github.com/shadowsocks/shadowsocks/wiki/Optimizing-Shadowsocks (责任编辑:IT) |