• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • bios
  • 系统安装
  • 系统进程
  • Windows
  • LINUX
  • RedHat/Centos
  • Ubuntu/Debian
  • Fedora
  • Solaris
  • 麒麟系统
  • 红旗Linux
  • 苹果MAC
  • 注册表
  • 其它系统
您的位置:首页 > 操作系统 >LINUX > ubuntu 更换阿里源实例

ubuntu 更换阿里源实例

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-05-12

佚名 通过本文向大家介绍了ubuntu16.04阿里源,ubuntu 14.04 阿里源,ubuntu 阿里源,ubuntu 阿里云源,ubuntu 阿里云镜像等相关知识,希望对您有所帮助,也希望大家多多支持linkedu.com

网上应该可以找到很多关于ubuntu源的设置方法,但是如果不搞清楚就随便设置的话,不仅不能起到应有的效果,还会由于一些问题导致apt不可用。

最正确的更换源的方法应该如系统提示的:

## a.) add ‘apt_preserve_sources_list: true‘ to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

这种方法有点没弄明白在/etc/apt/sources.list.d应该添加的是什么内容,如果是源文件的话,最后更改的模板又是什么作用?也没有去尝试,有时间会解决一下。

以下提供设置阿里源的方法,其他源也可以如法炮制:

1. 首先查看自己的ubuntu系统的codename,这一步很重要,直接导致你更新的源是否对你的系统起效果,查看方法:

    lsb_release -a

    如,我的系统显示:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

    显示了一些ubuntu的版本信息,需要得到的是Codename,比如,我这里是trusty

2. 确认阿里源支持:

    登陆以下网页:http://mirrors.aliyun.com/ubuntu/dists/

    该网页显示了阿里云支持的ubuntu系统下各个Codename版本,确保自己的Codename在该网页中存在(一般都会有的)

2. 备份系统源:

    cd /etc/apt
    sudo mv sources.list sources.list_bak

3. 添加新的源文件:

    sudo vi sources.list

并添加以下内容:注意,每一行的trusty应该用第一步查看得到的Codename来代替

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

4. 保存并且sudo apt-get update,更新成功

5. 以下提供配置脚本:

 1 Codename=$( (lsb_release -a)|awk ‘{print $2}‘|tail -n 1 )
 2 echo "\
 3 deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
 4 deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
 5 deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
 6 deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
 7 deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe
 8 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
 9 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
10 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
11 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
12 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list
13 apt-get update
sudo运行该脚本即可(注意运行之前最好备份之前的sources.list)

</div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • ubuntu 更换阿里源实例

相关文章

  • 2017-05-12杀死Linux中的defunct进程(僵尸进程)的方法指南
  • 2017-05-12qq2440启动linux后插入u盘出现usb 1-1: device descriptor read/64, error -110,usb 1
  • 2017-05-12Linux下sed命令使用全解析
  • 2017-05-12Linux系统swap和zram swap的使用详解
  • 2017-05-12Linux ACL基本概念及典型用法
  • 2017-05-12在Linux命令行下查询当前所使用的shell版本与种类的方法
  • 2017-05-12Linux中chkconfig命令打开或关闭系统服务的使用教程
  • 2017-05-12详解Linux中的用户密码管理命令passwd和change
  • 2017-05-12Linux系统下NTP协议的超级配置攻略
  • 2017-05-12在Linux服务器上安装配置socks5代理的教程

文章分类

  • bios
  • 系统安装
  • 系统进程
  • Windows
  • LINUX
  • RedHat/Centos
  • Ubuntu/Debian
  • Fedora
  • Solaris
  • 麒麟系统
  • 红旗Linux
  • 苹果MAC
  • 注册表
  • 其它系统

最近更新的内容

    • Linux的CLI命令行界面系统操作基础上手指南
    • Linux系统下查看网卡实时流量软件Nload安装使用方法
    • Linux系统中有效用户组和初始用户组有什么作用于区别?
    • Linux /bin, /sbin, /usr/bin, /usr/sbin 区别
    • gsettings简介及常用操作介绍
    • 为Llinux系统添加交换分区(swap space)的方法
    • Linux下Nagios的安装与配置方法(图文详解)
    • 简单了解Linux系统中rev命令与tac命令的用法
    • 详解Linux系统中字符串搜索命令ngrep的用法
    • Linux多个网卡怎么添加永久路由?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有