美文网首页
docker-debian8 jessie修改软件源

docker-debian8 jessie修改软件源

作者: 雨中星辰0 | 来源:发表于2024-07-31 21:47 被阅读0次
    作者 时间
    雨中星辰 2024-08-01

    概述

    debian8默认的软件源,已经不可用了,如下。

    root@0dfb1a8cd84e:/# apt-get update
    Ign http://security.debian.org jessie/updates InRelease
    Ign http://security.debian.org jessie/updates Release.gpg
    Ign http://deb.debian.org jessie InRelease
    Ign http://security.debian.org jessie/updates Release
    Ign http://deb.debian.org jessie-updates InRelease
    Err http://security.debian.org jessie/updates/main amd64 Packages
    
    Ign http://deb.debian.org jessie Release.gpg
    Ign http://deb.debian.org jessie-updates Release.gpg
    Err http://security.debian.org jessie/updates/main amd64 Packages
    
    Ign http://deb.debian.org jessie Release
    Ign http://deb.debian.org jessie-updates Release
    Err http://security.debian.org jessie/updates/main amd64 Packages
    
    Err http://security.debian.org jessie/updates/main amd64 Packages
    
    Err http://security.debian.org jessie/updates/main amd64 Packages
      404  Not Found [IP: 151.101.130.132 80]
    Err http://deb.debian.org jessie/main amd64 Packages
      404  Not Found
    Err http://deb.debian.org jessie-updates/main amd64 Packages
      404  Not Found
    W: Failed to fetch http://security.debian.org/debian-security/dists/jessie/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.130.132 80]
    
    W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found
    
    W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found
    
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    解决思路

    修改默认的软件源,例如,阿里的软件源


    image.png

    由于容器没有vim,我们使用vim打开文件并修改,这里使用 echo将数据写入文件。

        echo "deb https://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" > /etc/apt/sources.list
        echo "deb-src https://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
    

    更新apt,apt-get update

    root@0dfb1a8cd84e:/# apt-get update
    E: The method driver /usr/lib/apt/methods/https could not be found.
    N: Is the package apt-transport-https installed?
    

    更新时,遇到了错误,提示https不存在,需要安装,我们这里安装一下

    root@0dfb1a8cd84e:/# apt-get install apt-transport-https
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package apt-transport-https
    

    提示找不到这个包。
    查看上面的步骤,我们发现,我们安装的apt源是https,猜测是否跟这个有关系,将apt源的https修改为http

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

    然后,再次更新下apt,一切都比较顺利

    root@0dfb1a8cd84e:/# apt-get update
    Ign http://mirrors.aliyun.com jessie InRelease
    Get:1 http://mirrors.aliyun.com jessie Release.gpg [2420 B]
    Hit http://mirrors.aliyun.com jessie Release
    Ign http://mirrors.aliyun.com jessie Release
    Get:2 http://mirrors.aliyun.com jessie/main Sources [9169 kB]
    Get:3 http://mirrors.aliyun.com jessie/non-free Sources [119 kB]
    Get:4 http://mirrors.aliyun.com jessie/contrib Sources [58.9 kB]
    Get:5 http://mirrors.aliyun.com jessie/main amd64 Packages [9098 kB]
    Get:6 http://mirrors.aliyun.com jessie/non-free amd64 Packages [101 kB]
    Get:7 http://mirrors.aliyun.com jessie/contrib amd64 Packages [59.2 kB]
    Fetched 14.2 MB in 10s (1373 kB/s)
    Reading package lists... Done
    W: GPG error: http://mirrors.aliyun.com jessie Release: The following signatures were invalid: KEYEXPIRED 1587841717
    

    安装个软件软件测试一下,一切顺利,至此软件源就修改完毕了。

    root@0dfb1a8cd84e:/# apt-get install net-tools
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
      net-tools
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 225 kB of archives.
    After this operation, 803 kB of additional disk space will be used.
    WARNING: The following packages cannot be authenticated!
      net-tools
    Install these packages without verification? [y/N] y
    Get:1 http://mirrors.aliyun.com/debian-archive/debian/ jessie/main net-tools amd64 1.60-26+b1 [225 kB]
    Fetched 225 kB in 0s (1094 kB/s)
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package net-tools.
    (Reading database ... 7621 files and directories currently installed.)
    Preparing to unpack .../net-tools_1.60-26+b1_amd64.deb ...
    Unpacking net-tools (1.60-26+b1) ...
    Setting up net-tools (1.60-26+b1) ...
    

    相关文章

      网友评论

          本文标题:docker-debian8 jessie修改软件源

          本文链接:https://www.haomeiwen.com/subject/vbnnhjtx.html