更新Ubuntu软件源,sl跑火车

Ubuntu 16.04下载软件速度有点慢,因为默认的是从国外下载软件,那就更换到国内比较好的快速更新源(就是这些软件所在的服务器),一般直接百度Ubuntu更新源就能出来一大堆,这时候最好是找和自己Ubuntu版本一致的更新源,我的Ubuntu版本是16.04,下面是我找到的一个比较好的更新源。

避免自己手贱操作失误,重装系统太费时间

cp /etc/apt/sources.list /etc/apt/sources.list.bak        此命令是备份该官方源文件

Ubuntu 14.04.4官方默认更新源sources.list

# deb cdrom:[Ubuntu 14.04.4 LTS _Trusty Tahr_ - Release amd64 (20160217.1)]/ trusty main restricted

# See https://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://cn.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb https://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb https://cn.archive.ubuntu.com/ubuntu/ trusty universe
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty universe
deb https://cn.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb https://cn.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty multiverse
deb https://cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb https://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb https://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src https://security.ubuntu.com/ubuntu trusty-security main restricted
deb https://security.ubuntu.com/ubuntu trusty-security universe
deb-src https://security.ubuntu.com/ubuntu trusty-security universe
deb https://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src https://security.ubuntu.com/ubuntu trusty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb https://archive.canonical.com/ubuntu trusty partner
# deb-src https://archive.canonical.com/ubuntu trusty partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb https://extras.ubuntu.com/ubuntu trusty main
deb-src https://extras.ubuntu.com/ubuntu trusty main
Ubuntu 16.04官方默认更新源sources.list
#deb cdrom:[Ubuntu 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted

# See https://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src https://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb https://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src https://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb https://cn.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src https://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb https://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src https://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

1.寻找国内镜像源https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

  • 中科大源 12.04LTS:
deb https://mirrors.ustc.edu.cn/ubuntu/ precise-updates main restricted
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise-updates main restricted
deb https://mirrors.ustc.edu.cn/ubuntu/ precise universe
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise universe
deb https://mirrors.ustc.edu.cn/ubuntu/ precise-updates universe
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise-updates universe
deb https://mirrors.ustc.edu.cn/ubuntu/ precise multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ precise-updates multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise-updates multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb https://security.ubuntu.com/ubuntu precise-security main restricted
deb-src https://security.ubuntu.com/ubuntu precise-security main restricted
deb https://security.ubuntu.com/ubuntu precise-security universe
deb-src https://security.ubuntu.com/ubuntu precise-security universe
deb https://security.ubuntu.com/ubuntu precise-security multiverse
deb-src https://security.ubuntu.com/ubuntu precise-security multiverse
  • 搜狐源 12.04LTS
deb https://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb-src https://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb https://mirrors.sohu.com/ubuntu/ precise universe
deb-src https://mirrors.sohu.com/ubuntu/ precise universe
deb https://mirrors.sohu.com/ubuntu/ precise-updates universe
deb-src https://mirrors.sohu.com/ubuntu/ precise-updates universe
deb https://mirrors.sohu.com/ubuntu/ precise multiverse
deb-src https://mirrors.sohu.com/ubuntu/ precise multiverse
deb https://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb-src https://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb https://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src https://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
  • 网易源 12.04LTS
deb https://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src https://mirrors.163.com/ubuntu/ precise-updates main restricted
deb https://mirrors.163.com/ubuntu/ precise universe
deb-src https://mirrors.163.com/ubuntu/ precise universe
deb https://mirrors.163.com/ubuntu/ precise-updates universe
deb-src https://mirrors.163.com/ubuntu/ precise-updates universe
deb https://mirrors.163.com/ubuntu/ precise multiverse
deb-src https://mirrors.163.com/ubuntu/ precise multiverse
deb https://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src https://mirrors.163.com/ubuntu/ precise-updates multiverse
deb https://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src https://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
  • 阿里云
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src https://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb https://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb https://mirrors.aliyun.com/ubuntu/ xenial universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb https://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb https://archive.canonical.com/ubuntu xenial partner
deb-src https://archive.canonical.com/ubuntu xenial partner
deb https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
大家,有时候,需要把http改成https

2.配置source  list源

sources.list系统自带的,源是来Ubuntu的官网!安装包比较慢,所以最好切换成国内的。建议把国内的源追加到源文件的上面,这样在国内匹配不到的软件还可以到国外源安装。

linuxidc.com@ubuntu:~$ cd /etc/apt
linuxidc.com@ubuntu:/etc/apt$ sudo cp sources.list sources.list.bak
linuxidc.com@ubuntu:/etc/apt$ vim sources.list

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

3. 更新源

linuxidc.com@ubuntu:/etc/apt$ sudo apt-get update
命中:1 https://mirrors.aliyun.com/ubuntu xenial InRelease
命中:2 https://mirrors.aliyun.com/ubuntu xenial-updates InRelease
命中:3 https://mirrors.aliyun.com/ubuntu xenial-backports InRelease
命中:4 https://mirrors.aliyun.com/ubuntu xenial-security InRelease
正在读取软件包列表… 完成

测试:安装sl包 (sl跑火车)
linuxidc.com@ubuntu:/etc/apt$ sudo apt-get install sl

linuxidc.com@ubuntu:/etc/apt$ sl

4.其他一些命令

sudo apt-get update  更新源
sudo apt-get install package 安装包
sudo apt-get remove package 删除包
sudo apt-cache search package 搜索软件包
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
sudo apt-get install package –reinstall  重新安装包
sudo apt-get -f install  修复安装
sudo apt-get remove package –purge 删除包,包括配置文件等
sudo apt-get build-dep package 安装相关的编译环境
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-cache depends package 了解使用该包依赖那些包
sudo apt-cache rdepends package 查看该包被哪些包依赖
sudo apt-get source package  下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖

知识共享署名4.0国际许可协议,转载请保留出处; 部分内容来自网络,若有侵权请联系我:前端学堂 » 更新Ubuntu软件源,sl跑火车

赞 (0) 打赏

评论 0

如果对您有帮助,别忘了打赏一下宝宝哦!

支付宝扫一扫打赏

微信扫一扫打赏