zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    深度学习100问
    BAT机器学习面试1000题系列
    深度学习项目——基于卷积神经网络(CNN)的人脸在线识别系统
    深入理解卷积层
    AI大道理头尾标识
    git-svn Manual Page
    收藏夹
    C语言 #、##、#@在#define中的用法
    ubuntu 编译安装自己的git-svn
    ALSA参考文档
  • 原文地址:https://www.cnblogs.com/FengGeBlog/p/11179312.html
Copyright © 2011-2022 走看看