本实验要提前搭建好yum环境,由于以前空间介绍过,这里不再介绍
一、安装apache、MySQL、php软件包
[root@localhost ~]# yum install httpd –y
[root@localhost ~]# yum install mysql mysql-server –y
[root@localhost ~]# yum install php php-mbstring php-mysql –y
##启动服务并设为开机启动
[root@localhost ~]# service httpd start
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# service mysqld start
[root@localhost ~]# chkconfig mysqld on
测试:
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim index.php
1 <?php
2 phpinfo();
3 ?>
[root@localhost html]# vim index.php
1 <?php
2 $link=mysql_connect('127.0.0.1','root','');
3 if($link)
4 echo "It is ok !!!!!!!!!";
5 else
6 echo "It is not ok !!!!!!!!";
7 ?>
二、利用phpwind建设网站
解压缩phpwind
[root@localhost ~]# unzip phpwind_GBK_8.3.zip
[root@localhost ~]# cd phpwind_GBK_8.3
[root@localhost phpwind_GBK_8.3]# ll
total 8
drwxr-xr-x 4 root root 4096 Dec 21 2010 docs
drwxr-xr-x 22 root root 4096 Dec 21 2010 upload
[root@localhost phpwind_GBK_8.3]# mv upload/ /var/www/html/phpwind
新建数据库
[root@localhost ~]# mysql
mysql> create database phpwind;
[root@localhost ~]# mysqladmin -u root -p password '123'
修改apache文件
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
747 #AddDefaultCharset UTF-8
##修改默认编码
修改文件权限
[root@localhost ~]# cd /var/www/html/phpwind
[root@localhost phpwind]# chmod -R 777 html
[root@localhost phpwind]# chmod -R 777 data
[root@localhost phpwind]# chmod -R 777 attachment
安装phpwind
##删除安装文件install.php
[root@localhost ~]# cd /var/www/html/phpwind
[root@localhost phpwind]# rm install.php
rm: remove regular file `install.php'? y
三、利用wordpress建设网站
1.解压缩wordpress
[root@localhost ~]# unzip wordpress_v3.0.5-zh_CN.zip
2.将文件copy到/var/www/html/
[root@localhost ~]# cd wordpress-3.0.5-zh_CN/
[root@localhost wordpress-3.0.5-zh_CN]# mv wordpress/ /var/www/html/
3.创建配置文件
[root@localhost wordpress-3.0.5-zh_CN]# cd /var/www/html/wordpress/
[root@localhost wordpress]# cp wp-config-sample.php wp-config.php
[root@localhost wordpress]# chown apache.apache wp-config.php
##更改权限
4.创建数据库
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)
##创建账户密码
[root@localhost ~]# mysqladmin -u root -p password '123'
##修改配置文件
[root@localhost ~]# cd /var/www/html/wordpress/
[root@localhost wordpress]# vim wp-config.php
19 define('DB_NAME', 'wordpress');^M
22 define('DB_USER', 'root');^M
25 define('DB_PASSWORD', '123');^M
5.安装wordpress