@iPhan
2018-07-26T08:17:32.000000Z
字数 2411
阅读 547
Josie
更换国内镜像源的意义:apt install 时是从国内的服务点下载软件,比默认的境外服务器带宽高且稳定。
Ubuntu 的软件源配置文件是 /etc/apt/sources.list。首先将系统自带的该文件做个备份(可选)。
备份时你可以简单的用这条:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk
备份好后将 /etc/apt/sources.list 这个文件替换为下面内容,即可使用 清华大学提供的软件源镜像。记住打开这个文件时要用管理员权限。(sudo vim /etc/apt/sources.list 如果不会用vim,你可以用nano)
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
换好之后命令行执行
sudo apt update
执行这条命令之后在终端里看到一排排的下载地址链接的根都是 tuna.tsinghua.edu.cn 就妥了
首先安装软件包:
sudo apt install shadowsocks
这个软件包包括两个软件:sslocal和ssserver,前者是本地用的,后者是ss服务器上用的。
sslocal的用法是:
sslocal -c [这里是你配置文件的绝对路径]
拿我的电脑举例:
我的配置文件内容:
{
"server":"67.216.198.249",
"server_port":4399,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"biubiubiu1024",
"timeout":300,
"method":"aes-256-cfb",
"fast_open":false,
"workers":1
}
我的配置文件绝对路径:
/etc/sslocal.json
我执行的命令:
`bash
sslocal -c /etc/sslocal.json
用管理员权限打开 /etc/rc.local(如果不会用vim,你可以用nano):
sudo vim /etc/rc.local
然后把你希望开机时自动执行的命令写在 exit 0 前面就ok了
我的rc.local:
~ » cat /etc/rc.local chuan@chuan-ubuntu
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sslocal -c /etc/sslocal.json
exit 0
我用的是chromium,不过chrome也是一样的。
需要给chrome安装SwitchyOmega插件,没有代理之前是不能从谷歌商店安装这个插件的,但是我们可以从Github上直接下载最新版 https://github.com/FelisCatus/SwitchyOmega/releases/ (这个是chrome的)然后浏览器地址打开chrome://extensions/,将下载的插件托进去安装。