今天安装成功了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 –r /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 –level 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()
?>
保存退出,打开浏览器,输入http://yourip/就可以看到phpinfo的信息了
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器