# Ubuntu 搭建 SSR 记录

## 1. 服务器的选择

首先搭建要有一个国外的服务器，我个人使用的是 Vultr ，用起来还不错，而且还支持快速的更换IP（这个我非常喜欢的）下面是我的推荐连接，有优惠哟！！！

<https://www.vultr.com/?ref=7447973>

除了 Vultr 的服务器大家也可以选择其他的服务器，只要是能够访国外的网站就可以。

## 2. 搭建 SSR 服务

搭建先用手动的方式一步步的进行安装，稍后我会写一个脚本来实一键自动安装。

### 2.1 手动进行安装

安装所需要的环境：Git 和 Python

{% code title="Git" %}

```bash
#查看是否安装git
git --version
#如果没有安装则执行进行安装
apt-get install git
```

{% endcode %}

{% code title="Python" %}

```bash
#查看是否安装Python
python -V
#如果未安装则进行安装,
apt-get install python2.7
```

{% endcode %}

{% hint style="info" %}
Ubuntu默认已经集成 Python 2.7，如果卸载了可以通过命令进行安装，如果想安装 python 其他版本可以在末尾添加相应的版本号，比如安装 3.6版本:&#x20;

`apt-get install python3.6`
{% endhint %}

从 GitHub 下载 SSR 源码，`git clone` 默认是下载当前路径，所在在执行之前最好是先创建一个专门存放 SSR 的文件夹，`/home` 或者`/opt` 下即可。

{% code title="下载 SSR 源码" %}

```bash
git clone https://github.com/ctwteam/shadowsocksr-origin.git
```

{% endcode %}

接下来就是配置 SSR, 该配置文件路径为 `./shadowsocks/user-config.json`

{% code title="user-config.json" %}

```
{
    "server": "0.0.0.0",
    "server_ipv6": "::",
    "server_port": 8388,
    "local_address": "127.0.0.1",
    "local_port": 1080,

    "password": "passWord",
    "method": "aes-256-cfb",
    "protocol": "auth_aes128_md5",
    "protocol_param": "param",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "param",
    "speed_limit_per_con": 0,
    "speed_limit_per_user": 0,

    "additional_ports" : {}, 
    "additional_ports_only" : false,
    "timeout": 120,
    "udp_timeout": 60,
    "dns_ipv6": false,
    "connect_verbose_info": 0,
    "redirect": "",
    "fast_open": false
}
```

{% endcode %}

上面是默认的配置，使用的时候根据自己的需要配置即可。下面是常用的参数介绍：

| 标题              | 描述                      |
| --------------- | ----------------------- |
| server          | 服务IP，默认是 0.0.0.0 （本机IP） |
| server\_port    | SSR 服务运行的端口             |
| local\_address  | 本地IP，默认是 127.0.0.1      |
| local\_port     | 本地端口                    |
| password        | SSR 密码（切记： 一定要修改）       |
| method          | 加密方式                    |
| protocol        | 协议                      |
| protocol\_param | 协议参数                    |
| obfs            | 混淆                      |
| obfs\_param     | 混淆参数                    |

加密方式、协议和混淆直接在下面选取一个即可，至于协议参数和混淆参数随便填就行，只要客户端填写的时候保持一致即可。

{% hint style="info" %}
常用的 `method` 加密方式有: none、aes-256-cfb、aes-192-cfb、aes-128-cfb、aes-256-cfb8、aes-192-cfb8、aes-128-cfb8、aes-256-ctr、aes-192-ctr、aes-128-ctr、chacha20-ietf、chacha20、salsa20、xchacha20、xsalsa20、rc4-md5。

常用的 `protocol` 协议有：origin、verify\_deflate、auth\_sha1\_v4、auth\_sha1\_v4\_compatible、auth\_aes128\_md5、auth\_aes128\_sha1、auth\_chain\_a、auth\_chain\_b、auth\_chain\_c、auth\_chain\_d、auth\_chain\_e、auth\_chain\_f

常用的 `obfs` 方式有: plain、http\_simple、http\_simple\_compatible、http\_post、http\_post\_compatible、tls1.2\_ticket\_auth、tls1.2\_ticket\_auth\_compatible、tls1.2\_ticket\_fastauth、tls1.2\_ticket\_fastauth\_compatible
{% endhint %}

接下来就是启动 SSR 服务：

```bash
#后台启动
./logrun.sh
```

{% hint style="info" %}
`python server.py` 存在点问题，直接使用以上的后台命令运行就行。
{% endhint %}

关闭 SSR 服务:

```
./stop.sh
```

查看SSR运行日志:

```
./tail.sh
```

## 3. SSR 客户端的下载

{% file src="<https://3615000802-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhVpkMPKXT2O48vRa5b%2F-LhWN1b3wFj64wQHmluq%2F-LhWN6RKgtWflYQgSAAl%2FShadowsocksX-NG-R8.zip?alt=media&token=54252297-e1a4-4547-8b3e-8dbe7d4adec7>" %}
MacOS ShadowsocksX-NG-R8 下载
{% endfile %}

{% file src="<https://3615000802-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhVpkMPKXT2O48vRa5b%2F-LhZjpTKSOsL39qzreAB%2F-LhZk2ilJJW-Oif86eUu%2Fshadowsocksr-android-3.5.4.zip?alt=media&token=8561bda7-399f-49a5-aa6b-adac19778a36>" %}
Android SSR 客户端下载
{% endfile %}

{% file src="<https://3615000802-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhVpkMPKXT2O48vRa5b%2F-LhZjpTKSOsL39qzreAB%2F-LhZkGASUfFnEpTqduiD%2FShadowsocksR-win-4.9.2.zip?alt=media&token=f23dcb8b-a2a2-44af-86d2-f8f2b92236e7>" %}
Windows SSR 客户端下载
{% endfile %}

{% hint style="info" %}
IOS 版国内暂时不提供 VPN 软件下载，但是可以去网上搜索一些国外的Apple ID进行下载，推荐使用 Potatso Lite。

Apple Store (香港) : <https://apps.apple.com/hk/app/potatso-lite/id1239860606>\
其他国家的大家直接搜索就行。
{% endhint %}

## 4. 免费SSR结点推荐

如果不想搭建可以使用共享的免费结点，不定期更新：

<https://free-ss.site/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.cppnote.cn/ubuntu-ssr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
