在 ubuntu 16.04 中安装 phpmyadmin 时出现错误

在 ubuntu 16.04 中安装 phpmyadmin 时出现错误

我正在尝试安装Php 管理员在 ubuntu 16.04 上。

sudo apt-get install phpmyadmin php-mbstring php-gettext

输出如下:-

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libdb5.1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  apache2-bin dbconfig-common dbconfig-mysql libapache2-mod-php
  libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap libjs-sphinxdoc libjs-underscore liblua5.1-0 libmcrypt4
  php-cli php-common php-gd php-mcrypt php-mysql php-pear php-phpseclib
  php-tcpdf php-xml php7.0-cli php7.0-common php7.0-gd php7.0-json
  php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-readline
  php7.0-xml
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom libmcrypt-dev
  mcrypt php-libsodium php-gmp php-imagick
The following NEW packages will be installed:
  apache2-bin dbconfig-common dbconfig-mysql libapache2-mod-php
  libapache2-mod-php7.0 libjs-sphinxdoc libjs-underscore liblua5.1-0
  libmcrypt4 php-cli php-common php-gd php-gettext php-mbstring php-mcrypt
  php-mysql php-pear php-phpseclib php-tcpdf php-xml php7.0-cli php7.0-common
  php7.0-gd php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql
  php7.0-opcache php7.0-readline php7.0-xml phpmyadmin
The following packages will be upgraded:
  libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
4 upgraded, 31 newly installed, 0 to remove and 343 not upgraded.
Need to get 18.5 MB of archives.
After this operation, 71.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8,720 B]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 apache2-bin amd64 2.4.18-2ubuntu3.1 [923 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 dbconfig-common all 2.0.4ubuntu1 [582 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 dbconfig-mysql all 2.0.4ubuntu1 [1,038 B]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-common all 1:35ubuntu6 [10.8 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-common amd64 7.0.15-0ubuntu0.16.04.4 [836 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-json amd64 7.0.15-0ubuntu0.16.04.4 [16.9 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-opcache amd64 7.0.15-0ubuntu0.16.04.4 [76.5 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-readline amd64 7.0.15-0ubuntu0.16.04.4 [12.8 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-cli amd64 7.0.15-0ubuntu0.16.04.4 [1,284 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 libapache2-mod-php7.0 amd64 7.0.15-0ubuntu0.16.04.4 [1,227 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libapache2-mod-php all 1:7.0+35ubuntu6 [2,960 B]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libjs-underscore all 1.7.0~dfsg-1ubuntu1 [46.7 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libjs-sphinxdoc all 1.3.6-2ubuntu1 [57.5 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libmcrypt4 amd64 2.5.8-3.3 [63.0 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-cli all 1:7.0+35ubuntu6 [2,920 B]
Get:21 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-gd amd64 7.0.15-0ubuntu0.16.04.4 [27.1 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-gd all 1:7.0+35ubuntu6 [1,928 B]
Get:23 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-xml amd64 7.0.15-0ubuntu0.16.04.4 [113 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-xml all 1:7.0+35ubuntu6 [1,954 B]
Get:25 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-pear all 1:1.10.1+submodules+notgz-6 [284 kB]
Get:26 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-gettext all 1.0.11-2build1 [15.8 kB]
Get:27 http://us.archive.ubuntu.com/ubuntu xenial-security/universe amd64 php7.0-mbstring amd64 7.0.15-0ubuntu0.16.04.4 [465 kB]
Get:28 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-mbstring all 1:7.0+35ubuntu6 [1,940 B]
Get:29 http://us.archive.ubuntu.com/ubuntu xenial-security/universe amd64 php7.0-mcrypt amd64 7.0.15-0ubuntu0.16.04.4 [14.4 kB]
Get:30 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-mcrypt all 1:7.0+35ubuntu6 [1,930 B]
Get:31 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 php7.0-mysql amd64 7.0.15-0ubuntu0.16.04.4 [123 kB]
Get:32 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-mysql all 1:7.0+35ubuntu6 [1,936 B]
Get:33 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-phpseclib all 2.0.1-1build1 [173 kB]
Get:34 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 php-tcpdf all 6.0.093+dfsg-1ubuntu1 [7,881 kB]
Get:35 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 phpmyadmin all 4:4.5.4.1-2ubuntu2 [3,934 kB]
Fetched 18.5 MB in 25s (723 kB/s)                                              
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 240522 files and directories currently installed.)
Preparing to unpack .../libapr1_1.5.2-3_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-3) over (1.4.6-1) ...
Preparing to unpack .../libaprutil1-ldap_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.5.4-1build1) over (1.3.12+dfsg-3) ...
Preparing to unpack .../libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) over (1.3.12+dfsg-3) ...
Preparing to unpack .../libaprutil1_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-1build1) over (1.3.12+dfsg-3) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../liblua5.1-0_5.1.5-8ubuntu1_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8ubuntu1) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../apache2-bin_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2-bin (2.4.18-2ubuntu3.1) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-bin_2.4.18-2ubuntu3.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_authnz_ldap.so', which is also in package apache2.2-bin 2.2.22-1ubuntu1.11
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package dbconfig-common.
Preparing to unpack .../dbconfig-common_2.0.4ubuntu1_all.deb ...
Unpacking dbconfig-common (2.0.4ubuntu1) ...
Selecting previously unselected package dbconfig-mysql.
Preparing to unpack .../dbconfig-mysql_2.0.4ubuntu1_all.deb ...
Unpacking dbconfig-mysql (2.0.4ubuntu1) ...
Selecting previously unselected package php-common.
Preparing to unpack .../php-common_1%3a35ubuntu6_all.deb ...
Unpacking php-common (1:35ubuntu6) ...
Selecting previously unselected package php7.0-common.
Preparing to unpack .../php7.0-common_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-common (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php7.0-json.
Preparing to unpack .../php7.0-json_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-json (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php7.0-opcache.
Preparing to unpack .../php7.0-opcache_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-opcache (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php7.0-readline.
Preparing to unpack .../php7.0-readline_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-readline (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php7.0-cli.
Preparing to unpack .../php7.0-cli_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-cli (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package libapache2-mod-php7.0.
Preparing to unpack .../libapache2-mod-php7.0_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking libapache2-mod-php7.0 (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package libapache2-mod-php.
Preparing to unpack .../libapache2-mod-php_1%3a7.0+35ubuntu6_all.deb ...
Unpacking libapache2-mod-php (1:7.0+35ubuntu6) ...
Selecting previously unselected package libjs-underscore.
Preparing to unpack .../libjs-underscore_1.7.0~dfsg-1ubuntu1_all.deb ...
Unpacking libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
Selecting previously unselected package libjs-sphinxdoc.
Preparing to unpack .../libjs-sphinxdoc_1.3.6-2ubuntu1_all.deb ...
Unpacking libjs-sphinxdoc (1.3.6-2ubuntu1) ...
Selecting previously unselected package libmcrypt4.
Preparing to unpack .../libmcrypt4_2.5.8-3.3_amd64.deb ...
Unpacking libmcrypt4 (2.5.8-3.3) ...
Selecting previously unselected package php-cli.
Preparing to unpack .../php-cli_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-cli (1:7.0+35ubuntu6) ...
Selecting previously unselected package php7.0-gd.
Preparing to unpack .../php7.0-gd_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-gd (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php-gd.
Preparing to unpack .../php-gd_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-gd (1:7.0+35ubuntu6) ...
Selecting previously unselected package php7.0-xml.
Preparing to unpack .../php7.0-xml_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-xml (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php-xml.
Preparing to unpack .../php-xml_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-xml (1:7.0+35ubuntu6) ...
Selecting previously unselected package php-pear.
Preparing to unpack .../php-pear_1%3a1.10.1+submodules+notgz-6_all.deb ...
Unpacking php-pear (1:1.10.1+submodules+notgz-6) ...
Selecting previously unselected package php-gettext.
Preparing to unpack .../php-gettext_1.0.11-2build1_all.deb ...
Unpacking php-gettext (1.0.11-2build1) ...
Selecting previously unselected package php7.0-mbstring.
Preparing to unpack .../php7.0-mbstring_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-mbstring (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php-mbstring.
Preparing to unpack .../php-mbstring_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-mbstring (1:7.0+35ubuntu6) ...
Selecting previously unselected package php7.0-mcrypt.
Preparing to unpack .../php7.0-mcrypt_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-mcrypt (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php-mcrypt.
Preparing to unpack .../php-mcrypt_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-mcrypt (1:7.0+35ubuntu6) ...
Selecting previously unselected package php7.0-mysql.
Preparing to unpack .../php7.0-mysql_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-mysql (7.0.15-0ubuntu0.16.04.4) ...
Selecting previously unselected package php-mysql.
Preparing to unpack .../php-mysql_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-mysql (1:7.0+35ubuntu6) ...
Selecting previously unselected package php-phpseclib.
Preparing to unpack .../php-phpseclib_2.0.1-1build1_all.deb ...
Unpacking php-phpseclib (2.0.1-1build1) ...
Selecting previously unselected package php-tcpdf.
Preparing to unpack .../php-tcpdf_6.0.093+dfsg-1ubuntu1_all.deb ...
Unpacking php-tcpdf (6.0.093+dfsg-1ubuntu1) ...
Selecting previously unselected package phpmyadmin.
Preparing to unpack .../phpmyadmin_4%3a4.5.4.1-2ubuntu2_all.deb ...
Unpacking phpmyadmin (4:4.5.4.1-2ubuntu2) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
Processing triggers for doc-base (0.10.7) ...
Processing 4 added doc-base files...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.18-2ubuntu3.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

为了解决这个问题,我尝试运行以下命令sudo apt-get -f install并得到以下结果

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  apache2-bin
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2-bin
0 upgraded, 1 newly installed, 0 to remove and 356 not upgraded.
3 not fully installed or removed.
Need to get 0 B/923 kB of archives.
After this operation, 3,669 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 243215 files and directories currently installed.)
Preparing to unpack .../apache2-bin_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2-bin (2.4.18-2ubuntu3.1) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-bin_2.4.18-2ubuntu3.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_authnz_ldap.so', which is also in package apache2.2-bin 2.2.22-1ubuntu1.11
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.18-2ubuntu3.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

运行sudo dpkg --configure -a结果如下:

dpkg: dependency problems prevent configuration of libapache2-mod-php7.0:
 libapache2-mod-php7.0 depends on apache2-api-20120211; however:
  Package apache2-api-20120211 is not installed.
 libapache2-mod-php7.0 depends on apache2-bin (>= 2.4.16); however:
  Package apache2-bin is not installed.

dpkg: error processing package libapache2-mod-php7.0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libapache2-mod-php:
 libapache2-mod-php depends on libapache2-mod-php7.0; however:
  Package libapache2-mod-php7.0 is not configured yet.

dpkg: error processing package libapache2-mod-php (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of phpmyadmin:
 phpmyadmin depends on libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php; however:
  Package libapache2-mod-php is not configured yet.
  Package libapache2-mod-php7.0 which provides libapache2-mod-php is not configured yet.
  Package libapache2-mod-phpfilter is not installed.
  Package php-cgi is not installed.
  Package php-fpm is not installed.
  Package php is not installed.

dpkg: error processing package phpmyadmin (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libapache2-mod-php7.0
 libapache2-mod-php
 phpmyadmin

sudo apt-get remove --purge phpmyadmin php-mbstring php-gettextPS:我尝试使用以下命令删除软件包 :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libapache2-mod-php7.0 : Depends: apache2-api-20120211 but it is not installable
                         Depends: apache2-bin (>= 2.4.16) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

任何帮助表示感谢

答案1

删除之前对 PHPMyAdmin 安装不必要的尝试。软件包的实际版本将由 PHPMyAdmin 安装程序自动安装。

运行以下命令:

$ sudo apt-get remove --purge phpmyadmin php-mbstring php-gettext
$ sudo apt autoremove
$ sudo apt update
$ sudo apt upgrade

然后安装干净的软件包:

$ sudo apt install apache2 php libapache2-mod-php
$ sudo apt install phpmyadmin

更多详细信息可参见以下答案:
https://askubuntu.com/a/893225/29012

相关内容