添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

1. 系统不支持

The apt-get command only works on Debian, Ubuntu, and its derivatives. If you are trying to install rpm-based operating systems such as Fedora, RHEL and CentOS, the command will not work. As a result, you will receive the error.

apt-get 仅支持

  • Debian
  • Ubuntu
  • 2. 系统支持但是apt-get 未安装

  • 下载 apt.deb 安装包
    wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_2.5.0_amd64.deb
  • 4.1 简介

    Small. Simple. Secure.Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.
    Alpine Linux 是一个社区开发的面向安全应用的轻量级Linux发行版。 Alpine 的意思是“高山的”,它采用了musl libc和busybox以减小系统的体积和运行时资源消耗,同时还提供了自己的包管理工具apk。

    4.2 适用环境
    由于其小巧、安全、简单以及功能完备的特点,被广泛应用于众多Docker容器中。我司目前使用的基础镜像均是基于该系统,dockerhub上有提供各种语言的基础镜像.如:node:8-alpine、python:3.6-alpine,同时也可以基于alpine镜像制作符合自己需求的基础镜像。

    4.3 apk包管理
    apk --help可以查看完整的包管理命令

     apk-tools 2.10.4, compiled for x86_64.
    Installing and removing packages:
      add       Add PACKAGEs to 'world' and install (or upgrade) them, while ensuring that all dependencies are met
      del       Remove PACKAGEs from 'world' and uninstall them
    System maintenance:
      fix       Repair package or upgrade it without modifying main dependencies
      update    Update repository indexes from all remote repositories
      upgrade   Upgrade currently installed packages to match repositories
      cache     Download missing PACKAGEs to cache and/or delete unneeded files from cache
    Querying information about packages:
      info      Give detailed information about PACKAGEs or repositories
      list      List packages by PATTERN and other criteria
      dot       Generate graphviz graphs
      policy    Show repository policy for packages
    Repository maintenance:
      index     Create repository index file from FILEs
      fetch     Download PACKAGEs from global repositories to a local directory
      verify    Verify package integrity and signature
      manifest  Show checksums of package contents
    Use apk <command> --help for command-specific help.
    Use apk --help --verbose for a full command listing.
    

    4.3.1 Alpine apk 安装

  • (Docker)Alpine apk设置国内源
  • sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

  • 4.3.2 安装
  • apk add packagename

    **4.3.3 Permission denied 问题: **

    /opt/www $ apk add vim ERROR: Unable to lock database: Permission denied ERROR: Failed to open apk database: Permission denied
    4.4 登录docker的用户权限不足,退出docker 容器,重新进入容器加参数 -u root 登录

    sudo docker exec -u root -it flask_glt sh

    Alpine以其小巧、简单在docker容器中得到了广泛的应用。但是Alpine Linux使用了musl,可能和其他Linux发行版使用的glibc实现会有些不同。这里主要介绍了它的基础用法,但是足以满足日常运维需要。毕竟在kubernetes集群中操作容器内环境较直接在虚拟机或者物理机上操作更为复杂,由于缩减的容器的大小,导致和CentOS或Ubuntu相比缺少许多功能。而缺少的这些功能又不想在基础镜像中安装导致容器变大,这个时候就可以在容器运行后,根据实际需要安装即可。

    LESS IS MORE !