---
title: "Linux ubuntu lamp安装配置"
author: "deaboway"
date: "2011-06-25T19:22:00Z"
tags: []
slug: "linux-ubuntu-lamp"
draft: false
lastmod: "2016-11-24T09:55:57Z"
id: 2340677
url: "https://deaboway.iteye.com/blog/2340677"
---

LAMP(Linux+Apache+Mysql+Perl/PHP/Python)是基于Linux，Apache，MySQL和PHP的开放资源网络开发平台，被喻为PHP开发的黄金组合。

1.[Ubuntu](http://www.linuxidc.com/topicnews.aspx?tid=2) 环境中安装LAMP组件  
系统－&gt;系统管理－&gt;新立得软件包管理器， 打开新立得，编辑 –&gt; 使用任务分组标记软件包 –&gt; 勾选 LAMP Server。

(把ubuntu重新安装为最新版本ubuntu10.10后，在新立得软件包管理器里并没有立得软件包管理器－编辑－－使用任务标记分组软件包－－

实际上只需2条命令即可

sudo apt-get install tasksel

任务标记分组

sudo tasksel install lamp-server

)

2.安装phpmyadmin  
系统－&gt;系统管理－&gt;新立得软件包管理器，打开新立得搜索phpmyadmin，标记安装。  
或sudo apt-get install phpmyadmin ,将phpmyadmin与apache2建立硬连接，比如我的www目录在/home/dreamcatcher/www,用命令：sudo ln -s /usr/share/phpmyadmin /home/dreamcatcher/www即可在浏览器地址栏中打开http://localhost/phpmyadmin.

3.启用 mod\_rewrite 模块  
sudo a2enmod rewrite

4.让apache支持.htm .html .php  
sudo gedit /etc/apache2/apache2.conf  
在文件后面加上  
AddType application/x-httpd-php .php .htm .html  
解决firefox显示乱码,还是这个文件，在后面加上  
AddDefaultCharset UTF-8  
这里的 UTF-8 也可根据实际情况用 gb2312代替.

5.重启apache  
sudo /etc/init.d/apache2 restart  
6.mysql的启动：mysql -u root -p,然后根据提示，输入password即可。  
如果出现：  
\* Restarting web server apache2  
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName  
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

继续sudo gedit /etc/apache2/apache2.conf  
在文件后面加上:ServerName 127.0.0.1

说明：记住以下几个命令和位置

sudo /etc/init.d/apache2 restart （重启 apache）

sudo gedit /etc/php5/apache2/php.ini （配置 php.ini）

sudo gedit /etc/apache2/apache2.conf （配置 apache2.conf）

/var/www/cgi-bin/ (CGI 程序)