Ubuntu 18.04 debconf 显示提示

Ubuntu 18.04 debconf 显示提示

我正在尝试使用 bash 脚本在 Ubuntu 18.04 上自动安装 MySQL 8.0。我设置了 debconf 提示询问的所有变量,但提示仍然出现。我的脚本有什么问题?

#!/bin/bash

export DEBIAN_FRONTEND=noninteractive

MYSQL_APT_FILE_NAME="mysql_apt_repository_tmp.deb"

echo "Installing MySQL Community Server..."

wget "https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb" -O 
$MYSQL_APT_FILE_NAME &> /dev/null

if [ -z "$(ls | grep $MYSQL_APT_FILE_NAME)" ]; then
    echo "ERROR: Unable to download MySQL APT repository file"
    exit 0
fi

echo mysql-apt-config mysql-apt-config/repo-distro select ubuntu | debconf-set-selections
echo mysql-apt-config mysql-apt-config/repo-codename select trusty | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-tools select Enabled | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-preview select Disabled | debconf-set-selections
echo mysql-community-server mysql-community-server/root-pass password mystrongpassword | debconf-set-selections
echo mysql-community-server mysql-community-server/re-root-pass password mystrongpassword | debconf-set-selections

sudo dpkg -i $MYSQL_APT_FILE_NAME

答案1

我已经解决了这个问题。我需要sudo从此行中删除

sudo dpkg -i $MYSQL_APT_FILE_NAME

然后以 sudo 身份运行整个脚本。

相关内容