• docker中使用阿里云的apt源安装各种实用工具


    今天想在docker中安装vim工具,还有其他的软件等等,如果你直接执行apt-get install vim是没有用的,会显示:

    root@7d43d83fd3a8:/etc/nginx# apt-get install vim
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package vim

    看样子是不可以安装的,我们需要做的就是修改apt的源即可,再update一下就可以安装了。

    看到网上很多博客中讲解安装vim工具的时候修改为国内的163的apt源,这里我不是很推荐,因为我尝试以后发现有些工具安装不上去,甚至是连依赖库和包等等都不能自动解决,那怎么行呢?所以我索性换为阿里云的apt源。

    步骤如下:

    1、更新为最近的阿里云的apt源,目的是快速更近的更新系统的包等资源。

    先备份一下原来的apt源

    mv /etc/apt/sources.list /etc/apt/sources.list.bak

    更改为阿里云的源步骤如下:

    cat > /etc/apt/sourcesl.list << EOF
    deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb http://mirrors.aliyun.com/debian-security stretch/updates main deb-src http://mirrors.aliyun.com/debian-security stretch/updates main deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
    EOF

    因为docker中没有默认的编辑工具,很是费事,因此建议在容器中先按照这个步骤把vim工具按照一下即可。

    2、修改好之后就可以使用update命令同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源索引,获取最新软件包

    apt-get update

    3、即可下载vim、wget、git工具了,非常快速方便

    apt-get install vim wget git
  • 相关阅读:
    C语言判断函数
    从函数调用来思考多态
    C语言读取每一行文本
    任务栏上的资源管理器图标,没有jump list?其他都有。
    The specified child already has a parent错误
    SQL语句的添加、删除、修改多种方法
    菜鸟开技术博啦
    若不能连接到sql server的localhost
    微软Live Mail包含重大Bug,可导致用户无法登录,我已经一个多月无法登录自己的邮箱了。 无为而为
    试试Communicator Web Access 中文版 无为而为
  • 原文地址:https://www.cnblogs.com/FengGeBlog/p/11179312.html
Copyright © 2020-2023  润新知