Created
July 27, 2018 14:31
-
-
Save soubrunorocha/ec30b7704d737a1797b0281e97967834 to your computer and use it in GitHub Desktop.
Installing MySQL 8 in silent mode on Ubuntu ( Without prompting )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#update and install some dependencies | |
sudo apt-get update && apt-get upgrade -y; | |
sudo apt-get install -y debconf-utils zsh htop libaio1; | |
#set the root password | |
DEFAULTPASS="rootpass" | |
#set some config to avoid prompting | |
sudo debconf-set-selections <<EOF | |
mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | |
mysql-community-server mysql-community-server/root-pass password $DEFAULTPASS | |
mysql-community-server mysql-community-server/re-root-pass password $DEFAULTPASS | |
EOF | |
#get the mysql repository via wget | |
wget --user-agent="Mozilla" -O /tmp/mysql-apt-config_0.8.10-1_all.deb https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb; | |
#set debian frontend to not prompt | |
export DEBIAN_FRONTEND="noninteractive"; | |
#config the package | |
sudo -E dpkg -i /tmp/mysql-apt-config_0.8.10-1_all.deb; | |
#update apt to get mysql repository | |
sudo apt-get update | |
#install mysql according to previous config | |
sudo -E apt-get install mysql-server mysql-client --assume-yes --force-yes |
So I got this working for MySql version 8.0.32.
mysql-apt-config mysql-apt-config/select-tools select Enabled
mysql-apt-config mysql-apt-config/unsupported-platform select abort
mysql-apt-config mysql-apt-config/preview-component string
mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt
mysql-apt-config mysql-apt-config/select-server select
mysql-apt-config mysql-apt-config/repo-codename select bionic
mysql-apt-config mysql-apt-config/select-preview select Disabled
mysql-apt-config mysql-apt-config/tools-component string mysql-tools
mysql-apt-config mysql-apt-config/select-product select
mysql-apt-config mysql-apt-config/repo-distro select ubuntu
mysql-apt-config mysql-apt-config/dmr-warning note
EOF
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config_0.8.24-1_all.deb
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4;
sudo apt update
sudo DEBIAN_FRONTEND="noninteractive" apt install -y mysql-server
The trick for me was to run the mysql-apt-config_0.8.24-1_all.deb in interactive mode. Then run the tool debconf-get-selections | grep mysql-apt-config
. That will give you the contents of the EOF
block
You need to run sudo apt install debconf-utils
to get the debconf-get-selections
command.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to install version 5.7.41 not 8.0