在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. 关于js中this指向的总结

    js中this指向问题一直是个坑,之前一直是懵懵懂懂的,大概知道一点,但一直不知道各种情况下指向有什么区别,今天亲自动手测试了下this的指向. 1.在对象中的this对象中的this指向我们创建的对 ...

  2. c++类调用的一个小问题

    先看这两段代码: #include <iostream> #include <vector> #include <algorithm> using namespac ...

  3. .NET程序设计实验二

    实验二  面向对象程序设计 一.实验目的 1. 理解类的定义.继承等面向对象的的基本概念: 2. 掌握C#语言定义类及其各种成员(字段,属性,方法)的方法: 3. 掌握方法覆盖的应用: 4. 掌握接口 ...

  4. 【每日日报】第十八天 ----java最全排序方法

    1 今天看了Java的第三章 2 冒泡法排序: package Line; import java.util.Arrays; public class MaoPao { public static v ...

  5. PAT A1001 A+B Format

    Calculate a+b and output the sum in standard format -- that is, the digits must be separated into gr ...

  6. C语言---魔方阵

    魔方阵的定义:在n*n的方阵中,每一行的和=每一列的和=对角线的和.(本文中涉及的n为大于3的奇数). 例如3*3的魔方阵为: 5*5的魔方阵为: 如何写魔方阵呢? 1.数字1位于第一行的正中间2.下 ...

  7. 序列化和反序列化为什么要实现Serializable接口?(史上最全、简单易懂)

    目录结 前言 1.什么是序列化和反序列化 2.什么时候需要进行序列化和反序列化 2.1.服务器和浏览器交互时用到了Serializable接口吗? 2.2.Mybatis将数据持久化到数据库中用到了S ...

  8. oracle三个连接配置文件 listener.ora、sqlnet.ora、tnsnames.ora

    关于PLSQL连接ORACLE配置字符串 首先要讲一下下面的一些知识 1.ORACLE_SID:(ORACLE SYSTEM IDENTIFIER) Oracle实例是由SGA和一组后台进程组成的,实 ...

  9. Ubuntu20.04搭建web服务器

    其他Ubuntu20以及Ubuntu18系列也可以!

  10. nodejs的tream(流)解析与模拟文件读写流源码实现

    什么是流? 可读流于可写流 双工流于转换流 背压机制与文件流模拟实现 一.什么是流? 关于流的概念早在1964年就有记录被提出了,简单的说"流"就是控制数据传输过程的程序,比如在那 ...