我一直尝试在我的系统上安装 MariaDB,但安装总是在以下步骤停止
$ sudo apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
galera-3 libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libfcgi-perl libhtml-template-perl libreadline5
libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server-10.3 mariadb-server-core-10.3 socat
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libipc-sharedcache-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
galera-3 libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libfcgi-perl libhtml-template-perl libreadline5
libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 socat
0 upgraded, 17 newly installed, 0 to remove and 18 not upgraded.
Need to get 0 B/19.6 MB of archives.
After this operation, 165 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package galera-3.
(Reading database ... 213104 files and directories currently installed.)
Preparing to unpack .../00-galera-3_25.3.29-1_amd64.deb ...
Unpacking galera-3 (25.3.29-1) ...
Selecting previously unselected package libdbi-perl:amd64.
Preparing to unpack .../01-libdbi-perl_1.643-1_amd64.deb ...
Unpacking libdbi-perl:amd64 (1.643-1) ...
Selecting previously unselected package libconfig-inifiles-perl.
Preparing to unpack .../02-libconfig-inifiles-perl_3.000002-1_all.deb ...
Unpacking libconfig-inifiles-perl (3.000002-1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../03-libaio1_0.3.112-5_amd64.deb ...
Unpacking libaio1:amd64 (0.3.112-5) ...
Selecting previously unselected package libreadline5:amd64.
Preparing to unpack .../04-libreadline5_5.2+dfsg-3build3_amd64.deb ...
Unpacking libreadline5:amd64 (5.2+dfsg-3build3) ...
Selecting previously unselected package mariadb-client-core-10.3.
Preparing to unpack .../05-mariadb-client-core-10.3_1%3a10.3.25-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mariadb-client-core-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Selecting previously unselected package mariadb-client-10.3.
Preparing to unpack .../06-mariadb-client-10.3_1%3a10.3.25-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mariadb-client-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Selecting previously unselected package mariadb-server-core-10.3.
Preparing to unpack .../07-mariadb-server-core-10.3_1%3a10.3.25-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mariadb-server-core-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Selecting previously unselected package socat.
Preparing to unpack .../08-socat_1.7.3.3-2_amd64.deb ...
Unpacking socat (1.7.3.3-2) ...
Selecting previously unselected package mariadb-server-10.3.
Preparing to unpack .../09-mariadb-server-10.3_1%3a10.3.25-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mariadb-server-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../10-libcgi-pm-perl_4.46-1_all.deb ...
Unpacking libcgi-pm-perl (4.46-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../11-libfcgi-perl_0.79-1_amd64.deb ...
Unpacking libfcgi-perl (0.79-1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../12-libcgi-fast-perl_1%3a2.15-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.15-1) ...
Selecting previously unselected package libdbd-mysql-perl:amd64.
Preparing to unpack .../13-libdbd-mysql-perl_4.050-3_amd64.deb ...
Unpacking libdbd-mysql-perl:amd64 (4.050-3) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../14-libhtml-template-perl_2.97-1_all.deb ...
Unpacking libhtml-template-perl (2.97-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../15-libterm-readkey-perl_2.38-1build1_amd64.deb ...
Unpacking libterm-readkey-perl (2.38-1build1) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../16-mariadb-server_1%3a10.3.25-0ubuntu0.20.04.1_all.deb ...
Unpacking mariadb-server (1:10.3.25-0ubuntu0.20.04.1) ...
Setting up libconfig-inifiles-perl (3.000002-1) ...
Setting up libreadline5:amd64 (5.2+dfsg-3build3) ...
Setting up libcgi-pm-perl (4.46-1) ...
Setting up libhtml-template-perl (2.97-1) ...
Setting up socat (1.7.3.3-2) ...
Setting up galera-3 (25.3.29-1) ...
Setting up libfcgi-perl (0.79-1) ...
Setting up libterm-readkey-perl (2.38-1build1) ...
Setting up libaio1:amd64 (0.3.112-5) ...
Setting up libdbi-perl:amd64 (1.643-1) ...
Setting up libcgi-fast-perl (1:2.15-1) ...
Setting up mariadb-server-core-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Setting up libdbd-mysql-perl:amd64 (4.050-3) ...
Setting up mariadb-client-core-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Setting up mariadb-client-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Setting up mariadb-server-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/mysql/debian-start ...
Created symlink /etc/systemd/system/mysql.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service.
进度条显示已完成 94%,安装在这里卡住了 2 个小时,我认为它不会恢复。有人能告诉我这里发生了什么,我该如何在我的系统上安装 MariaDB 吗?
答案1
我遇到了同样的问题。以下是我解决问题的步骤。从另一个 ssh/终端。
停止 apt 并移除锁
sudo killall apt
sudo killall apt-get
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
清除 mysql/mariadb 软件包
sudo apt-get purge mysql* mariadb* -y
sudo apt-get autoremove
sudo apt-get autoclean
停止 AppArmor
sudo systemctl stop apparmor.service
sudo update-rc.d -f apparmor remove
# OR/AND
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
检查所有包裹是否正常
dpkg --configure -a
重启Important
systemctl reboot
安装 mraiadb-server
sudo apt-get install mariadb-server
打开 AppArmor
sudo systemctl start apparmor.service
sudo update-rc.d apparmor defaults
# OR/AND
sudo rm /etc/apparmor.d/disable/usr.sbin.mysqld
完毕。
我希望它也适合你。