我想为我的 ubuntu 发行版配置 lamp stack,但我遇到了一些麻烦。后
sudo apt-get install lamp-server^
我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libhttp-message-perl' for task 'lamp-server'
Note, selecting 'libencode-locale-perl' for task 'lamp-server'
Note, selecting 'php7.0-cli' for task 'lamp-server'
Note, selecting 'mysql-client-5.7' for task 'lamp-server'
Note, selecting 'libapache2-mod-php' for task 'lamp-server'
Note, selecting 'rename' for task 'lamp-server'
Note, selecting 'mysql-server-5.7' for task 'lamp-server'
Note, selecting 'php-common' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'php7.0-opcache' for task 'lamp-server'
Note, selecting 'libcgi-fast-perl' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libhttp-date-perl' for task 'lamp-server'
Note, selecting 'perl-modules-5.22' for task 'lamp-server'
Note, selecting 'liblwp-mediatypes-perl' for task 'lamp-server'
Note, selecting 'libfcgi-perl' for task 'lamp-server'
Note, selecting 'libcgi-pm-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'php7.0-common' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'libio-html-perl' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'libperl5.22' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'libhtml-tagset-perl' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.7' for task 'lamp-server'
Note, selecting 'php7.0-json' for task 'lamp-server'
Note, selecting 'php7.0-readline' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
Note, selecting 'liblua5.1-0' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'libtimedate-perl' for task 'lamp-server'
Note, selecting 'apache2-bin' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'php-mysql' for task 'lamp-server'
Note, selecting 'apache2-utils' for task 'lamp-server'
Note, selecting 'libhtml-parser-perl' for task 'lamp-server'
Note, selecting 'libapache2-mod-php7.0' for task 'lamp-server'
Note, selecting 'liburi-perl' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.7' for task 'lamp-server'
Note, selecting 'php7.0-mysql' for task 'lamp-server'
libaio1 is already the newest version (0.3.110-2).
libapache2-mod-php is already the newest version (1:7.0+35ubuntu6).
libapr1 is already the newest version (1.5.2-3).
libaprutil1 is already the newest version (1.5.4-1build1).
libaprutil1-dbd-sqlite3 is already the newest version (1.5.4-1build1).
libaprutil1-ldap is already the newest version (1.5.4-1build1).
libcgi-fast-perl is already the newest version (1:2.10-1).
libcgi-pm-perl is already the newest version (4.26-1).
libencode-locale-perl is already the newest version (1.05-1).
libfcgi-perl is already the newest version (0.77-1build1).
libhtml-parser-perl is already the newest version (3.72-1).
libhtml-tagset-perl is already the newest version (3.20-2).
libhtml-template-perl is already the newest version (2.95-2).
libhttp-date-perl is already the newest version (6.02-1).
libhttp-message-perl is already the newest version (6.11-1).
libio-html-perl is already the newest version (1.001-1).
liblua5.1-0 is already the newest version (5.1.5-8ubuntu1).
liblwp-mediatypes-perl is already the newest version (6.02-1).
libtimedate-perl is already the newest version (2.3000-2).
liburi-perl is already the newest version (1.71-1).
libwrap0 is already the newest version (7.6.q-25).
php-common is already the newest version (1:35ubuntu6).
php-mysql is already the newest version (1:7.0+35ubuntu6).
rename is already the newest version (0.20-4).
ssl-cert is already the newest version (1.0.37).
tcpd is already the newest version (7.6.q-25).
apache2 is already the newest version (2.4.18-2ubuntu3.5).
apache2-bin is already the newest version (2.4.18-2ubuntu3.5).
apache2-data is already the newest version (2.4.18-2ubuntu3.5).
apache2-utils is already the newest version (2.4.18-2ubuntu3.5).
libapache2-mod-php7.0 is already the newest version (7.0.22-0ubuntu0.16.04.1).
libperl5.22 is already the newest version (5.22.1-9ubuntu0.2).
mysql-client-5.7 is already the newest version (5.7.20-0ubuntu0.16.04.1).
mysql-client-core-5.7 is already the newest version (5.7.20-0ubuntu0.16.04.1).
mysql-common is already the newest version (5.7.20-0ubuntu0.16.04.1).
mysql-server is already the newest version (5.7.20-0ubuntu0.16.04.1).
mysql-server-5.7 is already the newest version (5.7.20-0ubuntu0.16.04.1).
mysql-server-core-5.7 is already the newest version (5.7.20-0ubuntu0.16.04.1).
perl is already the newest version (5.22.1-9ubuntu0.2).
perl-modules-5.22 is already the newest version (5.22.1-9ubuntu0.2).
php7.0-cli is already the newest version (7.0.22-0ubuntu0.16.04.1).
php7.0-common is already the newest version (7.0.22-0ubuntu0.16.04.1).
php7.0-json is already the newest version (7.0.22-0ubuntu0.16.04.1).
php7.0-mysql is already the newest version (7.0.22-0ubuntu0.16.04.1).
php7.0-opcache is already the newest version (7.0.22-0ubuntu0.16.04.1).
php7.0-readline is already the newest version (7.0.22-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since sob 2018-01-20 10:55:17 CET; 17ms ago
Process: 4551 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 4550 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 4542 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 4550 (code=exited, status=1/FAILURE)
sty 20 10:55:17 len-machine systemd[1]: Failed to start MySQL Community Server.
sty 20 10:55:17 len-machine systemd[1]: mysql.service: Unit entered failed s....
sty 20 10:55:17 len-machine systemd[1]: mysql.service: Failed with result 'e....
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up oracle-java8-installer (8u151-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2018-01-20 10:55:18-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.104.142.192
Connecting to download.oracle.com (download.oracle.com)|104.104.142.192|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz [following]
--2018-01-20 10:55:18-- https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 2a02:26f0:d8:39a::2d3e, 2a02:26f0:d8:389::2d3e, 104.81.108.164
Connecting to edelivery.oracle.com (edelivery.oracle.com)|2a02:26f0:d8:39a::2d3e|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516442239_54c9d78d4d9e3a8f11df3af6b410580b [following]
--2018-01-20 10:55:19-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516442239_54c9d78d4d9e3a8f11df3af6b410580b
Connecting to download.oracle.com (download.oracle.com)|104.104.142.192|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-20 10:55:20 ERROR 404: Not Found.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
oracle-java8-installer
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
我不知道发生了什么事。你有什么解决这个问题的建议吗?
答案1
我同意@SzymonRadosz 的观点。我认为您应该更新系统并重试。但如果仍然不起作用,您也可以尝试单独下载组件。
LAMP Server is a collection of open source software used to create a web server. The collection consists of:
Linux – the operating system
Apache server – the server
MySQL – the database system
PHP – the programming language
安装 Apache 服务器
Apache Server 可以一行安装:
sudo apt-get install apache2
您可以访问测试安装http://本地主机/在浏览器中,您应该会看到一条消息“It Works!”。
安装MySQL服务器
安装 MySQL 就像终端中的另一行一样简单:
apt-get install mysql-server mysql-client
这将安装:
MySQL Server – to store/serve your database
MySQL Client – a client to access your MySQL server
安装过程中一定要注意。系统将要求您为 MySQL root 用户创建密码。然后,您可以通过键入/复制来访问终端中的服务器:
mysql -uroot -ppassword
显然,将“password”替换为您刚刚创建的密码(在用户名和密码之前保留“-u”和“-p”)。您现在应该登录并在命令行上显示“mysql>”,准备好进行 SQL 查询!
安装PHP
PHP 需要安装 3 个包,同样只有一行:
sudo apt-get install php5 libapache2-mod-php5 php5-mysql
您现在必须重新启动 Apache 服务器才能使更改生效:
sudo service apache2 restart
要测试这一点,请打开 gedit 并输入/复制:
<?php
phpinfo();
?>
将文件另存为 info.php。现在,通过访问在网络浏览器中导航到该文件http://localhost/info.php,您应该会看到一个显示您的 PHP 版本和其余 PHP 安装信息的页面。
您可以通过下面提供的链接阅读有关 LAMP 的更多信息:
http://www.sudo-juice.com/install-lamp-server-ubuntu/
https://askubuntu.com/questions/785440/how-to-install-lamp-server-on-ubuntu
答案2
您应该首先解决这个错误:
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
通过重新安装oracle-java8-installer
包:
sudo dpkg --configure -a
sudo apt-get purge --remove oracle-java8-installer
从安装包网络UPD8团队存储库:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
然后重新安装 LAMP 服务器。