一、安装ShadowSocks
我是根据[5]进行安装
apt-get install python-pip
pip install git+https://github.com/shadowsocks/shadowsocks.git@master
然后在/etc下新建shadowsocks/conf.json文件,内容如下:
{
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
各个参数的具体意义可以参考[6]。开启代理命令如下:
sudo sslocal -c /etc/shadowsocks/conf.json -d start
关闭命令如下:
sudo sslocal -c /etc/shadowsocks/conf.json -d stop
-d表示为后台模式运行,需注意的是ssserver是服务器命令,sslocal才是客户端上的命令。可使用命令查询sslocal是否开启:
ps -ef | grep sslocal
二、 FireFox浏览器配置
FireFox浏览器是Ubantu自带的浏览器,通过简单的配置就可以全局使用代理:
然后使用Google搜索Chrome,进行相应版本的下载 (~/Downloads/google-chrome-stable_current_amd64.deb)。
在命令行中启用FireFox浏览器的命令是
firefox
三、 Chrome安装与配置
首先进行Chrome浏览器的安装:
sudo dpkg -i ~/Downloads/google-chrome-stable_current_amd64.deb
sudo apt-get -f install
安装好以后可以直接以全局代理模式使用Chrome:
google-chrome --proxy-server=socks5://127.0.0.1:1080
为了日后方便地区分国内网站和国外网站,可以使用SwithyOmega插件,配置步骤可以参考[2]。自己的配置信息如下:
其中代理服务器填写为127.0.0.1,但代理端口需要跟Shadow~~socks里面设置的一样:
接下来就可以自由的上网了:
四、 添加自启动
具体的添加脚本操作如[8]所示,脚本的命令如下(run_shadowsocks_lss.sh):
#!/bin/bash
sslocal -c /etc/shadowsocks/conf.json -d start
注意前面不要加sudo。
参考:
[1] Linux Ubuntu桌面系统下使用shadowsocks 安装chrome https://www.8dlive.com/post/168.html
[2] Ubuntu下科学上网:使用Chrome Shadowsocks SwitchyOmega http://www.itdadao.com/articles/c15a512611p0.html
[3] ubuntu 12.10 安装使用谷歌浏览器chrome http://www.maybe520.NET/blog/1659/
[4] 每日Ubuntu小技巧——怎样安装谷歌Chrome浏览器 https://linux.cn/article-2158-1.html
[5] https://github.com/shadowsocks/shadowsocks/tree/master
[6] https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-FileF
[7] Ubuntu下添加开机自动脚本 http://jackqdyulei.github.io/2016/03/06/linux-auto-script/
[8] Ubuntu下添加开机启动脚本 https://wangheng.org/ubuntu-to-add-boot-script.html