zoukankan      html  css  js  c++  java
  • Ubuntu下搭建本地WordPress站点

    想在本地搭建WordPress博客站点作测试用?本教程一步一步教您在Linux上搭建一个LAMP(Linux, Apache, MySQL, PHP)服务器并部署WordPress博客。

    请注意在复制粘贴命令时注意按自己的环境进行修改。

    本文因包含大量图片,请不要在数据网络下阅读本文。转载本文章时请注明原作者@101对双生儿

    第一步:安装Apache

    打开“终端”(Ctrl+Alt+T),输入 sudo apt-get install apache2

    [网站]Ubuntu下搭建本地WordPress站点

    安装完成后输入 sudo /etc/init.d/apache2 restart 重启Apache
    [网站]Ubuntu下搭建本地WordPress站点

    打开浏览器,访问http://localhost,若看到"It works!"如下图所示则安装成功
    [网站]Ubuntu下搭建本地WordPress站点
    此时本地站点目录默认为/var/www

    第二步,安装PHP

    终端中输入 sudo apt-get install libapache2-mod-php5 php5
    [网站]Ubuntu下搭建本地WordPress站点

    接着可以安装一些PHP扩展模块

    终端中输入 sudo apt-get install php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc
    [网站]Ubuntu下搭建本地WordPress站点

    安装完成后输入 sudo /etc/init.d/apache2 restart 重启Apache让其加载PHP扩展模块
    [网站]Ubuntu下搭建本地WordPress站点

    接下来创建一个测试页面来显示PHP是否能正常运行

    终端中输入 sudo gedit /var/www/test.php 打开Gedit编辑器
    [网站]Ubuntu下搭建本地WordPress站点

    输入以下代码:

    [网站]Ubuntu下搭建本地WordPress站点

    然后打开浏览器,访问http://localhost/test.php。若出现以下说明PHP能够正常运行,且页面中显示了当前已安装的扩展模块。
    [网站]Ubuntu下搭建本地WordPress站点

    第三步,安装MySQL

    终端中输入 sudo apt-get install mysql-server mysql-client
    [网站]Ubuntu下搭建本地WordPress站点

    安装的最后会要求里输入管理员帐号root的密码。注意这里的root密码不是Linux的root密码,而是给MySQL设定的root密码。
    [网站]Ubuntu下搭建本地WordPress站点

    [网站]Ubuntu下搭建本地WordPress站点

    第四步,安装phpMyAdmin

    终端中输入 sudo apt-get install phpmyadmin[网站]Ubuntu下搭建本地WordPress站点

    安装过程中会要求选择Web server,使用空格键选定apache2,按Tab键然后确定
    [网站]Ubuntu下搭建本地WordPress站点

    选择“是”为phpMyAdmin设置数据库
    [网站]Ubuntu下搭建本地WordPress站点

    输入之前设置的MySQL数据库连接密码以及phpMyAdmin密码
    [网站]Ubuntu下搭建本地WordPress站点

    然后将phpMyAdmin与Apache建立连接,终端中输入 sudo ln -s /usr/share/phpmyadmin /var/www
    [网站]Ubuntu下搭建本地WordPress站点

    接着打开浏览器,访问http://localhost/phpmyadmin,使用之前设置的root帐户和密码登录
    [网站]Ubuntu下搭建本地WordPress站点

    若出现以下控制页面说明phpMyAdmin安装成功
    [网站]Ubuntu下搭建本地WordPress站点
    至此LAMP服务器搭建完成

    第五步,安装WordPress

    访问http://cn.wordpress.org下载WordPress压缩包

    本例中,终端中输入 wget http://cn.wordpress.org/wordpress-3.8-zh_CN.tar.gz 下载最新版3.8至当前目录/home/cssaug
    [网站]Ubuntu下搭建本地WordPress站点

    解压缩文件

    本例中,终端中输入

    cd /var/www

    sudo tar zxvf /home/cssaug/wordpress-3.8-zh_CN.tar.gz

    mv wordpress cssaug

    将WordPress压缩包解压缩到/var/www,再将站点根目录名由wordpress重命名为cssaug
    [网站]Ubuntu下搭建本地WordPress站点

    [网站]Ubuntu下搭建本地WordPress站点

    然后打开浏览器,访问http://localhost/cssaug/wp-admin/install.php安装WordPress站点      
    [网站]Ubuntu下搭建本地WordPress站点

    [网站]Ubuntu下搭建本地WordPress站点

    接着需要为WordPress站点配置一个数据库。

    本例中,登录phpMyAdmin,为WordPress站点新建一个名为cssaug的数据库
    [网站]Ubuntu下搭建本地WordPress站点

    填写数据库连接信息
    [网站]Ubuntu下搭建本地WordPress站点

    设置WordPress站点信息
    [网站]Ubuntu下搭建本地WordPress站点

    最后为本地站点设置权限以便将来进行更新

    本例中,终端中输入

    sudo chmod -R 777 /var/www/cssaug

    sudo chown -R www-data /var/www/cssaug
    [网站]Ubuntu下搭建本地WordPress站点
    至此,WordPress本地站点安装完成。

    参考:

    1. http://www.cnblogs.com/lynch_world/archive/2012/01/06/2314717.html
    2. http://www.wincold.com/archives/145.html
    3. http://imcn.me/html/y2012/12401.html
    4. http://developer.51cto.com/art/201110/299303.htm
    5. http://farlee.info/archives/linux-ubuntu-lamp-apache-mysql-php-phpmyadmin-install-configuration.html

    原文:http://blog.sina.com.cn/s/blog_6e3638010101gss5.html

  • 相关阅读:
    设计模式12-享元模式
    设计模式11-外观模式
    设计模式10-装饰模式
    设计模式09-组合模式
    设计模式08-桥接模式
    设计模式07-适配器模式
    设计模式06-原型模式
    获取cookie信息
    JMeter 配置元件之-HTTP Cookie管理器-实现 Cookie 登录
    jmeter基础概念
  • 原文地址:https://www.cnblogs.com/gcy77/p/4008013.html
Copyright © 2011-2022 走看看