乐趣区

Win10子系统ubuntu更换源

作为一个 windows 下面的开发者,之前工作一直用 cygwin。cygwin 虽然方便但是很多时候安装一些东西,比如 jekyll, 是各种依赖不足,太痛苦了。好在微软 win10 出了针对开发者的 linux 子系统,那就先试用一段时间吧。

现在 win10 的 linux 子系统已经有 ubuntu 和 opensuse 两个版本了, 应该后续还会推出更多的 linux 发行版。大家按个人喜好安装吧。

安装过程,网上很多也不难,就略过了,大家自行搜索吧。

我的 linux 子系统用的是 ubuntu,使用起来简单方便啊????

安装完成之后,顺手就是一个 apt update,但是默认的源太慢了,没法忍。那我们就换国内源吧。

国内有好多源,阿里云,163,搜狐,中科大等等。我们就以阿里云做个例子吧:

浏览器打开 http://mirrors.aliyun.com/

找到 ubuntu 的 help

发现里面最新的是 Quantal(12.10) 看来不能直接复制

在你的子系统 bash 中执行

cat /etc/apt/sources.list
-------------------------
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
-------------------------

索性最新版 ubuntu16.04 代号叫 xenial

那直接把 url 换换就行了

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk     # 改配置文件,先备份是个好习惯
sudo vim /etc/apt/sources.list   # 把内容换成下面的就行了,其实就是 url 变了
-------------------------
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
-------------------------

搞定了,测试下:

sudo apt update

没问题就可以了。

原文连接:

Win10 子系统 ubuntu 更换源

退出移动版