日期:2014-05-16  浏览次数:20558 次

Linux下LAMP(Apache+PHP+MySql)环境配置(第二版)

LAMP是一个缩写Linux+Apache+MySql+PHP,它指一组通常一起使用来运行动态网站或者服务器的自由软件:

* Linux,操作系统;
* Apache,网页服务器;
* MySQL,数据库管理系统(或者数据库服务器);
* PHP 和有時 Perl 或 Python,脚本语言。

今天介绍一下Linux下LAMP(Apache+PHP+MySql)环境配置:

1、下载软件

MySql:wget?http://down1.chinaunix.net/distfiles/mysql-5.0.56.tar.gz

Apache:wget?http://apache.freelamp.com/httpd/httpd-2.2.13.tar.gz

PHP:wgethttp://125.39.113.23:9203/CDE349DEF7D7A6AC19DE5771F752CA258C693F634815D4BE/cn.php.net/distributions/php-5.2.10.tar.bz2

2、安装MySql

安装步骤:

shell> groupadd mysql

shell> useradd -g mysql mysql

shell> gunzip < mysql-VERSION.tar.gz | tar -xvf – 或 tar -zxvf? mysql-5.0.56.tar.gz(解压mysql源码包)

shell> cd mysql-VERSION(进入mysql源码文件夹)

shell> ./configure –prefix=/usr/local/mysql

shell> make

shell> make install

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> cd /usr/local/mysql

shell> bin/mysql_install_db –user=mysql

shell> chown -R root? .

shell> chown -R mysql var

shell> chgrp -R mysql .

shell> bin/mysqld_safe –user=mysql &

修改mysql root 密码
$ mysqladmin -u root password newpass
添加服务项
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig –add mysqld

3、安装Apache