装是装了很多次了,但还是觉得要笔记之比较好.环境是red hat linux 4+mysql5+apache 2+php5
1 安装apache
tar zvxf httpd-2.0.46.tar.gz
cd httpd-2.0.46
./configure --prefix=/usr/local/apache2 --enable-so \
--enable-mods-shared=most &&
make &&
make install
设定开机自动启动apache
在/etc/rc.d/rc.local中加入 /usr/local/apache/apachectl start
2 安装 mysql5
首先当然是解压缩了 tar xzvf xxx.gz
./configure --prefix=/usr/local/mysql
make && make install
改相关权限,
cp support-files/my-medium.cnf /etc/my.cnf
建立MySQL使用者和群组:
CODE:
#groupadd mysql
#useradd -g mysql mysql
完成以上操作以后进行初始化数据库,进入已经安装好的mysql目录
CODE:
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql |注:--user=mysql 初始化表并且规定用mysql用户
设置给mysql和root用户设定访问权限 我们先进入mysql目录
CODE:
#cd /usr/local/mysql
#chown -R root /usr/local/mysql |注:设定root能访问/usr/local/mysq
#chown -R mysql /usr/local/mysql/var |注:设定mysql用户能访问/usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql |注:设定mysql组能够访问/usr/local/mysq
启动mysql,进入已经安装好的目录
CODE:
#cd /usr/local/mysql
#bin/mysqld_safe --user=mysql &
修改mysql数据库超级用户root的缺省密码:
/usr/local/mysql/bin/mysqladmin -u root password '新密码'
关闭mysql服务器
cd /usr/local/mysql/bin
./mysqladmin -u root -p shutdown
设定开机就启动mysql,进入源码目录下
# cd /home/seal/mysql
# cp support-files/mysql.server /etc/init.d/mysql
# chmod +x /etc/init.d/mysql
# chkconfig --level 345 mysql on
# service mysql restart
Shutting down MySQL. [ 确定 ]
Starting MySQL [ 确定 ]
3 安装php
tar zvxf php5.tar.gz
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache/bin/apxs &&
make &&
make install
cp php.ini-dist /usr/local/php5/etc/php.ini
vi /usr/local/php5/etc/php.ini
将extension=php_mysql.dll前面的#去掉
当然可以也将其他的一些东西也去掉
4 修改httpd.conf
增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
另外要显示中文的话,
修改:
AddDefaultCharset gb2312
设置虚拟目录
Alias /myphp "/home/myphp/"
<Directory "home/myphp/">
AllowOverride None
Order deny,allow
</Directory>