• ubuntu apt install 慢的解决办法


    1、问题  apt install 慢, 如下:

    root@ubuntu01:/home/test# apt install git

    2、解决方法

    root@ubuntu01:/home/test# cd /etc/apt/
    root@ubuntu01:/etc/apt# ls
    apt.conf.d  auth.conf.d  preferences.d  sources.list  sources.list.d  trusted.gpg.d
    root@ubuntu01:/etc/apt# cp sources.list sources.list_bak   ## 备份文件
    root@ubuntu01:/etc/apt# ls
    apt.conf.d  auth.conf.d  preferences.d  sources.list  sources.list_bak  sources.list.d  trusted.gpg.d
    root@ubuntu01:/etc/apt# vim sources.list    ## 将source.list文件改为如下内容,保存退出
    #deb cdrom:[Ubuntu 16.04 LTS Xenial Xerus - Release amd64 (20160420.1)]/ xenial main restricted
    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted
    #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
    #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
    #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    #Added by software-properties
    deb http://archive.canonical.com/ubuntu xenial partner
    deb-src http://archive.canonical.com/ubuntu xenial partner
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
    #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

     3、更新

    root@ubuntu01:/etc/apt# apt update
    Get:1 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
    Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
    Get:3 http://archive.canonical.com/ubuntu xenial/partner Sources [2,300 B]
    Get:4 http://archive.canonical.com/ubuntu xenial/partner i386 Packages [2,696 B]
    Get:5 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [2,696 B]
    Get:6 http://archive.canonical.com/ubuntu xenial/partner Translation-en [1,556 B]
    Get:7 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [4,808 B]
    
    ……
    Fetched 60.8 MB in 19s (3,146 kB/s)
    Can not add an empty (zero-length) key to the cache
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    1 package can be upgraded. Run 'apt list --upgradable' to see it.

    4、测试

    root@ubuntu01:/etc/apt# apt install git
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
      git-man liberror-perl
    Suggested packages:
      git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn
    The following NEW packages will be installed:
      git git-man liberror-perl
    0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
    Need to get 3,939 kB of archives.
    After this operation, 25.6 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrors.aliyun.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
    Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.10 [737 kB]
    Get:3 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.10 [3,183 kB]
    Fetched 3,939 kB in 6s (629 kB/s)
    Selecting previously unselected package liberror-perl.
    (Reading database ... 150486 files and directories currently installed.)
    Preparing to unpack .../liberror-perl_0.17-1.2_all.deb ...
    Unpacking liberror-perl (0.17-1.2) ...
    Selecting previously unselected package git-man.
    Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.10_all.deb ...
    Unpacking git-man (1:2.7.4-0ubuntu1.10) ...
    Selecting previously unselected package git.
    Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.10_amd64.deb ...
    Unpacking git (1:2.7.4-0ubuntu1.10) ...
    Setting up liberror-perl (0.17-1.2) ...
    Setting up git-man (1:2.7.4-0ubuntu1.10) ...
    Setting up git (1:2.7.4-0ubuntu1.10) ...
    Processing triggers for man-db (2.9.1-1) ...

    速度非常快!

  • 相关阅读:
    [项目管理]记一次外包过程遇到的“问题”以及“应对之道”
    [ZT]Web Standard and ASP.NET – Part1 XHTML Quick Start
    [前端技术]利用 try...catch 来跳出JQuery.each()
    [ZT]Use JQuery to adjust the iframe height
    [CSharp]复合格式化(Composite Formatting)
    [项目管理]关于项目的工期控制
    [CSharp]判断表达式为空的二元运算符
    MySoft.Data ORM组件之获取插入后的自增主键
    [前端技术]让iframe背景透明起来
    NSRunLoop
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15674056.html
Copyright © 2020-2023  润新知