周末用了两天时间搭建了一下环境做个简单记录。
1.LAMP环境搭建
1.1安装vmware,ubuntu11.04 //
已经装好了
1.2安装AMP
sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin
1.3测试LAMP是否安装成功
重启apache,命令:sudo /etc/init.d/apache2 restart
或 --> it works!
为phpmyadmin创建软链接
ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
--> phpmyadmin登入界面
2.wordpress构建
2.1 下载源码,解压缩,创建软链接
tar xvf wordpress-3.2.1.tar.gz
cd wordpress/
ln -s $PWD /var/www/wordpress
2.2 为wordpress创建数据库:
gary@ubuntu:~/Desktop/My_Prj/wordpress$ mysql -h localhost -u root -p
Enter password:
Welcome to the
SQL monitor. Commands end with ; or \g.
Your MySQL connection id is 192
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpmyadmin |
+--------------------+
3 rows in set (0.03 sec)
mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.03 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpmyadmin |
| wordpress |
+--------------------+
4 rows in set (0.00 sec)
mysql>quit
2.3 创建wp-config.php文件wordpress已经提供参考配置文件,只要对其中根据实际情况修改一下数据库的相关配置即可
cp wp-config-sample.php wp-config.php
vim wp-config.php 修改该文件
/** WordPress数据库的名称,替换掉 “putyourdbnamehere” */
define('DB_NAME', 'wordpress');
/** MySQL数据库用户名,替换掉 “usernamehere” */
define('DB_USER', 'root');
/** MySQL数据库密码,替换掉 “yourpasswordhere” */
define('DB_PASSWORD', '123');
/** MySQL主机名 */
define('DB_HOST', 'localhost');
2.4测试并按向导安装wordpress //192.168.1.27为虚拟机ip
文章来源:http://blog.chinaunix.net/space.php?uid=26025004&do=blog&id=2183272