{"id":13539547,"url":"https://github.com/zhaoweih/shadowsocks-tutorial","last_synced_at":"2025-05-14T06:14:24.034Z","repository":{"id":41384261,"uuid":"129177893","full_name":"zhaoweih/Shadowsocks-Tutorial","owner":"zhaoweih","description":"🐱给小白的Shadowsocks翻墙教程-Easy-to-follow tutorials for beginners on using Shadowsocks to bypass internet restrictions.","archived":false,"fork":false,"pushed_at":"2025-02-06T15:04:37.000Z","size":10999,"stargazers_count":2231,"open_issues_count":1,"forks_count":498,"subscribers_count":49,"default_branch":"main","last_synced_at":"2025-04-05T22:02:11.997Z","etag":null,"topics":["aliyun","chatgpt","clash","digitalocean","fanqiang","gfw","iptables","kcptun","outline","pac","potatso-lite","shadowrocket","shadowsock-tutorial","shadowsocks","transmit","trojan","v2ray","vps","vultr","xshell"],"latest_commit_sha":null,"homepage":"https://github.com/zhaoweih/Shadowsocks-Tutorial/issues","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhaoweih.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-12T01:56:10.000Z","updated_at":"2025-04-04T15:21:08.000Z","dependencies_parsed_at":"2022-07-14T17:00:32.779Z","dependency_job_id":"bb0eceb7-360c-4c06-ab30-5f2b84eedea6","html_url":"https://github.com/zhaoweih/Shadowsocks-Tutorial","commit_stats":{"total_commits":120,"total_committers":2,"mean_commits":60.0,"dds":"0.16666666666666663","last_synced_commit":"145dbdb214b9a2c4024c1a7fa56d5a97e942485f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaoweih%2FShadowsocks-Tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaoweih%2FShadowsocks-Tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaoweih%2FShadowsocks-Tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaoweih%2FShadowsocks-Tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhaoweih","download_url":"https://codeload.github.com/zhaoweih/Shadowsocks-Tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248646037,"owners_count":21138928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","chatgpt","clash","digitalocean","fanqiang","gfw","iptables","kcptun","outline","pac","potatso-lite","shadowrocket","shadowsock-tutorial","shadowsocks","transmit","trojan","v2ray","vps","vultr","xshell"],"created_at":"2024-08-01T09:01:27.670Z","updated_at":"2025-04-12T23:27:26.712Z","avatar_url":"https://github.com/zhaoweih.png","language":null,"funding_links":[],"categories":["\u003ca id=\"1a9934198e37d6d06b881705b863afc8\"\u003e\u003c/a\u003e通信\u0026\u0026代理\u0026\u0026反向代理\u0026\u0026隧道","\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"f932418b594acb6facfc35c1ec414188\"\u003e\u003c/a\u003eSocks\u0026\u0026ShadowSocksXx","\u003ca id=\"cb16466a31a167bb61f39e2a4a85f449\"\u003e\u003c/a\u003eShadowsocks"],"readme":"[🌏English Version](./README_en.md)\n\n**[全部文章目录](https://github.com/zhaoweih/Shadowsocks-Tutorial/wiki/%E7%9B%AE%E5%BD%95)**\n\n\u003e 🚀安装成功后如果想加速Shadowsocks的小伙伴可以看看我这篇文章[给小白的kcptun加速shadowsocks教程](./kcptun_shadowsocks_tutorial.md)(效果很明显)\n\u003e\n\u003e 如果过程中出现问题无法解决可以发送邮件到我邮箱zhaoweihao.dev@gmail.com  或者[提issues](https://github.com/zhaoweih/Shadowsocks-Tutorial/issues)\n\u003e\n\u003e 如果工程师朋友们需要加速git克隆速度可以查看这篇文章[给小白的git配置shadowsocks代理加速教程](./git/git_shadowsocks_readme.md)\n\n# 前言\n\n为什么要做这个库？因为有句话说“不会翻墙的程序员不是好程序员”，但是某些原因，翻墙可是越来越难了，我之前是用某灯，但是自从上个月开始某灯也不稳定了；我还以为可以和某灯相宿相飞一段时间的，后来就投靠了Shadowsocks了，为什么会选择Shadowsocks呢，因为可以自己搭建服务器，不再受牵制，而且由于是个人服务器被封IP的几率也不会很大；当然你也可以和自己信任的人共享使用，但是Shadowsocks的教程网络上真是参次不齐，很容易误导那些只想翻墙而不是要了解它原理的人，所以我就蹦出个想法：做个几乎是一键式的傻瓜Shadowsocks（以下简称ss）搭建教程给小白们，让大家都能共享自由的互联网。\n\n# 开始\n\n## 购买VPS服务器\n\n俗话说，万事起头难。想想倒也是这样，也不是说购买VPS服务器有多难，是接受它比较难，我当时也是一个还没买过服务器的小白，对于第一次尝试的东西都没有底，怎么敢随意下手。好了，你现在可以放心了，据我使用，Vultr和DigitalOcean这两个服务商都是可以随时部署随时摧毁服务器，是按每小时计费的，一个月是5美金，大概0.007美金一小时，就算你创建一个服务器IP刚好是被某墙屏蔽了，那就删掉也只是扣0.1美金，作为一个穷学生的我都能接受了，你还犹豫吗？\n\n### 1、注册并登录\n\n[\u003cimg src=\"./images/logo_onwhite.svg\" alt=\"alt text\" title=\"vultr\" style=\"zoom: 50%;\" /\u003e](https://www.vultr.com/?ref=7370522)\n\nVultr推荐链接：https://www.vultr.com/?ref=7370522\n\n这里我比较推荐Vultr，为什么呢？因为他有日本服务器，延迟低，掉包也低； 注册登录后先充值5美金，用paypal绑定国内银行卡可以最低充值5美金，当然也有支付宝，支付宝要最低10美金。\n\n![](./images/make_a_payment.png)\n\n### 2、部署服务器\n\n第一步：在个人页面点击Products然后再点右面的➕号按钮添加一个服务器\n\n![](./images/choose_server.png)\n\n在右上角选择**Switch back to the old experience for a limited time**切换回经典视图\n\n![](./images/switch_back.png)\n\n选择**Cloud Compute**\n\n![](./images/choose_type.png)\n\n第二步：在打开的页面选择德国Frankfurt服务器 (由于日本服务器滥用导致很多IP被封了，可以选择欧洲服务器，例如法国、德国等) ，如果喜欢其他服务器也可以选择，后续操作是一样一样的\n\n![](./images/choose_location.png)\n\n第三步：接下来要注意了，系统最好选择**CentOS 9 x64**，点击CentOS可以下拉选择9 x64\n\n![](./images/choose_system.png)\n\n第四步：选择套餐，当然ss不需要配置太高的服务器，最低配置5美金一个月的就可以了，反正我每次看2.5美金都是卖光的，如果你能看到那赶紧选啊，千年一遇。\n\n![](./images/choose_plan.png)\n\n记得**取消选中自动备份**(会收1美金/月)\n\n![](./images/auto_backup.png)\n\n第五步：接着就是部署起来了，当然你也可以给服务器起个名字再部署\n\n![](./images/6.png)\n\n第六步：接着等待服务器启动完成，看到Status是绿色的Running就是启动完成了，这个过程大概需要1-3分钟。\n\n![](./images/7.png)\n\n第七步：复制IP地址和密码，后面有用\n\n![](./images/server_info.png)\n\n第八步：启动完成后，当然测试一下有没有被封掉IP了，打开命令管理器或者终端，输入 ping+你的IP地址，例如我服务器IP是8.8.8.8，则ping 8.8.8.8，如果出现下图的返回信息则这个IP是可以用的，偶尔一个request timeout也是可以的，是掉包现象，如果出现一直request timeout就把这服务器删掉重新部署吧。\n\n![](./images/10.png)\n\n好了，到此为止最困难的事情已经过去了，后面都是一键式的了，喝杯茶🍵再继续。\n\n## 在服务器安装ss\n\n因为我是用mac的，考虑到大多数人还是使用windows为主，我就把我的旧电脑给翻出来开机继续做教程。基于windows 7。\n\n- **如果你是用mac，那恭喜你，下面连接的步骤直接打开终端输入**\n\n`ssh root@你的服务器IP地址`\n\n**连接就可以，然后可以跳过安装并运行xshell这个步骤**\n\n\n\n- **如果你是用windows10,可以打开系统自带的powershell工具:**\n\n\n\n\n\n![](./images/powershell_windows_menu.png)\n\n**输入**\n\n`ssh root@你的服务器IP地址`\n\n![](./images/powershell_run.png)\n\n**连接就可以，然后可以跳过安装并运行xshell这个步骤**\n\n### 安装并运行xshell\n\n**提示：如果服务器可以ping通，但xshell无法连接说明服务器被封端口了（很多vultr日本服务器有这种状况），请更换其他地区服务器或者更换服务器商**\n\nwindows下ssh连接需要下载Xshell，百度搜一搜就能下载了，当然你也可以用其他的，这里以Xshell为例，安装好Xshell后点击文件-新建\n\n![](./images/w-1.png)\n\n接下来配置连接,名称随便起，主机填写你的服务器IP地址，下面都默认就好\n\n![](./images/w-2.png)\n\n接下来在弹出的窗口填root（默认服务器用户名）\n\n![](./images/w-3.png)\n\n这里就要填入你在上篇复制的服务器密码了\n\n![](./images/w-4.png)\n\n### 安装ss\n\n上面登录成功后如图所示\n\n![](./images/w-5.png)\n\n下面就是精髓的部分了，感谢[@teddysun](https://github.com/teddysun)大佬制作的一键安装脚本，具体更多细节可查看博客：https://teddysun.com/486.html  (由于大佬的[退出](https://teddysun.com/548.html),所以下面的命令目前还可以使用，但是版本已经不再更新)\n\n```bash\nwget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh\nchmod +x shadowsocks-all.sh\n./shadowsocks-all.sh 2\u003e\u00261 | tee shadowsocks-all.log\n```\n\n复制粘贴上面代码到xshell，在xshell要右键粘贴，然后就会有一大串不知名代码蹦出，停在这里了\n\n![](./images/w-6.png)\n\n这时候按一下**Enter回车键**它又可以继续了～\n\n接着又蹦出些东西，是让我们选择ss的服务器端，这里我选择libev版本的，输入**4**按回车\n\n![](./images/libev/1.png)\n\n如同往常，接下来是要填入ss客户端登录的密码，这里我随意填：**abc123456**\n\n![](./images/libev/2.png)\n\n接下来是输入端口号（1-65535任意数字），这里我随便填个**12853**的\n\n![](./images/libev/3.png)\n\n接下来是选择加密方式，最好选择xchacha20-ietf-poly1305，输入**13**\n\n![](./images/libev/4.png)\n\n接着是否需要开启simply-obfs插件，默认就行，**回车**\n\n![](./images/libev/5.png)\n\n接着又是反手一个**回车**就好\n\n![](./images/libev/6.png)\n\n这里可能需要等待一会，看到下图就是大功告成了。干杯🍻！\n\n这个最好截图一下，以防忘记了。\n\n我就当大家英文水平还好吧，下面说的就是你的服务器IP，服务器端端口，密码，加密方式。\n\n![](./images/libev/7.png)\n\n⚠️注意：最后需要关闭下系统的防火墙，粘贴下面的命令然后回车就行\n\n```bash\nsystemctl stop firewalld\nsystemctl disable firewalld\n```\n\n## 下载客户端\n\n如果你跟着我到了这一步就代表安装好了服务器端，但是我们的电脑手机作为客户端也是需要安装客户端软件的。下面是各个终端的下载地址（我用过Windows,MAC,Android,IOS操作起来都是差不多的。）：\n\nWindows：https://github.com/shadowsocks/shadowsocks-windows/releases\n\nAndroid:https://github.com/shadowsocks/shadowsocks-android/releases\n\nMAC:https://github.com/shadowsocks/ShadowsocksX-NG/releases\n\nLinux:https://github.com/shadowsocks/shadowsocks-qt5/wiki/Installation\n\n\n\nIOS: \n\n由于国区APP下架VPN类APP，包括支持ss类的APP，所以需要切换账号\n\n建议注册一个国外账号，不要国内账号换区，这样既可以需要下载国内APP时切换国区账号，需要下载国外APP时切换外区账号。\n\n**建议不想折腾的可以淘宝买一个国外App Store账号，便宜方便快捷**\n\n步骤：\n\n1.获取一个国区以外的账号\n\n注册国外appid教程：https://www.zhihu.com/question/26458172\n\n（相关注册外区账号教程很多，可以自行搜索）\n\n**由于苹果的新政策，注册apple id在付款方式选择的时候非当地ip无法选择none选项，例如我注册英国区账号，需要ip为英国才可以。即在注册时要搭梯子，对应ip注册。**\n\n2.在APPStore中切换为国区以外账号\n\n3.在AppStore搜索**Potatso Lite**安装\n\n注：或者其他支持shadowsocks的APP也可以，这里比较推荐Potatso Lite\n- [Potatso Lite](https://itunes.apple.com/us/app/potatso-lite/id1239860606?mt=8)\n\n  \n\n**下面以windows为例演示：**\n\n打开上方网址下载客户端：\n\n![](./images/libev/9.png)\n\n接着解压后打开Shadowsocks.exe，右击右下角小飞机，点击服务器-编辑服务器：\n\n![](./images/edit_server.png)\n\n还记得上面建议保存的图片吗？这里就用到了，服务器IP，端口，密码，加密方式，然后点击确定\n\n![](./images/libev/8.png)\n\n\n\n最后确保打开了PAC模式：\n\n![](./images/super_easy_shadowsocks_tutorial/21.png)\n\n\n\n- 这里简要说一下PAC模式和全局模式问题：\n\nPAC模式就是访问国内网站会走国内IP，访问被封的网站走服务器IP\n\n全局就是全部走服务器IP\n\n这里建议选择PAC模式，PAC的地址都是保存在[gfwlist](https://github.com/gfwlist/gfwlist)\n\n希望大家遇到PAC无法访问的网站多上去提issues。\n\n### 神圣时刻\n\n接着最神圣的时刻来了，在浏览器输入google.com，回车，蹦，谷歌回来了\n\n![](./images/w-16.png)\n\n# 补充\n## 设置多端口\n\n[如何启用 Shadowsocks 的多端口](https://stanleyzhao.xyz/2019/06/01/%E5%A6%82%E4%BD%95%E5%90%AF%E7%94%A8Shadowsocks%E7%9A%84%E5%A4%9A%E7%AB%AF%E5%8F%A3/)\n\n## 常用命令\nstart 启动\nstop 停止\nrestart 重启\nstatus 状态\n\n### Shadowsocks-libev 版：\n``` bash\n/etc/init.d/shadowsocks-libev start\n/etc/init.d/shadowsocks-libev stop\n/etc/init.d/shadowsocks-libev restart\n/etc/init.d/shadowsocks-libev status\n```\n\n### Shadowsocks-Python 版：\n``` bash\n/etc/init.d/shadowsocks-python start\n/etc/init.d/shadowsocks-python stop\n/etc/init.d/shadowsocks-python restart\n/etc/init.d/shadowsocks-python status\n```\n\n### ShadowsocksR 版：\n``` bash\n/etc/init.d/shadowsocks-r start\n/etc/init.d/shadowsocks-r stop\n/etc/init.d/shadowsocks-r restart\n/etc/init.d/shadowsocks-r status\n```\n\n### Shadowsocks-Go 版：\n``` bash\n/etc/init.d/shadowsocks-go start\n/etc/init.d/shadowsocks-go stop\n/etc/init.d/shadowsocks-go restart\n/etc/init.d/shadowsocks-go status\n```\n\n## 如何卸载\n运行如下命令，根据提示，选择对应版本卸载\n``` bash\n./shadowsocks-all.sh uninstall\n```\n# 最后\n\n最后，这里我们的任务完成了，但是如果你想优化一下服务器连接，可以安装BBR加速。具体可以看这篇文章：[文章](https://teddysun.com/489.html)\n\n\u003e 使用root用户登录，运行以下命令：\n\u003e\n\u003e ```bash\n\u003e wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh \u0026\u0026 chmod +x bbr.sh \u0026\u0026 ./bbr.sh\n\u003e ```\n\u003e\n\u003e 安装完成后，脚本会提示需要重启 VPS，输入 y 并回车后重启。\n\n# Q\u0026A\n\n汇总一些邮件反馈的问题\n\n**[已解决]1.问题：-bash: wget: command not found\n环境：服务器：linode，新加坡服务器，cent os7**  \n\n可以参照这篇文章安装wget后尝试：https://www.wn789.com/5624.html\n\n**[已解决]2.问题:当访问Google学术时，会提示 : \n\"We are sorry, but your computer or network may be sending automated queries. To protect our users, we can't process your request right now \"**  \n\n由于谷歌有自己的一套反代理爬虫的机制，所以很多 VPS 的 ip 会被谷歌检测到是代理，遇到这种情况可以用更换服务器即可，如果没有其他服务器可用，可以用**谷歌学术镜像**。\n\n**[已解决]3.[Error] Failed to install python**  \n\n由于以前文章的centos7不可选导致选择centos8导致的无法安装问题可以尝试使用**Debian10x64或者CentOS7**系统安装[#27](https://github.com/zhaoweih/Shadowsocks-Tutorial/issues/27)\n\n**[已解决]4.可以ping通但是连不上**\n\n这个情况有可能是防火墙没关闭，因为现在vultr默认会打开防火墙，所以需要关闭防火墙端口才能通\n\n```bash\nsystemctl stop firewalld\nsystemctl disable firewalld\n```\n\n执行后可以用`systemctl status firewalld`查看是否已经关闭，显示inactive就是关闭了防火墙\n\n![](./images/firewall_inactive.png)\n\n[在线检查端口是否开放](https://tool.chinaz.com/port)\n\n# 讨论\n## Discord\n**我创建了一个Discord讨论组，遇到问题的小伙伴可以一起讨论**\n\n[![Discord](./images/discord.svg)](https://discord.gg/wHFxCVk)\n\n# 更多\n**如果想详细了解有关shadowsocks翻墙知识的小伙伴可以查看下面文章**\n\n- [浅谈vpn、vps、Proxy以及shadowsocks之间的联系和区别](https://medium.com/@thomas_summon/%E6%B5%85%E8%B0%88vpn-vps-proxy%E4%BB%A5%E5%8F%8Ashadowsocks%E4%B9%8B%E9%97%B4%E7%9A%84%E8%81%94%E7%B3%BB%E5%92%8C%E5%8C%BA%E5%88%AB-b0198f92db1b)\n\n# 建议\n\n如果大家对这篇文章有任何疑问都可以提[issues](https://github.com/zhaoweih/Shadowsocks-Tutorial/issues)，如果你有其他更简单或者其他方法翻墙也可以pull requests。\n\n# 关于\n\n我是一名初入社会的社畜，一个追求自由的少年，如果想要找我，可以给我发邮件📧\n\n📮我的邮箱：zhaoweihao.dev@gmail.com\n\n# 赞赏\n\n我目前生活还是蛮自如的，有吃的有喝的，就不用赞赏了。喜欢就给我个star或者fork一下吧❤️，谢谢！\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaoweih%2Fshadowsocks-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaoweih%2Fshadowsocks-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaoweih%2Fshadowsocks-tutorial/lists"}