老生常谈,发现每次都要去GOOGLE,太烦了,还是记录下来。
[root@localhost /]# cd /home/src/
/*默认把安装包都放在/home/src/目录下*/
[root@localhost src]# tar xvzf httpd-2.2.2.tar.gz
[root@localhost src]# cd httpd-2.2.2
[root@localhost httpd-2.2.2]# ./configure --prefix=/usr/local/apache --enable-so
[root@localhost httpd-2.2.2]# make
[root@localhost httpd-2.2.2]# make install
[root@localhost /]# /usr/local/apache/bin/apachectl start
/*启动Apache*/
/*系统启动时加载apache*/
[root@localhost /]# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
[root@localhost /]# cd /etc/rc.d/rc3.d
[root@localhost rc3.d]# ln -s ../init.d/httpd S80httpd
安装MySQL
[root@localhost /]# cd /home/src/
[root@localhost src]# tar xvzf mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
[root@localhost src]# cd mysql-standard-5.0.27-linux-i686-glibc23
[root@localhost mysql-standard-5.0.27-linux-i686-glibc23]# groupadd mysql
[root@localhost mysql-standard-5.0.27-linux-i686-glibc23]# useradd -g mysql mysql
[root@localhost mysql-standard-5.0.27-linux-i686-glibc23]# more INSTALL-BINARY
/*认真的阅读一下这个文档,就会发现MySQL很容易安装*/
[root@localhost src]#mv mysql-standard-5.0.27-linux-i686-glibc23 /usr/local/mysql
[root@localhost src]# cd /usr/local/mysql/
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql data
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# bin/mysqld_safe --user=mysql &
/*启动MySQL*/
[root@localhost mysql]# ./bin/mysqladmin -u root password ‘password’
[root@localhost mysql]# ./bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 80 to server version: 5.0.27-standard-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@localhost mysql]# vi /etc/init.d/mysql
修改如下定义使其内容为:
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
[root@localhost mysql]# chkconfig --level 345 mysql on
[root@localhost mysql]# service mysql restart
Shutting down MySQL. [ 确定 ]
Starting MySQL [ 确定 ]
[root@localhost mysql]#
到这里MySQL就装好了。
安装Php
[root@localhost /]# cd home/src/php-5.2.0
[root@localhost php-5.2.0]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs
[root@localhost php-5.2.0]# make
[root@localhost php-5.2.0]# make install
[root@localhost php-5.2.0]# cp php.ini-dist /usr/local/php/lib/php.ini
编辑Apache配置文件
即/usr/local/apache/conf/httpd.conf,并添加以下一行:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
并在 DirectoryIndex 一行加上 index.php
/*添加php5模块*/
LoadModule php5_module modules/libphp5.so
保存并退出
测试
建立test.php文件放在apache目录下的htdocs下,内容如下:
phpinfo();
?>
通过浏览器查看http://localhost/test.php
安装phpMyAdmin(可选)
用FTP工具上传phpMyAdmin-2.7.0-pl2到/home/src
[root@localhost src]# mv phpMyAdmin-2.7.0-pl2 /usr/local/apache/htdocs/phpmyadmin
[root@localhost src]# cd /usr/local/apache/htdocs/phpmyadmin
[root@localhost phpmyadmin]# vi config.default.php
$cfg['Servers'][$i]['auth_type'] = 'config'; 将config 改为 http
/*通过浏览器查看http://localhost/ phpmyadmin就可以管理你的MySQL数据库了*/
没有评论:
发表评论