我最近开始在 ubuntu 上进行 Web 开发。
最初,我在 Ubuntu 12.04.3 LTS 上安装了 Zend 服务器。但后来我决定使用“lamp-server”,因此我通过运行以下命令卸载了 Zend 服务器
/usr/local/zend/bin/uninstall.sh
如图所示 http://files.zend.com/help/Zend-Server-6/content/deb_uninstalling_zend_server.htm
现在我想通过运行以下命令使用 taskel 安装 lamp 服务器
sudo tasksel install lamp-server
但我在安装时遇到了问题。当我在浏览器中访问 localhost 时,出现了错误页面。
任何帮助将不胜感激。
根据评论中的讨论进行编辑
编辑1
运行后sudo apt-get install lamp-server^
我收到此消息:
sudo apt-get install lamp-server^
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'apache2-utils' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libnet-daemon-perl' for task 'lamp-server'
Note, selecting 'libclass-isa-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'libswitch-perl' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'libcap2' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'libdbi-perl' for task 'lamp-server'
Note, selecting 'apache2.2-bin' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'libdbd-mysql-perl' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libplrpc-perl' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'apache2.2-common' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'perl-modules' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
libapr1 is already the newest version.
libaprutil1 is already the newest version.
libaprutil1-dbd-sqlite3 is already the newest version.
libaprutil1-ldap is already the newest version.
libcap2 is already the newest version.
libclass-isa-perl is already the newest version.
libdbd-mysql-perl is already the newest version.
libdbi-perl is already the newest version.
libhtml-template-perl is already the newest version.
libnet-daemon-perl is already the newest version.
libplrpc-perl is already the newest version.
libswitch-perl is already the newest version.
libwrap0 is already the newest version.
tcpd is already the newest version.
apache2-mpm-prefork is already the newest version.
apache2-utils is already the newest version.
apache2.2-bin is already the newest version.
apache2.2-common is already the newest version.
libapache2-mod-php5 is already the newest version.
libmysqlclient18 is already the newest version.
mysql-client-5.5 is already the newest version.
mysql-client-core-5.5 is already the newest version.
mysql-common is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
perl is already the newest version.
perl-modules is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
php5-mysql is already the newest version.
ssl-cert is already the newest version.
The following NEW packages will be installed:
apache2 mysql-server
0 upgraded, 2 newly installed, 0 to remove and 348 not upgraded.
Need to get 0 B/13.0 kB of archives.
After this operation, 146 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously unselected package apache2.
(Reading database ... 182247 files and directories currently installed.)
Unpacking apache2 (from .../apache2_2.2.22-1ubuntu1.5_i386.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.37-0ubuntu0.12.04.1_all.deb) ...
Setting up apache2 (2.2.22-1ubuntu1.5) ...
编辑2 看来 lamp-server 已正确安装,但是当我转到 localhost 时出现此错误“无法连接 Firefox 无法与 localhost 的服务器建立连接。”
我尝试重新启动 apache2,但sudo service apache2 restart
只遇到此错误:
/etc/apache2/apache2.conf 第 239 行语法错误:无法打开配置文件 /etc/phpmyadmin/apache.conf:没有此文件或目录操作“configtest”失败。Apache 错误日志可能有更多信息。...失败!
答案1
您必须按照以下顺序运行安装:
sudo apt-get update
sudo apt-get install tasksel
sudo tasksel install lamp-server
答案2
卸载 apache2 并重新安装。看来您的 apache2 配置文件有问题。运行以下命令:
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove
要确认它已被删除,请运行:which apache2
它应该返回一个空白行,或者运行sudo service apache2 start
它应该返回“apache2:无法识别的服务”
现在重新安装它,再次运行:
sudo apt-get install apache2
Localhost 现在应该可以正常工作。