• ubuntu怎样添加源(转)


    Ubuntu和Debian一样使用Apt高级包管理系统,可以很方便的进行在线安装、升级、卸载。但是Ubuntu和Debian所使用的源(source)是不同的。

    Ubuntu安装完后,默认使用的可能是国外的源,速度可能比较慢。现在国内也有很多服务器提供国外源的镜像,可以使得Ubuntu软件包的安装、升级快很多。

    源可以在ubuntu的菜单:系统管理=>软件源配置中图形化的配置。但是用命令行配置可以说的更清楚一些。使用一个编辑工具打开/etc/apt/sources.list文件(比如这里的gedit):

    复制内容到剪贴板

    代码:

    sudo gedit /etc/apt/souces.list

    也可以用其他编辑器,在纯字符模式下可以用:

    复制内容到剪贴板

    代码:

    sudo gedit /etc/apt/sources.list

    这个文件里面的内容可以放心的全部删除,然后用如下的内容代替(以7.04 feisty版为例):

    复制内容到剪贴板

    代码:

    ## cn.archive.ubuntu.com

    deb http://cn.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse

    deb http://cn.archive.ubuntu.com/ubuntu/ feisty-proposed main restricted universe multiverse

    deb http://cn.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse

    deb http://cn.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse

    deb http://cn.archive.ubuntu.com/ubuntu/ feisty-security main restricted universe multiverse

    其他版本的ubuntu可以把其中的feisty替换成相应版本的名字,比如dapper、edgy、gutsy等。

    也可以用如下的cn99的源:

    复制内容到剪贴板

    代码:

    deb http://ubuntu.cn99.com/ubuntu/ gutsy main restricted universe multiverse

    deb http://ubuntu.cn99.com/ubuntu/ gutsy-proposed main restricted universe multiverse

    deb http://ubuntu.cn99.com/ubuntu/ gutsy-updates main restricted universe multiverse

    deb http://ubuntu.cn99.com/ubuntu/ gutsy-backports main restricted universe multiverse

    deb http://ubuntu.cn99.com/ubuntu/ gutsy-security main restricted universe multiverse

    两 个源选一个就可以了。以上配置的是Ubuntu官方的源。而中国的ubuntu社区根据中国用户的一些需要,把中国用户一些常用的软件放在ubuntu- cn的源当中。但是这个源当中的很多软件包有版权问题,所以不能进入官方的源。要添加ubuntu-cn的源,可以在前面内容的基础上再添加一行:

    复制内容到剪贴板

    代码:

    deb http://cn.archive.ubuntu.com/ubuntu-cn/ feisty main restricted universe multiverse

    或者

    复制内容到剪贴板

    代码:

    deb http://ubuntu.cn99.com/ubuntu-cn/ feisty main restricted universe multiverse

    如果需要下载源代码,可以加上源代码的源,就是将每行开头的deb改成deb-src就可以了,比如

    复制内容到剪贴板

    代码:

    deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse

    deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-proposed main restricted universe multiverse

    deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse

    deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse

    deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-security main restricted universe multiverse

    如果还有其他的第三方的源,可以在这个文件里面继续添加。比如要安装google提供的picasa或者googleearth可以添加如下的一行就可以了:

    复制内容到剪贴板

    代码:

    deb http://dl.google.com/linux/deb/ stable non-free

    注意不要轻信第三方的源,因为恶意制作的源服务器可能存在恶意软件,随意添加他们可能会给系统带来安全问题。

  • 相关阅读:
    php echo return exit 区别
    Ubuntu下添加开机启动项的2种方法
    在php中定义常量时,const与define的区别
    yii分页操作
    ubuntu14.04设置静态ip
    Yii IIS8下使用伪静态【Url Rewrite】去掉index.php
    java 第三方库
    IDEA插件
    springboot扫描通用的依赖模块
    idea注册
  • 原文地址:https://www.cnblogs.com/shanmao/p/2805235.html
Copyright © 2020-2023  润新知