您的位置:首页 > 运维架构 > Apache

MYSQL+APACHE+PHP静态安装apache实验

2010-06-06 10:49 627 查看
系统 :LINUX5.4

目的: MYSQL+APACHE+PHP 实验

软件: mysql-5.0.22.tar.gz

httpd-2.2.15.tar.gz

php-5.2.13.tar.gz

一、安装MYSQL

1、 创建mysql用户和组

[root@dns redhat]#chmod 777 mysql-5.0.22.tar.gz

[root@dns redhat]tar –zxvf mysql-5.0.22.tar.gz

[root@dns redhat]#cd mysql-5.0.22

[root@dns redhat]#groupadd mysql

[root@dns redhat]#useradd –g mysql –s /bin/bash mysql

[root@dns redhat]#password mysql

2、开始安装mysql

[root@dnsmysql-5.0.22]#./configure

--prefix=/usr/local/mysql #mysql安装目录

--with-charset=utf8 #使用UTF8字符集

--with-collation=utf8_general_ci #校对规则

--with-extra-charsets=complex #支持所有的扩展字符集

--with-big-tables #启用大表

--with-plugins=partition #大表分割

--enable-assembler #允许汇编模式,(优化性能)

--enable-local-infile #支持从本地导入mysql

[root@dns redhat]#make

[root@dns redhat]#make install

[root@dns mysql-5.0.22]#

cp support-files/my-large.cnf /etc/my.cnf

[root@dns mysql-5.0.22]# cd /usr/local/mysql/

[root@dns mysql]#bin/mysql_install_db --user=mysql

[root@dns mysql]# chown -R root .

[root@dns mysql]# chown -R mysql var

[root@dns mysql]# chgrp -R mysql .

[root@dns mysql]# bin/mysqld_safe --user=mysql &

[1] 19374

[root@dns mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var

3、 开机启动mysql

[root@dns mysql]#cp share/mysql/mysql.server /etc/init.d/mysqld

[root@dns mysql]#chkconfig --add mysqld

[root@dns mysql]#chmod +x /etc/init.d/mysqld

[root@dns mysql]#chkconfig --level 35 mysql on

[root@dns mysql]#service mysqld start

[root@dns mysql]#cp /usr/local/mysql/bin/* /sbin

[root@dns init.d]# mysqladmin -u root -h localhost password 'aa123456'

[root@dns init.d]# mysql -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@dns init.d]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

mysql> grant all privileges on *.* to root@'%' identified by 'aa123456' with grant option;

Query OK, 0 rows affected (0.00 sec)

从你的NVCAT链接试试吧

到这里基本上已经安装成功了

二、 安装APACHE

[root@dns redhat]#chmod 777 httpd-2.2.15.tar.gz
[root@dns redhat]# cd httpd-2.2.15
[root@dns httpd-2.2.15]#./configure

--prefix=/usr/local/apache2 #指定安装目录

--enable-module=so #启动模块

--enable-module=rewrite #启用重写功能

--enable-shared=max #把除了so以外的所有apache的标准模块都编译成DSO模块

[root@dns httpd-2.2.15]#make
[root@dns httpd-2.2.15]#make install

开机自启动

[root@dns rc.d]# echo "/usr/local/apache2/bin/apachectl start" >> rc.local

三、 安装PHP
1、
[root@dns redhat]# tar -xvzf php-5.2.13.tar.gz
[root@dns redhat]# cd php-5.2.13
[root@dnsphp-5.2.13]#./configure

--prefix=/usr/local/php5 #指定安装目录

--with-mysql=/usr/local/mysql

--with-apxs2=/usr/local/apache2/bin/apxs
[root@dns php-5.2.13]#make
[root@dns php-5.2.13]#make test
[root@dnsphp-5.2.13]#make install
[root@dnsphp-5.2.13]#cp php.ini-dist /usr/local/php5/lib/php.ini
[root@dnsphp-5.2.13]#vi /usr/local/apache2/conf/httpd.conf

在284行 defaultType text/plain后面添加

AddType application/x-httpd-php .php .phtml
286 AddType application/x-httpd-php-source .phps

找 到Directory index 后面添加 index.php

2、重启apache
[root@ olym php-5.2.3]cd /usr/local/apache2/htdocs/
[root@dns htdocs]#
touch index.php
<? phpinfo(); ?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: