centos 5.5 +apache2.2.4+mysql5.1...
时间:2010-10-09 来源:徐俊沿
centos 5.5 +apache2.2.4+mysql5.1.47+php5.3.2-latest
请从各自的官方下载 PHP官方有发布新的5.3.2在centos5.5的gcc环境下编译会错误,所以选择比较稳定的5.3.2-latest版本
1.yum update 检查系统更新
2.yum install gcc gcc-c++ 软件编译环境
3.yum erase httpd 卸载系统自带的httpd (apache2.2.3)
4.yum install zlib-devel libtool ncurses-devel libxml2-devel
(zlib-devel 安装apache需要,否则出错 .libtool安装mysql时候需要.同时附带了autoconf automake imake 编译mysql 5.1.47时候会出错 需要autoconf重新配置一下)
5.编译apache2.2.4
tar zxvf httpd-2.2.4.tar.gz
cd http-2.2.4
./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache2/conf --with-mpm=worker --enable-speling
make
make install
make clean
6.编译httpd.conf . 去掉#ServerName xxxxxx.com 前面的# 没有ServerName启动httpd服务会出错. 给LoadModule unique_id_module modules/mod_unique_id.so前面加上注释以取消加载.默认的centos5.5加载这个会启动不了httpd .
7.运行 grep -v “#” /usr/local/apache2/bin/apachectl > /etc/init.d/httpd
8.运行 chmod +x /etc/init.d/httpd (赋予httpd可以运行的权限)
9.编译/etc/init.d/httpd 在起始位置添加
#!/bin/sh
# chkconfig: 8854 61 61
# description: Apache is a World Wide Web server.
10.运行 chkconfig –add httpd
chkconfig –level 345 httpd on
11.编译mysql 5.1.47
建议rpm -qa | grep mysql检查一下系统中是否有不同版本的MySQL存在.
如果有旧版本的话就rpm -e mysql-......进行删除.
注意,可能会有2个包的相互依存性导致无法删除,可以用--nodeps参数强制删除. eg :rpm -e mysql --nodeps
groupadd mysql
useradd -g mysql mysql
在源码文件夹目录运行
tar zxvf mysql-5.1.47.tar.gz
cd mysql-5.1.47
autoreconf –force –install
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-readline --with-big-tables --with-plugins=all --with-tcp-port=3310 --with-unix-socket-path=/var/tmp/mysql.sock --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
make
make install
make clean
以下命令在mysql安装目录下运行
cd /usr/local/mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chown -R mysql .
chgrp -R mysql .
//scripts/mysql_install_db –user=mysql此处命令错误,用下面的命令执行过去
初始化数据库
/usr/local/mysql/bin/mysql_install_db --user=mysql
#更改数据库存储文件夹的所有者及所有组
cd /usr/local/mysql
chown -R mysql:mysql var/
#更改数据库root用户密码
/usr/local/mysql/bin/mysql -uroot
>grant all on *.* to