在Ubuntu环境下安装DEB包时,比如安装MySQL式经常会弹出交互式要输入密码的操作。有时候我们期望编写Shell脚本一键部署MySQL时不想要弹窗交互时,则可以使用以下方式实现自动化安装Deb软件。

概述

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

如果您觉得本文章受用,请点个赞,给个评论!谢谢.~~~

Ubuntu 静默安装DEB包(非交互式)~解决Ubuntu下安装DEB包弹窗交互的问题的更多相关文章

  1. 解决VirtualBox下安装虚拟机(Ubuntu)出错(不能为虚拟电脑Ubuntu打开一个新的任务)的有关问题

    [转]http://www.myexception.cn/program/1964906.html 解决VirtualBox下安装虚拟机(Ubuntu)出错(不能为虚拟电脑Ubuntu打开一个新的任务 ...

  2. 解决mac下安装yeoman时没有权限问题

    在mac下安装yeoman经常会出现如下图错误: 解决办法:在命令行执行-- sudo chown -R $USER /usr/local/lib/node_modules 回车就OK

  3. 解决pycharm下安装reportLab报错的问题

    在利用pycharm中自带的第三方安装工具安装reportLab时提示安装失败.失败的原因是缺失第三方扩展包.经过查阅查阅资料了解到一些python的第三方扩展包是需要python-dev支持的.我装 ...

  4. 解决Esxi5下安装Windows 8的问题

    在VM8工作站版下安装windows 8没有问题,可是到了Esxi5下,非得安装补丁不可.补丁下载地址: http://kb.vmware.com/selfservice/microsites/sea ...

  5. 解决 linux 下安装 node 报: command not found

    注意:有时安装成功后,需要关闭xshell,重新启动.nvm才会生效. 1. 在 linux 下安装 node 提示 -bash:  node: command not found. 2. 这种情况可 ...

  6. 安装SQL SERVER2005时,需要win7下安装IIS,记录下

    安装SQL server2005 时,需要先安装IIS,这里描述win7系统下配置IIS的方法. 虽然很多文章都有写过,这里只是重复一下 关键是IIS组件全都勾选上,如果没有全部勾选上,IIS组件没有 ...

  7. 解决Windows10下安装Ubuntu16.04双系统后开机没有Ubuntu引导

    转载 https://blog.csdn.net/qq_27838307/article/details/79149791 1.按照网上教程在磁盘中压缩硬盘并且不需要给他新建卷标,就让他显示空闲就好了 ...

  8. 解决VMware下安装Ubuntu 16.04 不支持1920X1080分辨率的问题

    解决方法: flashmx@ubuntu:~$ cvt # 192.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline -hsync +vsync fl ...

  9. 解决 windows下安装Anaconda后python pip不可用的情况

    在windows系统下通过安装Anaconda的方式安装的python使用中发现不能再通过pip安装python包.只能通过conda install packname 的方法,导致很多conda不支 ...

  10. 解决VMware下安装Ubuntu15不支持1920X1080分辨率的问题

    解决步骤如下: flashmx@ubuntu:~$ cvt # 192.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline -hsync +vsync ...

随机推荐

  1. Flutter入门教程(四)第一个flutter项目解析

    一.创建一个Flutter工程 1.1 命令行创建 首先我们找一个空目录用来专门存放flutter项目,然后在路径中直接输入cmd: 使用 flutter create <projectname ...

  2. 一次关于关系抽取(RE)综述调研的交流心得

    本文来自于一次交流的的记录,{}内的为个人体会. 基本概念 实事知识:实体-关系-实体的三元组.比如, 知识图谱:大量实时知识组织在一起,可以构建成知识图谱. 关系抽取:由于文本中蕴含大量事实知识,需 ...

  3. devicePixelRatio 那些事儿

    devicePixelRatio 那些事儿 设备像素比 window.devicePixelRatio 是设备上物理像素和设备独立像素的比例,即公式表示为:window.devicePixelRati ...

  4. 彻底理解volatile关键字

    1. volatile简介 在上一篇文章中我们深入理解了java关键字,我们知道在java中还有一大神器就是关键volatile,可以说是和synchronized各领风骚,其中奥妙,我们来共同探讨下 ...

  5. Ubuntu20.04中创建Pycharm桌面快捷方式

    [Desktop Entry] Type=Application Name=Pycharm GenericName=Pycharm3 Comment=Pycharm3:The Python IDE E ...

  6. Mybatis模糊查询结果为空的解决方案

    写在前面 Mybatis使用模糊查询,查询结果为空的解决方案,我的代码是 select * from sp_user where 1=1 <if test="username!=nul ...

  7. JAVASE If 单选择、双选择及镶嵌笔记

    //单选package com.huang.boke.flowPath;import java.util.Scanner;public class test02 { public static voi ...

  8. DTO数据传输对象详解

    文章目录 一.DTO是什么? 二.DTO解决的问题 三.代码演示 一.DTO是什么? DTO (数据传输对象) 数据传输对象(DTO),是一种设计模式之间传输数据的软件应用系统.数据传输目标往往是数据 ...

  9. uTools .SRT 转 .VTT 格式转换自动化小工具

    不想用网上的转换工具,要有网,先上传,再下载,可能还要看广告.有些工具也不是很方便.打算配合uTools的自动化助手插件搞一个一键格式转换.

  10. 论文翻译:2018_LSTM剪枝_Learning intrinsic sparse structures within long short-term memory

    论文地址:在长短时记忆中学习内在的稀疏结构 论文代码:https://github.com/wenwei202/iss-rnns 引用格式:Wen W, He Y, Rajbhandari S, et ...