本文基于LAMP+WordPress搭建个人博客,系统和软件的配置如下:
Linux:CentOS6.5
Apache:Apache/2.2.15(Unix)
Mysql:mysql-5.1.73-3.el6_5.i686
Php:PHP 5.3.3
WordPress是一款开源的博客系统,支持大量的插件和主题更换,得到了广泛的应用。
1.下载最新版的wordpress
# cd /tmp
2.解压缩包
# tar –xzvflateste.tar.gz –C /var/www/html
3.为wordpress创建数据库
## Connect to MySQL Server & Enter Password (ifany or leave blank)##
# mysql –u root –p
# Enter Password:
## Creating New User for WordPress Database##
CREATE USER wordpress@localhost IDENTIFIED BY "your_password_here";
## Create New Database ##
create database wordpress;
## Grant Privileges to Database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
Exit
4.为wordpress创建虚拟主机
5. 配置wordpress使用vi编辑器打开/etc/httpd/conf/httpd.conf
# vi/etc/httpd/conf/httpd.conf
如下配置:
<VirtualHost *:80>
ServerAdminjefby@jefby.com
DocumentRoot/var/www/html/wordpress
ServerName wordpress
ErrorLog/var/log/httpd/wordpress-error-log
CustomLog/var/log/httpd/wordpress-acces-log common
</VirtualHost>
接着重启Apache服务器,
#service httpdrestart
在/etc/hosts中添加上对wordpress的解析
127.0.0.1wordpress
# cd /var/www/html/wordpress
# cp wp-config-sample.phpwp-config.php
和如下进行对比,修改wp-config.php中的相关内容
// ** MySQL settings - You can get thisinfo from your web host ** //
/** The name of the database for WordPress*/
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creatingdatabase tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't changethis if in doubt. */
define('DB_COLLATE', '');
6. 完成wordpress的安装
在局域网的其他机器上打开安装wordpress机器的ip地址,例如安装wordpress的机器IP为10.0.5.1,测试客户机器为10.0.5.189,打开浏览器,输入http://10.0.5.1,设置标题,创建管理员账号,创建管理员密码和Email,然后点击安装。完成后登录,创建博文即可。
参考文章:点击打开链接