怎样在Ubuntu上搭建SS服务器,Linux

技术文章 litterfat 5年前 (2018-12-10) 17609次浏览 已收录 扫描二维码

大家好,很多朋友因为一些“你懂的”原因需要自己搭建一些 SS服务器,但是又不知从何开始下手,到处找各种搭建 ss 服务的教程。今天,小编尽量用通俗易懂且精简的代码为大家介绍一下怎样在Ubuntu上搭建 SS 服务。
希望能帮您快速搭配好 SS 服务,如果觉得文章不错,建议收藏到浏览器,以备查阅。
怎样在 Ubuntu 上搭建 SS 服务器?

服务端的安装与运行

1. 安装 pip 环境

通过 Putty 等软件登录 Linux 后,输入以下命令来安装 pip 环境:

Ubuntu / Debian

apt-get install python-pip

CentOS

yum install python-setuptools && easy_install pip

在需要时输入 Y 后按回车确认。

2. 直接安装 shadowsocks

pip install shadowsocks

如果出现

Command “python setup.py egg_info” failed
错误信息,则输入

pip install --upgrade pip

命令后,再执行上面的操作。

如果出现

Could not import setuptools which is required to install from a source distribution
错误信息,则输入

pip install setuptools

命令后,再执行上面的操作。


如果出现 pip 问题:Traceback (most recent call last): File “/usr/bin/pip”, line 9, in
解决方法:

将 /usr/bin/pip 文件中:
from pip import main
if __name__ == ‘__main__’:
sys.exit(main())
改为:
from pip import __main__
if __name__ == ‘__main__’:
sys.exit(__main__._main())

(注意,标点都为英文半角,直接复制可能有误!)

3. 配置并运行 shadowsocks

sudo ssserver -p 8388 -k password -m rc4-md5 -d start

SS 端口默认为 8388;
password 为自定义的登录密码;
加密方式有 bf-cfb / aes-256-cfb / des-cfb /rc4 等可选,推荐使用 rc4-md5,因为 rc4-md5 比 aes-256-cfb 速度快好几倍。

至此,SS 服务端已经配置完成了。

SS 优化与加速

1. 编辑文件 limits.conf

确认 Linux 内核版本为 3.5 以上,可用 uname -a 命令查看。

关闭 SS 服务

sudo ssserver -p 8388 -k password -m rc4-md5 -d stop

编辑文件 limits.conf

vi /etc/security/limits.conf

增加以下两行

设置以下参数

2. 调整内核参数

修改配置文件 /etc/sysctl.conf

vi /etc/sysctl.conf

加入以下内容

修改后执行

使配置生效,并重新 start SS 服务。

附:查看当前 ss 服务器所开放的端口

ss -lntp | grep ssserver

附:查看当前 ss 服务器的密码,通过以下命令可见 ss 的配置文件,配置文件中自然有密码

ps aux | grep ssserver

 

Tips:某些 update 操作后,关于 shadowsocks 服务报错问题。

国外 VPS 推荐:Vulter.com

怎样在 Ubuntu 上搭建 SS 服务器,Linux


喜欢 (26)
Searching for the best XXX images on the web? Look no further than our premier destination for all things erotic. the highest quality content on the web, with crystal clear video and audio that will make you feel like you're right there in the action https://eroticpictures.org/