zoukankan      html  css  js  c++  java
  • debconf-utils

    debconf-utils是一个可以在Ubuntu下预先配置要安装程序的小工具,它可以避免在安装一个DEB程序时的弹窗输入问题,这可能在编写一键部署脚本的时候非常有用。
    以下我们用安装MySQL-APT源作为示例。

    1、安装debconf-utils

    root@ubuntu:~# apt-get -y install debconf-utils
    

    2、更新APT源

    root@ubuntu:~# apt-get update
    

    3、先手动安装一遍MySQL-APT源

    此时有弹窗!根据弹窗和自己的需求输入并安装一遍。

    root@ubuntu:~# wget https://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
    root@ubuntu:~# dpkg -i mysql-apt-config_0.8.13-1_all.deb
    

    4、查询想要预先配置的DEB程序的相关配置信息

    通过已安装的DEB程序,获取到想要静默安装预配置信息。

    root@ubuntu:~# debconf-get-selections |grep 'mysql-apt-config'
    mysql-apt-config mysql-apt-config/select-tools select Enabled
    mysql-apt-config mysql-apt-config/select-server select mysql-5.7
    mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt
    mysql-apt-config mysql-apt-config/preview-component string
    mysql-apt-config mysql-apt-config/repo-codename select xenial
    mysql-apt-config mysql-apt-config/tools-component string mysql-tools
    mysql-apt-config mysql-apt-config/select-preview select Disabled
    mysql-apt-config mysql-apt-config/select-product select Ok
    mysql-apt-config mysql-apt-config/repo-distro select ubuntu
    mysql-apt-config mysql-apt-config/unsupported-platform select abort
    mysql-apt-config mysql-apt-config/dmr-warning note
    

    5、然后卸载已安装的DEB包

    卸载刚刚需要通过图形化弹窗安装程序。

    root@ubuntu:~# apt-get -y remove mysql-apt-config
    

    6、重新安装DEB包,预配置软件

    根据上面获取到预配置信息,预配置软件。

    root@ubuntu:~# debconf-set-selections << EOF
    mysql-apt-config mysql-apt-config/select-tools select Enabled
    mysql-apt-config mysql-apt-config/select-server select mysql-5.7
    mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt
    mysql-apt-config mysql-apt-config/preview-component string
    mysql-apt-config mysql-apt-config/repo-codename select xenial
    mysql-apt-config mysql-apt-config/tools-component string mysql-tools
    mysql-apt-config mysql-apt-config/select-preview select Disabled
    mysql-apt-config mysql-apt-config/select-product select Ok
    mysql-apt-config mysql-apt-config/repo-distro select ubuntu
    mysql-apt-config mysql-apt-config/unsupported-platform select abort
    mysql-apt-config mysql-apt-config/dmr-warning note
    EOF
    

    6、关闭交互式的静默安装DEB包

    你会发现没有弹窗提示了!

    root@ubuntu:~# DEBIAN_FRONTEND=noninteractive apt-get -y install ./mysql-apt-config_0.8.13-1_all.deb
    
    乐在分享!~~
  • 相关阅读:
    SQLServer之视图简介
    几种快速以伺服静态文件的方法
    Node.js静态文件服务器实战[转]
    mac ssh中文乱码解决
    SSH上传和下载文件
    在web项目中集成pdf.js的默认查看器
    用pip批量更新所有包
    C# 异步锁【转】
    .NET 4并行编程入门之Task的取消[转]
    VIM技巧:选择文本块
  • 原文地址:https://www.cnblogs.com/network-ren/p/15513774.html
Copyright © 2011-2022 走看看