·您的位置: 首页 » 资源教程 » 编程开发 » 数据库 » APACHE/PHP/MYSQL FOR RHAS3的安装

APACHE/PHP/MYSQL FOR RHAS3的安装

类别: 数据库教程  评论数:0 总得分:0
今天安装成功了APM,总结一下,给大家一个文档。
一安装前的准备工作
1.创建软件安装目录:
# useradd software
把安装文件拷贝到/home/software目录
删除RH AS 3.0 Update 1 自己带的相关RPM包
rpm -e --nodeps httpd-2.0.46-26.ent
rpm -e --nodeps php-4.3.2-8.ent
二.安装MySQL
# cd /home/software/mysql-4.0.17
# ./configure --prefix=/usr/local/mysql --with-charset=gbk
--without-debug 去除debug模式
--enable-assembler 使用一些字符函数的汇编版本
--without-isam 去掉isam表类型支持 现在很少用了 isam表是一种依赖平台的表
--with-pthread 强制使用pthread库(posix线程库)
--enable-thread-safe-client 以线程方式编译客户端
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static 以纯静态方式编译服务端和客户端
--with-raid 激活raid支持

# make

# make install

# ./scripts/mysql_install_db

# cd /usr/local
# groupadd mysql
# useradd mysql -g mysql -M -s /sbin/nologin
# chmod 750 mysql -R
# chgrp mysql mysql -R
# chown mysql mysql/var -R

# chown -R mysql.mysql /usr/local/mysql/var

# cd /home/software/mysql-4.0.17

# cp ./support-files/my-medium.cnf /etc/my.cnf -fv
# cp support-files/mysql.server /etc/init.d/mysqld copy启动的mysqld文件
# chmod 700 /etc/init.d/mysqld
# cd /usr/local/mysql/libexec
# cp mysqld mysqld.old
# strip mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# service mysqld start
pstree |grep mysqld 查看mysql有没有正常启动
# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
# ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
为了执行命令方便。
增加root用户的密码:

#mysqladmin -u root password \'yourpassword\'
# mysql -uroot -p
# 输入你设置的密码
mysql>use mysql;
mysql>delete from user where password=""; #删除用于本机匿名连接的空密码帐号
mysql>flush privileges;
mysql>quit

设置my.cnf文件:

cd /etc/my.cnf

vi my.cnf

[client]
socket = /var/lib/mysql/mysql.sock

[mysqld]
port=3306
socket = /var/lib/mysql/mysql.sock
set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=1M
set-variable = innodb_buffer_pool_size=256M
set-variable = innodb_additional_mem_pool_size=128M
set-variable = innodb_log_file_size=64M
set-variable = innodb_log_buffer_size=16M
set-variable = max_connect_errors=999999999
innodb_data_file_path=ibdata:100M:autoextend
innodb_flush_log_at_trx_commit=1
default-character-set = gbk

三.安装cURL/Ming

1.Install cURL for PHP

# cd /home/software

# tar zxvf curl-7.11.0.tar.gz

# cd /home/software/curl-7.11.0

./configure

make

make install

2.Install ming for PHP

# cd /home/software

# tar zxvf ming-0.2a.tgz

# cd /home/software/ming-0.2a

# make

# cp ?Cr /home/software/ming-0.2a/php_ext/* /home/software/php-5.0.0b4/ext/ming

# cp -rfvp /home/software/ming-0.2a/libming.so /lib
# cp -rfvp /home/software/ming-0.2a/libming.so /usr/lib
# cp -rfvp /home/software/ming-0.2a/libming.so /usr/local/lib

# cp -rfvp /home/software/ming-0.2a/*.h /usr/include
# cp -rfvp /home/software/ming-0.2a/*.h /usr/local/include

# cd /home/software/php-5.0.0b4

# ./buildconf

# ./configure --with-ming=/home/software/ming-0.2a

四.安装Apache

cd /home/software/httpd-2.0.47

./configure --prefix=/usr/local/apache2 --enable-so
--enable-mods-shared=most &&
make &&
make install

五.安装PHP

cd /home/software/php-5.0.0b4

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --enable-ftp

make
make install
cp /home/software/php-5.0.0b4/php.ini-dist /usr/local/php/lib/php.ini -vf

修改php.ini文件:

#Edit /usr/local/php/lib/php.ini
#Initialize session on request startup.
#session.auto_start = 0 change to 1
#register_globals = Off change to On(No Comment)

六.修改Apache的配置文件

1.去掉ServerName前面的”#”符号:

ServerName Apache2

修改:

DocumentRoot "/data/vhost_apache"

修改:

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/usr/local/apache/htdocs">

<Directory "/data/vhost_apache">

2.去掉Indexes支持:

# This may also be "None", "All", or any combination of "Indexes",

Options FollowSymLinks MultiViews

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None

3.增加默认主页的php支持:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>



4.增加php后缀支持:

#
# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico

AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps

5.增加MaxClients值:

在Apache2.0中新加入了ServerLimit指令,使得无须重编译Apache就可以加大MaxClients。下面是prefork配置段。

<IfModule prefork.c>
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 3000
MaxClients 2048
MaxRequestsPerChild 10000
</IfModule>
6.设置自启动
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
chmod 700 /etc/init.d/httpd
vi /etc/init.d/httpd
在第二行后增加
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description:http server
注意:没有这几行,在使用chkconfig时会提示你:service httpd does not support chkconfig。
Chkconfig - -add httpd
Chkconfig ?Clevel 345 on httpd
这样,在运行级别345上httpd就可以自动启动了。

七、修改php.ini文件

# cd /usr/local/php/lib

需要设置为On

; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off

激活session:

; Initialize session on request startup.
session.auto_start = 1

八。测试
mkdir /data/vhost_apache
cd /data/vhost_apache
vi index.php
加入
<?php
phpinfo()
?>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1