• 配置Ubuntu16.04第02步:更改镜像源,更新系统


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

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

     

    2.配置sources.list

    2.1 stone@ubuntu:~$ cd /etc/apt  #进入文件目录
    2.2 stone@ubuntu:/etc/apt$ sudo cp sources.list sources.list.bak   #备份文件
    2.3 stone@ubuntu:/etc/apt$ sudo gedit sources.list    #使用gedit打开文件                         

    2.4将下列信息复制到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. 更新源:sudo apt-get update

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

    3.1 更新源过程中出现的问题:

    Reading package lists... Done

    E: Problem executing scripts APT::Update::Post-Invoke-Success

    'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli;

     then appstreamcli refresh > /dev/null; fi'

    E: Sub-process returned an error code

    在运行sudo apt-get update时出现如上信息,解决方法如下:

    3.1.1 sudo pkill -KILL appstreamcli

    3.1.2 Wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb

    3.1.3 sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb

    执行完上述命令之后再次运行sudo apt-get update就不会再出现上面的错误。

    4.更新系统:sudo apt-get upgrade 

    该过程时间比较长,需要下载很多安装包

    5.其他一些命令

    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 检查是否有损坏的依赖

    作者:biyoulin

    出处:http://www.cnblogs.com/biyoulin/

    版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Xamarin.Forms项目无法添加服务引用
    Xamarin Android长度单位区别
    21IC菜农研究的HotWC3超级CRC运算器
    Delphi天气预报查询
    超外差接收机工作原理?
    ARM汇编指令的特点和速查表
    序列号的设计,不重复的实现一机一码
    iOS第一个简单APP
    GetEnvironmentVariable 获取常用系统变量(转)
    Delphi版的Base64转换函数(修改版)
  • 原文地址:https://www.cnblogs.com/biyoulin/p/9259627.html
Copyright © 2020-2023  润新知