Ubuntu 静默安装DEB包(非交互式)~解决Ubuntu下安装DEB包弹窗交互的问题
在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包弹窗交互的问题的更多相关文章
- 解决VirtualBox下安装虚拟机(Ubuntu)出错(不能为虚拟电脑Ubuntu打开一个新的任务)的有关问题
[转]http://www.myexception.cn/program/1964906.html 解决VirtualBox下安装虚拟机(Ubuntu)出错(不能为虚拟电脑Ubuntu打开一个新的任务 ...
- 解决mac下安装yeoman时没有权限问题
在mac下安装yeoman经常会出现如下图错误: 解决办法:在命令行执行-- sudo chown -R $USER /usr/local/lib/node_modules 回车就OK
- 解决pycharm下安装reportLab报错的问题
在利用pycharm中自带的第三方安装工具安装reportLab时提示安装失败.失败的原因是缺失第三方扩展包.经过查阅查阅资料了解到一些python的第三方扩展包是需要python-dev支持的.我装 ...
- 解决Esxi5下安装Windows 8的问题
在VM8工作站版下安装windows 8没有问题,可是到了Esxi5下,非得安装补丁不可.补丁下载地址: http://kb.vmware.com/selfservice/microsites/sea ...
- 解决 linux 下安装 node 报: command not found
注意:有时安装成功后,需要关闭xshell,重新启动.nvm才会生效. 1. 在 linux 下安装 node 提示 -bash: node: command not found. 2. 这种情况可 ...
- 安装SQL SERVER2005时,需要win7下安装IIS,记录下
安装SQL server2005 时,需要先安装IIS,这里描述win7系统下配置IIS的方法. 虽然很多文章都有写过,这里只是重复一下 关键是IIS组件全都勾选上,如果没有全部勾选上,IIS组件没有 ...
- 解决Windows10下安装Ubuntu16.04双系统后开机没有Ubuntu引导
转载 https://blog.csdn.net/qq_27838307/article/details/79149791 1.按照网上教程在磁盘中压缩硬盘并且不需要给他新建卷标,就让他显示空闲就好了 ...
- 解决VMware下安装Ubuntu 16.04 不支持1920X1080分辨率的问题
解决方法: flashmx@ubuntu:~$ cvt # 192.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline -hsync +vsync fl ...
- 解决 windows下安装Anaconda后python pip不可用的情况
在windows系统下通过安装Anaconda的方式安装的python使用中发现不能再通过pip安装python包.只能通过conda install packname 的方法,导致很多conda不支 ...
- 解决VMware下安装Ubuntu15不支持1920X1080分辨率的问题
解决步骤如下: flashmx@ubuntu:~$ cvt # 192.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline -hsync +vsync ...
随机推荐
- JavaScript & 6小时了解ES6基本语法
一步一步似爪牙. 前言 学习es6之前我们可能并不知道es6相比es5差距在哪, 但是这并不妨碍我们站在巨人的肩膀上; 程序员就是要乐于尝鲜; 学习es6最终目的是结合es5 一起进行工程项目开发, ...
- [FireshellCTF2020]ScreenShooter 1
此题关键在于理清逻辑,本地将url发送给服务器,服务器请求sereenshooter以后将结果返回 所以应该在服务器查看日志. 发现了PhantomJS 引擎一下 <!DOCTYPE html& ...
- ccf201912-1 报数 C++代码实现
代码实现: #include<iostream> using namespace std; /*题目限制为三位数*/ /*思路: 1.用一个长度为4的数组(初值为0)保存每个人分别跳过了几 ...
- Configuration类的理解
Configuration类主要用来读取配置文件,启动Hibernate,并负责Hibernate的配置信息.一个应用程序只创建一个Configuration. 在Hibernate启动过程中,Con ...
- DOM节点详解
@ 目录 学习总结 1. 什么是 DOM 2. HTMLDOM 3. 元素获取 元素获取方式: 元素节点的属性操作 4. Node 对象的属性和方法 常用属性 常用方法 5. 事件处理 事件驱动编程 ...
- 微信小程序加密解密参数
加密:encodeURIComponent(参数) 解密:decodeURIComponent(参数)
- 通过面试题学JavaScript知识(1)
// a 是多少的时候 可以让下面的打印ok if(a == 1 && a == 2 && a ==3){ console.log('ok') } 分析1: == 比较 ...
- 论文解读(Graph-MLP)《Graph-MLP: Node Classification without Message Passing in Graph》
论文信息 论文标题:Graph-MLP: Node Classification without Message Passing in Graph论文作者:Yang Hu, Haoxuan You, ...
- cannot find module providing package github.com/× working directory is not part of a module
今天在搭建fabric的过程中遇到一个问题,记录一下 root@zitao /home/hong/Desktop/gowork/src/github.com/hyperledger/fabric re ...
- Linux 开启远程访问
系统:Ubuntu16.0 虚拟机 问题:Windows访问Ubun被拒绝 解决方法: 1.先检测是否安装SSH服务 1 sudo apt-get install ssh 2.编辑ssh配置文件 1 ...