1. 问题:E: Package ‘curl’ has no installation candidate

Package curl is not available, but is referred to by another package. 
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'curl' has no installation candidate

2. 解决

  • 备份系统自带的源:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
    
  • 复制阿里或者清华源:

    阿里源: https://opsx.alibaba.com/mirror
    清华源:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
    本人使用的是阿里源,以及是Ubuntu系统,ubuntu 18.04(bionic) 配置如下:

    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src 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-backports main restricted universe multiverse
    
  • 打开/etc/apt/sources.list文件,将原来的内容删除,然后将上述ubuntu 18.04(bionic)
    的配置,粘贴上,保存:

    sudo vi /etc/apt/sources.list
    
  • 输入命令sudo apt-get update进行更新:

    sudo apt-get update
    
  • 最后,下载curl:

    sudo apt-get install curl
    
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      libcurl4
    The following NEW packages will be installed:
      curl
    The following packages will be upgraded:
      libcurl4
    1 upgraded, 1 newly installed, 0 to remove and 448 not upgraded.
    Need to get 378 kB of archives.
    After this operation, 411 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.16 [220 kB]
    Get:2 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 curl amd64 7.58.0-2ubuntu3.16 [159 kB]
    Fetched 378 kB in 0s (1,739 kB/s)
    (Reading database ... 228625 files and directories currently installed.)
    Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.16_amd64.deb ...
    Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.16) over (7.58.0-2ubuntu3.9) ...
    Selecting previously unselected package curl.
    Preparing to unpack .../curl_7.58.0-2ubuntu3.16_amd64.deb ...
    Unpacking curl (7.58.0-2ubuntu3.16) ...
    Setting up libcurl4:amd64 (7.58.0-2ubuntu3.16) ...
    Setting up curl (7.58.0-2ubuntu3.16) ...
    Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
    Processing triggers for libc-bin (2.27-3ubuntu1) ...
    
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐