zoukankan      html  css  js  c++  java
  • Ubuntu18.04更换国内源

    Ubuntu18.04更换国内源

    备份/etc/apt/sources.list文件

    #阿里云源
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

    mv /etc/apt/sources.list /etc/apt/sourses.list.backup
    

    新建/etc/apt/sources.list文件并添加以下内容

    出现没有安装vim的情况下,

    1. 我在安装vim前已经 apt-get update 但是还是出现以下报错:

      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      E: Unable to locate package vim
      
    2. 所以必须进行配置新的源,但是没有vim又没办法对配置文件进行修改,故采用以下方法进行修改

      echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list
      echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
      echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list
      echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
      

      采用管道命令进行添加配置信息

    3. 更改完成之后执行以下命令

      apt update
      apt upgrade
      
    4. 其他的一些apt命令

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

      其他几个国内的源:

      #中科大源
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      
      #阿里云源
      deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
      deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
      
      #清华源
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      
    保持对优秀的热情
  • 相关阅读:
    水滴二次开发日志5
    水滴二次开发日志4
    水滴二次开发日志3
    水滴二次开发日志2
    NOIp2020AFO记
    Diary(2020十一月 NOIP赛前集训)
    我们的Gary真的是太强辣
    Diary(2020十月 CSP赛前集训)
    Diary(2020九月 半集训)
    Music
  • 原文地址:https://www.cnblogs.com/luckforefforts/p/13642699.html
Copyright © 2011-2022 走看看