ubuntu操作-更改apt-get软件源

1、保险起见,备份 Ubuntu12.04 源列表

# cp /etc/apt/sources.list /etc/apt/sources.list.backup

2、修改源列表文件

# vi /etc/apt/sources.list

3、把里面的列表替换成下面的列表 
【163源 http://mirrors.163.com/ 】

# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]

deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main

deb-src http://extras.ubuntu.com/ubuntu precise main

  

【sohu源】

deb http://mirrors.sohu.com/ubuntu/ precise main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted deb http://mirrors.sohu.com/ubuntu/ precise universe deb-src http://mirrors.sohu.com/ubuntu/ precise universe deb http://mirrors.sohu.com/ubuntu/ precise-updates universe deb-src http://mirrors.sohu.com/ubuntu/ precise-updates universe deb http://mirrors.sohu.com/ubuntu/ precise multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise multiverse deb http://mirrors.sohu.com/ubuntu/ precise-updates multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-updates multiverse deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted deb http://mirrors.sohu.com/ubuntu/ precise-security universe deb-src http://mirrors.sohu.com/ubuntu/ precise-security universe deb http://mirrors.sohu.com/ubuntu/ precise-security multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-security multiverse deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main

【ubuntu.cn99.com源】

deb http://ubuntu.cn99.com/ubuntu/ precise main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-updates main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-security main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-backports main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu-cn/ precise main restricted universe multiverse

【电子科技大学】

deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse

【中国科技大学】

deb http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-backports restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse

【北京理工大学】

deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe

4、更新软件源

# apt-get update

我使用的是163源,出现如下提示即更新成功:

......Hit http://mirrors.163.com precise-security/main Translation-enHit http://mirrors.163.com precise-security/multiverse Translation-enHit http://mirrors.163.com precise-security/restricted Translation-enHit http://mirrors.163.com precise-security/universe Translation-enReading package lists... Done



在 sources.list 文件中,我们看到很多“main,restricted,universe,multiverse”的字眼,这里顺便说一下它们的区别:

  • main —— 完全的自由软件。
  • restricted —— 不完全的自由软件。
  • universe —— ubuntu官方不提供支持与补丁,全靠社区支持。
  • muitiverse —— 非自由软件,完全不提供支持和补丁。

以及 precise 的字眼,其实 precise 是 Ubuntu 12.04 的 Code name,更多 Code name 如下所示:

    • Ubuntu 4.10 (Warty Warthog)
    • Ubuntu 5.04 (Hoary Hedgehog)
    • Ubuntu 5.10 (Breezy Badger)
    • Ubuntu 6.06 LTS (Dapper Drake)
    • Ubuntu 6.10 (Edgy Eft)
    • Ubuntu 7.04 (Feisty Fawn)
    • Ubuntu 7.10 (Gutsy Gibbon)
    • Ubuntu 8.04 LTS (Hardy Heron)
    • Ubuntu 8.10 (Intrepid Ibex)
    • Ubuntu 9.04 (Jaunty Jackalope)
    • Ubuntu 9.10 (Karmic Koala)
    • Ubuntu 10.04 LTS (Lucid Lynx)
    • Ubuntu 10.10 (Maverick Meerkat)
    • Ubuntu 11.04 (Natty Narwhal)
    • Ubuntu 11.10 (Oneiric Ocelot)
    • Ubuntu 12.04 LTS (Precise Pangolin)
    • Ubuntu 12.10 (Quantal Quetzal)
    • Ubuntu 13.04 (Raring Ringtail)
    • Ubuntu 13.10 (Saucy Salamander)
    • Ubuntu 14.04 LTS (Trusty Tahr)
    • Ubuntu 14.10 (Utopic Unicorn)
    • Ubuntu 15.04 (Vivid Vervet)
    • Ubuntu 15.10 (Wily Werewolf)
    • Ubuntu 16.04 LTS (Xenial Xerus)

      那么,除了 apt-get update,我们平常还会看到 apt-get upgrade 以及 apt-get dist-upgrade,它们的区别是什么呢?查阅相关资料,有如下解释: 
      An update should always be performed before an upgrade or dist-upgrade. upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded. 
      也就是说: 
      update 是同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。 
      upgrade 是升级已安装的所有软件包,升级之后的版本就是本地索引里的,因此,在执行 upgrade 之前一定要执行 update, 这样才能是最新的。 
      由于包与包之间存在各种依赖关系,upgrade只是简单的更新包,不管这些依赖,它不和添加包,或是删除包。而dist-upgrade可以根据依赖关系的变化,添加包,删除包。

附ubuntu12.04.2 LTS-amd64的原source.list(/etc/apt/sources.list)

# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/main/binary-i386/

# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ precise main restricted

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

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-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 http://cn.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise universe
deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-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 http://cn.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-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 http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-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 http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main

  

原文地址:https://www.cnblogs.com/luyou0105/p/9651053.html

时间: 2024-10-03 10:00:09

ubuntu操作-更改apt-get软件源的相关文章

设置Ubuntu 10.10版本的软件源

设置Ubuntu 10.10版本的软件源 http://blog.csdn.net/xie1xiao1jun/article/details/49911189 网上有很多关于软件源信息的更新,每次将它们copy到/etc/apt/sources.list中,且将copy下来的信息的版本名字修改为maverick,再运行sudo apt-get update,总会出现一连串的错误.后面经过搜索,才发现原来是ubuntu不在维护一些老版本的软件源了,因此无论怎么设置更新源都会出现错误.   因此目前

Ubuntu Server 18.04 切换软件源到国内镜像

Ubuntu 源列表 [中科大] 1.repository file generator 2.具体命令: wget https://mirrors.ustc.edu.cn/repogen/conf/ubuntu-http-4-bionic -O sources.list # or https wget https://mirrors.ustc.edu.cn/repogen/conf/ubuntu-https-4-bionic -O sources.list sudo mv /etc/apt/so

apt-mirror搭建ubuntu软件源

一.准备环境 1. 系统:ubuntu 16.04.6(LTS) 64位 2. 镜像软件:apt-mirror 0.5.1-1ubuntu1 3. HTTP协议发布软件:nginx 1.10.3-0ubuntu0.16.04.4 二.安装软件 # 查看apt-mirror版本 macrored@ubuntu:~$ apt policy apt-mirror apt-mirror: Installed: 0.5.1-1ubuntu1 Candidate: 0.5.1-1ubuntu1 # 安装ap

virtualbox中配置CentOS的本地磁盘镜像作为其软件源

CentOS(以及红帽系列)都有yum软件源的概念,即在终端通过命令可以直接从软件源下载软件并安装.除了网络上的软件源(如网易.搜狐.中科大镜像)外,我们也可以使用下载好的CentOS镜像来作为软件源.它包含了大部分常用软件,而在我们安装CentOS系统的时候,很多时候是选择性安装的,所以并没有把所有的软件安装到系统中. 因为很多人是在虚拟机里配置Linux的,所以这里介绍一些如何在virtualbox中配置CentOS本地磁盘镜像作为其软件源.学会了这个,即使不是虚拟机,就是在实体机上安装的C

Linux学习笔记——Ubuntu更新软件源

0.前言 通过修改ubuntu软件源可提高apt命令下载安装软件的速度. 参考资料 [官方资料]--配置文件修改方法 [Ubuntu怎样修改软件源地址]--使用ubuntu软件中心修改(推荐) [at-get update错误处理] 1.使用ubuntu软件中心更新 请参考[Ubuntu怎样修改软件源地址]--来自百度经验 图1 打开软件和更新 图2 选择国内软件源 2.使用指令方法修改 [1]首先备份源列表 sudo cp /etc/apt/sources.list /etc/apt/sour

在Ubuntu 12.04 中如何更换一个更快的软件源?

在ubuntu 下下载安装软件使用不同的镜像源速度差异非常大, 官方的那个比较慢,所以选择最快的最有效率.设置方法不一,网上教程比较常见的是自己手动去更改更新源列表,把特定版本的源列表直接复制到 /etc/apt/sources.list 文件中,但是有时候源文件会失效,而且不一定每次源文件都是跟自己的版本兼容的. 网上看到一个教程,方法很简单, 转载一下:(转自于IMCN) 在Ubuntu 12.04 中用户如何更换一个更快的软件源?

linux ubuntu 本地镜像 软件源 制作方法

1.配置当前软件源,镜像非常大,所以首先要配置一下载速度快的软件源http://fffo.blog.163.com/blog/static/2119130682014322104136601/2.安装镜像软件 并 修改镜像参数文件1).安装apt-mirrorsudo apt-get install apt-mirror2).修改mirror.listsudo gedit /etc/apt/mirror.list文件内容如下:——————————————引用开始—————————————————

[ubuntu]deb软件源

虽然ubuntu的中国服务器的速度已经非常不错,但是难免,会有网络不畅的情形,所以修改软件源地址是一个基础的知识点. 修改ubuntu的软件源的方式有多种,一直是通过ubuntu软件中心提供的UI,还有一种就是通过编辑/etc/apt/sources.list配置文件. UI操作 通过软件中心配置软件源比较简单,直接打开ubuntu软件中心,顶部菜单里 编辑(E)->软件源(S)-即可配置软件源地址,安装时选择中文的话,默认应该是ubuntu的中国服务器.这个速度还可以. 编辑配置文件 做好备份

树莓派 Raspbian 软件源更改 看门狗启用

1.替换脚本 下面脚本请直接复制到终端执行!! 适用于raspbian-stretch(基于Debian9) sudo -s echo -e "deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi \n deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi&quo