大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
sources.list作用的总结
Ubuntu中软件更新的源服务器地址存储再/etc/apt/soures.list中。文件中的内容如下:
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
上面是ubuntu官方的软件源。具体含义如下,
每一行的开头是deb和deb-src,表示直接通过.deb文件或者源文件的方式来进行安装;
第二字段,即deb和deb-src字段后是一段URL,这是软件源的地址
第三字段,即URL后的字段,是再URL路径中的dists目录下对应的文件夹,如图所示
第四~七字段都是第三字段对应的目录下的子目录
但是由于ubuntu的官方软件源下载速度慢而且有些第三方软件的安装包过于陈旧,已不能满足用户的需求。因此需要添加第三方软件更新源。本文以163的软件源为例讲述更新软件源的方法。
更新sources.list
在网上能够很方便的查到163的ubuntu的软件源的方法,sudo gedit /etc/apt/source.list,再打开的文件中添加如下内容:
deb http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
保存退出后运行命令:sudo apt-get update。
但是,这样修改后会在更新软件时会出现404 not found的错误,这是由于对于ubuntu各个版本的软件位置是不一样的,因此,需要根据ubuntu的版本号来选择对应的软件源路径。
选择对应版本的软件源
ubuntu各版本的名称如下
版本号 | 代号 | 发布时间 |
---|---|---|
15.04 | Vivid Vervet | 2015/4 |
14.10 | Utopic Unicorn | 2014/10/23 |
14.04 LTS | Trusty Tahr | 2014/04/18 |
13.10 | Saucy Salamander | 2013/10/17 |
13.04 | Raring Ringtail | 2013/04/25 |
12.10 | Quantal Quetzal | 2012/10/18 |
12.04 LTS | Precise Pangolin | 2012/04/26 |
11.10 | Oneiric Ocelot | 2011/10/13 |
由于我的ubuntu版本是14.04所以需要将上面的内容修改为:
deb http://tel.mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://tel.mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://tel.mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://tel.mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://tel.mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://tel.mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://tel.mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://tel.mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://tel.mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://tel.mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
然后再次保存,sudo apt-get update
总结
- 保存sources.list,sudo cp /etc/apt/sources.list
/etc/apt/sources.list-backup; - 打开sources.list,sudo gedit /etc/apt/sources.list;
- 将需要更新的软件源复制到文档中;
- 根据ubuntu的版本将每行的第三个字段换成对应版本的名称;
- 保存文档,并退出;
- 刷新软件源,sudo apt-get update
参考资料:
[1]http://www.cnblogs.com/jiangz/p/4076811.html?utm_source=tuicool&utm_medium=referral
[2]http://www.cnblogs.com/tsingke/p/3832765.html
[3]http://baike.baidu.com/link?url=35tSbrwOYsEaxPsGPV3PeM16UibDD8ot1lUar0cOKvsJCc1rd7NgVMxZzDPet17QQq2rrOPhzW4Ceccsi8RVua
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/182186.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...