分类: LINUX
2010-01-22 16:33:22
操作系统:Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
软件版本:httpd-
mysql-
php-
1安装mysql
shell#tar xzvf mysql-
#解开安装包
shell#cd mysql-
shell#./configrue --prefix=/usr/local/mysql --with-charset=gbk --with-collation=gbk_chinese_ci --with-extra-charsets=all
shell# make && make install
shell#make install
#进入安装目录,设置安装路径.编译并安装
shell#groupadd mysql
shell#useradd -g mysql mysql
#新建名为mysql的组,并新建名为mysql的用户,并且默认属于mysql组
shell#chgrp -R mysql /usr/local/mysql
#改变/usr/local/mysql及下属文件与目录的属组
shell#cp support-files/my-large.cnf /etc/my.cnf
#copymy-large.cnf到 /etc中,替换原有的my.cnf
shell#scripts/mysql_install_db
#建立初始数据
shell#chown -R mysql:mysql /usr/local/mysql/var
#更改var及下面的文件目录的属组与属主
shell#cp support-files/mysql.server /etc/init.d/mysqld
#copymysql.server到init.d目录中并重命名为mysqld,启动文件
shell#chmod 755 /etc/init.d/mysqld
#设置启动文件的权限有为755
shell#chkconfig --add mysqld
shell#chkconfig mysqld on
#把此服务添加到系统启动中,add为添加至/etc/rc.d/init.d中,on默认在3\5级别服务默认启动
shell#/etc/init.d/mysqld start
shell#/usr/local/mysql/bin/mysqld_safe &
启动myhsql
shell#mysql –u root
sql>grant all on *.* to root@”localhost” identified by “
这样我们就可以用密码登录默认是空密码不安全的我们可以用密码登陆的
mysql> grant select on test.* to 'hhf' @'%' identified by'hhf' with grant option;
#添加一个名称为ttt,密码为ttt的mysql账户,对test数据库有修改权限
2安装apache-
shell#tar xzvf httpd-
shell#cd httpd-
shell#./configure --prefix=/usr/local/apache --enable-so
shell#make && make install
#解包设置安装信息编译安装
shell#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#把服务cp至启动文件中
shell#chmod 755 /etc/init.d/httpd
#设置服务权限
3安装php
shell#tar xvzf php-
shell#cd php-
shell#./configure --with-mysql=/usr/local/mysql --with- apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php
shell#make && make instal
#解包设置安装信息编译安装
shell#echo AddType application/x-httpd-php .php >> /usr/local/apache/conf/httpd.conf
shell#echo AddType application/x-httpd-php .sulpx >> /usr/local/apache/conf/httpd.conf
shell#echo AddType application/x-httpd-php-source .phps >> /usr/local/apache/conf/httpd.conf
shell#echo DirectoryIndex index.php index.html index.htm index.html.var >> /usr/local/apache/conf/httpd.conf
#在http.conf中加入对php的支持
shell#/usr/local/apache/bin/apachectl start
#启动http
测试,在/usr/local/apache/htdocs 下建一文件名为test.php,内容为: phpinfo(); ?>,然后在打开IE输入本机IP地址查看,如显示php页面,则建立成功