无人值守的 phpmyadmin 安装最终引发错误

无人值守的 phpmyadmin 安装最终引发错误

我正在尝试在我的 Ubuntu 12.04LTS 上安装 phpmyadmin,并通过 debconf-set-selection 命令预先植入信息

这就是我正在使用的

echo phpmyadmin phpmyadmin/dbconfig-install boolean true | debconf-set-selections
echo phpmyadmin phpmyadmin/app-password-confirm password pwd | debconf-set-selections
echo phpmyadmin phpmyadmin/mysql/admin-pass password pwd| debconf-set-selections
echo phpmyadmin phpmyadmin/mysql/app-pass password pwd| debconf-set-selections
echo phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2 | debconf-set-selections
echo phpmyadmin phpmyadmin/upgrade-backup boolean true | debconf-set-selections

但我总是收到以下错误信息

error: Cannot find a question for phpmyadmin/dbconfig-install
error: Cannot find a question for phpmyadmin/app-password-confirm
error: Cannot find a question for phpmyadmin/mysql/admin-pass
error: Cannot find a question for phpmyadmin/mysql/app-pass
error: Cannot find a question for phpmyadmin/upgrade-backup

如果我尝试从 shell 使用 sudo 运行该命令,我会收到以下消息

debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied

但是,我曾经能够安装它。那么可能是什么原因呢?

谢谢安德里亚

答案1

这可能与 debconf 错误有关: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487300

您的 debconf 数据库可能已损坏。

跑步/usr/share/debconf/fix_db.pl可以解决这个问题。

我希望这个对你有用。

答案2

正在运行:sudo /usr/share/debconf/fix_db.pl可以修复它。

记得安装mysql服务器,因为你需要连接socket。无人值守也是:

echo "mysql-server mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server mysql-server/root_password_again password root" | sudo debconf-set-selections

apt-get install mysql-client mysql-server -y

在高权限下,最终的安装将是:

echo 'phpmyadmin phpmyadmin/dbconfig-install boolean true' | sudo debconf-set-selections
echo 'phpmyadmin phpmyadmin/app-password-confirm password root' | sudo debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/admin-pass password root' | sudo debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/app-pass password root' | sudo debconf-set-selections
echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2' | sudo debconf-set-selections
sudo apt-get install phpmyadmin -y

这样,一切都运行得非常顺利。

答案3

如有疑问,请添加更多sudos...这对我的无人值守 MySQL 安装有效:

sudo echo "mysql-community-server mysql-community-server/root-pass password ${DB_PASSWORD_ROOT}" | sudo debconf-set-selections

与 OP 一样,我的脚本以前以 root 身份运行良好,没有任何sudo前缀。所以我不确定为什么在某些情况下或环境中这很重要:

https://github.com/littlebizzy/slickstack/blob/master/ss-install-mysql.txt

顺便说一句,感谢那些分享此片段的人:

sudo /usr/share/debconf/fix_db.pl...至少很有趣!

相关内容