今天安装成功了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.
1<directory "="" apache="" htdocs"="" local="" usr="">
2<directory "="" data="" vhost_apache"="">
3
42.去掉Indexes支持:
5
6# This may also be "None", "All", or any combination of "Indexes",
7
8Options FollowSymLinks MultiViews
9
10#
11# This controls which options the .htaccess files in directories can
12# override. Can also be "All", or any combination of "Options", "FileInfo",
13# "AuthConfig", and "Limit"
14#
15AllowOverride None
16
17
183.增加默认主页的php支持:
19
20#
21# DirectoryIndex: Name of the file or files to use as a pre-written HTML
22# directory index. Separate multiple entries with spaces.
23#
24<ifmodule mod_dir.c="">
25DirectoryIndex index.php index.html
26</ifmodule>
27
284.增加php后缀支持:
29
30#
31# AddType allows you to tweak mime.types without actually editing it, or to
32# make certain files to be certain types.
33#
34AddType application/x-tar .tgz
35AddType image/x-icon .ico
36
37AddType application/x-httpd-php .php .phtml .php3 .inc
38AddType application/x-httpd-php-source .phps
39
40
415.增加MaxClients值:
42
43在Apache2.0中新加入了ServerLimit指令,使得无须重编译Apache就可以加大MaxClients。下面是prefork配置段。
44
45<ifmodule prefork.c="">
46StartServers 10
47MinSpareServers 10
48MaxSpareServers 15
49ServerLimit 3000
50MaxClients 2048
51MaxRequestsPerChild 10000
52</ifmodule>
536.设置自启动
54cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
55chmod 700 /etc/init.d/httpd
56vi /etc/init.d/httpd
57在第二行后增加
58# Comments to support chkconfig on RedHat Linux
59# chkconfig: 2345 90 90
60# description:http server
61注意:没有这几行,在使用chkconfig时会提示你:service httpd does not support chkconfig。
62Chkconfig - -add httpd
63Chkconfig –level 345 on httpd
64这样,在运行级别345上httpd就可以自动启动了。
65
66七、修改php.ini文件
67
68# cd /usr/local/php/lib
69
70需要设置为On
71
72; You should do your best to write your scripts so that they do not require
73; register_globals to be on; Using form variables as globals can easily lead
74; to possible security problems, if the code is not very well thought of.
75register_globals = Off
76
77
78激活session:
79
80; Initialize session on request startup.
81session.auto_start = 1
82
83八。测试
84mkdir /data/vhost_apache
85cd /data/vhost_apache
86vi index.php
87加入
phpinfo()
1保存退出,打开浏览器,输入http://yourip/就可以看到phpinfo的信息了</directory></directory>