LAMP就是Linux+Apache+MySql+PHP
安装Apache
[root@linux-a ~]# rpm -ivh /media/Server/httpd-2.2.3-6.el5.i386.rpm
warning: /media/Server/httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libapr-1.so.0 is needed by httpd-2.2.3-6.el5.i386
libaprutil-1.so.0 is needed by httpd-2.2.3-6.el5.i386
[root@linux-a ~]#
提示需要libapr-1.so.0和libaprutil-1.so.0的支持 安装libapr-1.so.0
[root@linux-a ~]# rpm -ivh /media/Server/apr-1.2.7-11.i386.rpmapr-util-1.2.7-6.i386.rpm 需要postgresql-libs的支持 安装libpq.so.4
warning: /media/Server/apr-1.2.7-11.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:apr ########################################### [100%]
[root@linux-a ~]# rpm -ivh /media/Server/postgresql-libs-8.1.4-1.1.i386.rpm安装libaprutil-1.so.0
warning: /media/Server/postgresql-libs-8.1.4-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:postgresql-libs ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/apr-util-1.2.7-6.i386.rpm安装Apache
warning: /media/Server/apr-util-1.2.7-6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:apr-util ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/httpd-2.2.3-6.el5.i386.rpm安装MySql mysql需要perl(DBI)和perl-DBD-MySQL的支持,因此先安装perl-DBI及perl-DBD-MySQL perl-DBI安装
warning: /media/Server/httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:httpd ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/perl-DBI-1.52-1.fc6.i386.rpmperl-DBD-MySQL安装
warning: /media/Server/perl-DBI-1.52-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:perl-DBI ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/perl-DBD-MySQL-3.0007-1.fc6.i386.rpm开始安装mysql
warning: /media/Server/perl-DBD-MySQL-3.0007-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:perl-DBD-MySQL ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/mysql-5.0.22-2.1.i386.rpm安装mysql server
warning: /media/Server/mysql-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mysql ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/mysql-server-5.0.22-2.1.i386.rpm初始化MySql数据库
warning: /media/Server/mysql-server-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mysql-server ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# mysql_install_db修改mysql配置文件
Installing all prepared tables
Fill help tables To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h linux-a.test.com password 'new-password'
See the manual for more instructions. You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests Please report any problems with the /usr/bin/mysqlbug script! The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@linux-a ~]#
[root@linux-a ~]# cp /usr/share/doc/mysql-server-5.0.22/my-medium.cnf /etc/my.cnf安装php PHP需要libgmp.so.3、php-cli、php-common的支持
[root@linux-a ~]# rpm -ivh /media/Server/php-5.1.6-5.el5.i386.rpmlibgmp.so.3安装
warning: /media/Server/php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libgmp.so.3 is needed by php-5.1.6-5.el5.i386
php-cli = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386
php-common = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386
[root@linux-a ~]# rpm -ivh /media/Server/gmp-4.1.4-10.el5.i386.rpm安装php-common
warning: /media/Server/gmp-4.1.4-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:gmp ########################################### [100%]
[root@linux-a ~]# rpm -ivh /media/Server/php-common-5.1.6-5.el5.i386.rpm安装php-cli
warning: /media/Server/php-common-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-common ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/php-cli-5.1.6-5.el5.i386.rpm安装PHP
warning: /media/Server/php-cli-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-cli ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/php-5.1.6-5.el5.i386.rpm另外还需要安装PHP-MySql,PHP-MySql需要php-pdo的支持 安装php-pdo
warning: /media/Server/php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/php-pdo-5.1.6-5.el5.i386.rpm安装PHP-MySql
warning: /media/Server/php-pdo-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-pdo ########################################### [100%]
[root@linux-a ~]#
[root@linux-a ~]# rpm -ivh /media/Server/php-mysql-5.1.6-5.el5.i386.rpm测试配置: 安装好之后Apache的配置文件在/etc/httpd/conf/httpd.conf 编译安装php之后都需要手动修改Apache的配置文件,这里不需要修改,安装PHP时会生成一个/etc/httpd/conf.d/php.conf 文件,Apache配置文件可以直接饮用这个配置
warning: /media/Server/php-mysql-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-mysql ########################################### [100%]
[root@linux-a ~]#
#如果是编译安装的话只需要将上面红色的文字加到/etc/httpd/conf.d/php.conf 配置文档中就可以了。 php的配置文件在/etc/php.ini ,也不需要修改,除非你需要配置一些高级功能。 MySql的配置文件在/etc/my.cnf。 启动Apache和MySql服务 在网页目录下建立一个php测试文件,如果能出现正确的php环境信息说明安装已经成功。
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
# LoadModule php5_module modules/libphp5.so #
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php #
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php #
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
[root@linux-a ~]# vim /var/www/html/index.php <?上传一个WordPress程序到/var/www/html/目录下,将其目录的权限修改为777,进行WordPress安装测试,这样一个LAMP环境就搭建起来了。
phpinfo();
?>