Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql 5.7 community server non-interactive apt install

Tags:

mysql

apt

dpkg

I am trying create a shell call for non-interactive mysql 5.7 community server installation on ubuntu 14.04. According to various sources using debconf-set-selections should allow such an installation yet I am unable to launch non-interactive dpkg installer.

Bellow are the env variables that I am trying to use for non-interactive install

vagrant@default-ubuntu-1404:/sql$ echo $DEBIAN_FRONTEND 
noninteractive
vagrant@default-ubuntu-1404:/sql$ echo mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7 | sudo debconf-set-selections

Here are all the mysql-apt-config settings for the system

vagrant@default-ubuntu-1404:/sql$ sudo debconf-get-selections | grep mysql
    mysql-apt-config    mysql-apt-config/select-tools   select  workbench-6.2 workbench-6.3 connector-python-2.0 connector-python-2.1 router-2.0 mysql-utilities-1.5 mysql-tools
    mysql-apt-config    mysql-apt-config/select-preview select  
    mysql-apt-config    mysql-apt-config/repo-distro    select  ubuntu
    mysql-apt-config    mysql-apt-config/enable-repo    select  mysql-5.7
    mysql-apt-config    mysql-apt-config/repo-url   string  http://repo.mysql.com/apt/
    # Choices: MySQL Server (Currently selected: mysql-5.7), MySQL Tools & Connectors (Currently selected: Enabled), MySQL Preview Packages (Currently selected: Disabled), Ok
    mysql-apt-config    mysql-apt-config/select-product select  
    mysql-apt-config    mysql-apt-config/repo-codename  select  trusty
    mysql-apt-config    mysql-apt-config/unsupported-platform   select  abort
    # Choices: mysql-5.6, mysql-5.7, None
    mysql-apt-config    mysql-apt-config/select-server  select  

And the installation itself:

wget http://dev.mysql.com/get/mysql-apt-config_0.7.2-1_all.deb
sudo dpkg -i mysql-apt-config_0.7.2-1_all.deb

gets launched in interactive mode.

Any ideas?

like image 380
Armo Avatar asked May 02 '16 09:05

Armo


People also ask

What is the latest version of MySQL-client for APT?

When you tried to install mysql-community-server 5.7, APT tried to fetch latest mysql-client which is 8.0 since all have same priority and that's incompatible with MySQL 5.7. Though installing packages one by one using DPKG as mentioned by other answer is fine but that may be long manual task.

How do I install MySQL APT repository?

1 Back up your database. ... 2 Follow the steps given previously for adding the MySQL APT repository . 3 Remove the old installation of MySQL by running: Press CTRL+C to copy shell> sudo dpkg -P mysql 4 Install MySQL from the MySQL APT repository: Press CTRL+C to copy shell> sudo apt-get install mysql-server More items...

Is it possible to install MySQL on Ubuntu 20 04?

Mysql 5.7 is not available to the Ubuntu 20.04. Only mysql 8.0 and higher version are available to Ubuntu 20.04 when you use mysql repository. Here you are using bionic source list (Ubuntu 18.04) for Ubuntu 20.04. I believe this workaround sometimes causes messup with dependencies tree.

How do I install the MySQL server?

For a basic installation of the MySQL server, install the database common files package, the client package, the client metapackage, the server package, and the server metapackage (in that order) with the following steps: Preconfigure the MySQL server package with the following command:


1 Answers

This works for me if running as root

export DEBIAN_FRONTEND=noninteractive

debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-codename select trusty'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-distro select ubuntu'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt/'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-preview select '
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-product select Ok'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-server select mysql-5.7'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-tools select '
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/unsupported-platform select abort'

wget http://dev.mysql.com/get/mysql-apt-config_0.7.2-1_all.deb
dpkg -i mysql-apt-config_0.7.2-1_all.deb
apt-get update
apt-get install -y mysql-server-5.7
like image 53
barbushin Avatar answered Oct 12 '22 01:10

barbushin