(2)编译需要的环境:yum -y install libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-devel gettext-devel openssl-devel libtool-ltdl-devel gcc *c++* ncurses-devel
[root@fxq ~]# groupadd mysql
[root@fxq ~]# useradd -g mysql mysql
[root@fxq ~]# tar -xvf mysql-5.1.67.tar.gz
[root@fxq ~]# cd mysql-5.1.67
[root@fxq mysql-5.1.67]# ./configure --prefix=/usr/local/mysql
[root@fxq mysql-5.1.67]# make && make intsall
[root@fxq mysql-5.1.67]# cp support-files/my-medium.cnf /etc/my.cnf
[root@fxq mysql-5.1.67]# cd /usr/local/mysql //初始化mysql数据库
[root@fxq mysql]# chown -R root:mysql .
[root@fxq mysql]# chown -R mysql var
[root@fxq mysql]# bin/mysqld_safe --user=mysql & //用mysql用户安全启动mysql程序,并允许放到后台运行
[root@fxq mysql]# /usr/local/mysql/bin/mysqladmin -u root -p password 123456 //为进入mysql数据库添加一个用户root,密码为123456
[root@fxq mysql]# /usr/local/mysql/bin/mysql -u root -p //登录mysql数据库
Enter password:
进入mysql数据库之后,创建wordpress数据库:
mysql>create database wordpress;
[root@fxq mysql]# echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.local //开机自启
(2)编译安装apache:
[root@fxq ~]# tar -xvf httpd-2.2.19.tar.gz
[root@fxq ~]# cd httpd-2.2.19
[root@fxq httpd-2.2.19]#./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-module=so --enable-rewrite
[root@fxq httpd-2.2.19]# make && make intsall
[root@fxq httpd-2.2.19]# /usr/local/apache/bin/apachectl start
安装完成后,浏览器输入http://192.168.220.11,页面显示“It's works!”,说明安装成功
(3)编译安装php:
[root@fxq ~]# tar -xvf php-5.2.17.tar.gz
[root@fxq ~]# cd php-5.2.17
[root@fxq php-5.2.17]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php
[root@fxq php-5.2.17]# make && make install
[root@fxq php-5.2.17]# cp php.ini-dist /usr/local/php/lib/php.ini
[root@fxq php-5.2.17]# vim /usr/local/php/lib/php.ini //编辑配置文件
修改 register_globals=Off为register_globals=On
[root@fxq php-5.2.17]# vim /usr/local/apache/conf/httpd.conf
1.在53行找到LoadModule php5_module modules/libphp5.so后添加"AddType application/x-httpd-php .php"和"AddType application/x-httpd-php-source .phps"
2.在169行找到"DirectoryIndex index.html" 在index.html 前添加 index.php
修改完成之后,保存退出,重启服务:
[root@fxq php-5.2.17]# /usr/local/apache/bin/apachectl restart
重启可能会出现httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
解决办法:
# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so
# service httpd restart
测试php环境:
[root@fxq php-5.2.17]# vim /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
[root@fxq php-5.2.17]#/usr/local/apache/bin/apachectl restart
在浏览器中输入http://192.168.220.11,出现如下图php页面,说明安装成功。
3.安装wordpress
[root@fxq ~]# unzip wordpress-2.9-zh_CN.zip
[root@fxq ~]# cp wordpress/ /usr/local/apache/htdocs/
[root@fxq ~]# cd /usr/local/apache/htdocs/wordpress
[root@fxq wordpress]# cp wp-config-sample.php wp-config.php
[root@fxq wordpress]# vim wp-config.php
修改配置文件为:
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '123456');
在浏览器中输入http://ip/wordpress//wp-admin/install.php进行安装,
此时会自动生成一个用户名为admin,密码随机,记得保存,
选择登录:
登录进去之后,修改密码即可。
界面如下:
4.安装phpMyAdmin-3.5.1-rc1-all-languages
[root@fxq ~]# tar -xzf phpMyAdmin-3.2.1-all-languages.tar.gz
[root@fxq ~]# cp -R phpMyAdmin-3.5.1-rc1-all-languages /usr/local/apache/htdocs/
[root@fxq ~]# cd /usr/local/apache/htdocs/phpMyAdmin-3.5.1-rc1-all-languages/
[root@fxq phpMyAdmin-3.5.1-rc1-all-languages]# cp config.sample.inc.php config.inc.php
[root@fxq phpMyAdmin-3.5.1-rc1-all-languages]# vim config.inc.php
修改44-45行
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
为:
保存退出,在浏览器输入:http://192.168.220.11/phpMyAdmin-3.5.1-rc1-all-languages进入登录界面,
输
入用户名root,密码123456,即可进入后台
自此,整个平台搭建完成!