如何在非交互式shell上配置Ubuntu上的MySQL APT repo?
作者:互联网
我想在Travis CI上安装MySQL 5.7,它运行Ubuntu 12虚拟机.
我愿意使用official MySQL APT repo:
wget http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
sudo dpkg --install mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
但问题是,安装此软件包会打开一个交互式菜单,询问以下问题:
Which Server version do you wish to receive?
- mysql-5.6
- mysql-5.7-dmr
由于安装是自动脚本的一部分,我不是在终端后面回答问题.我在doc中唯一能找到的是:
Selecting a Major Release Version
By default, all installations and upgrades for your MySQL server and the other required components come from the release series of the major version you have selected during the installation of the configuration package (see Adding the MySQL APT Repository). However, you can switch to another supported major release series at any time by reconfiguring the configuration package you have installed. Use the following command:
shell> sudo dpkg-reconfigure mysql-apt-config
但同样,这会打开一个交互式菜单.
如何在非交互式shell上安装此APT存储库并将其配置为使用mysql-5.7-dmr?
解决方法:
礼貌@hbdgaf,this how-to让我走上正轨:
export DEBIAN_FRONTEND=noninteractive
echo mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7-dmr | sudo debconf-set-selections
wget http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
sudo dpkg --install mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
我把整个过程放在一起this gist.
标签:dpkg,mysql,debconf 来源: https://codeday.me/bug/20190809/1632188.html