首页 >数据库 >mysql教程 >如何安装 WordPress 3.9 和 Apache2 MySQL 5.5 PHP_MySQL

如何安装 WordPress 3.9 和 Apache2 MySQL 5.5 PHP_MySQL

WBOY
WBOY原创
2016-06-01 13:07:59993浏览

WordPressApache

WordPress 是用 PHP 和 MySQlas 默认数据库编写的免费开源博客工具。它可能是当今最简单、最强大的博客和网站内容管理系统(orCMS)。此外, WordPress 是一种在网络上获取信息的方式。它最初是为博客作者设置的,现在用于构建大大小小的网站。它现在是世界上最大的自托管网站建设工具。

本教程将描述如何在 Ubuntu Server 14.04 LTS 中安装带有 Apache2、Mysql5.5 和 PHP 5.5 的全新 WordPress 3.9 的基本步骤。

第 1 步:设置 LAMP 堆栈

在安装 WordPress 之前,您需要在 Ubuntu Server14.04 上安装 LAMP(Linux、Apache2、MySQL5 和 PHP5)堆栈。如果您尚未安装和配置这些组件,您可以使用本教程来了解如何在 Ubuntu Server 14.04 上安装 LAMP Stack。

第 2 步:为 WordPress 创建数据库和用户

通过键入以下命令以 root 用户身份登录到 mysqlserver

mysql -u root -p

成功登录到 Mysql Server 后,使用这些命令为 WordPress 创建数据库。在本例中,我会将 WordPress 数据库的名称指定为 dbwordpress, 您可以随意命名它。

CREATE DATABASE dbwordpress;

接下来,我们将创建一个单独的 MySQL 用户帐户并为该用户提供密码。在这种情况下,我将调用新帐户 “wpuser” 和新帐户的密码“ wpP@5sw0Rd ”,您一定要更改安装的密码,并且可以将用户命名为任何名称你愿意。 您可以通过键入以下命令来完成此操作:

CREATE USER wpuser@localhost IDENTIFIED BY 'wpP@5sw0Rd';

接下来,通过运行以下命令将刚刚创建的数据库的所有权限授予新用户

GRANT ALL PRIVILEGES ON dbwordpress.* TO wpuser@localhost;

我们需要刷新权限,以便 MySQL 的当前实例知道我们最近所做的权限更改:

FLUSH PRIVILEGES;

最后,我们通过输入以下内容退出 MySQL 终端:

exit;

Create Database and User for WordPress How to Install Wordpress 3.9 with Apache2   MySQL 5.5   PHP 5.5 in Ubuntu Server 14.04 LTS

第 3 步:下载 WordPress 最新版本

进入 Apache 的文档根目录:

cd /var/www/html

使用以下命令从项目网站下载 WordPress 最新版本:

sudo wget http://wordpress.org/latest.tar.gz

提取文件“latest.tar.gz”以使用以下命令重建 WordPress 目录:

sudo tar -zxvf latest.tar.gz

这将在目录 / 中创建一个名为 wordpress 的目录var/www/html

create a directory called wordpress How to Install Wordpress 3.9 with Apache2   MySQL 5.5   PHP 5.5 in Ubuntu Server 14.04 LTS

将 wordpress 目录中的所有文件复制到 Apache 的文档根目录,我们建议使用 rsync 命令来保留权限和数据完整性:

sudo rsync -avP wordpress/ /var/www/html

或者,您可以在不提及 Apache 文档根目录的情况下执行此操作:

sudo rsync -avP wordpress/ .

复制 WordPress 目录上的所有文件完成后。删除wordpress目录和文件latest.tar.gz

sudo rm -rf wordpress/ latest.tar.gz

授予用户和组(www-data)对目录/var/www/html下所有内容的权限

sudo chown -R www-data:www-data /var/www/html

Give permissions to user and group www data How to Install Wordpress 3.9 with Apache2   MySQL 5.5   PHP 5.5 in Ubuntu Server 14.04 LTS

第 4 步:通过网络浏览器安装 WordPress

通过网络浏览器完成 WordPress 安装,在网络浏览器中,导航到服务器的域名或公共 IP 地址 [http://ip_public][http://domain]

您应该看到此图片:

Create Configuration File for WordPress How to Install Wordpress 3.9 with Apache2   MySQL 5.5   PHP 5.5 in Ubuntu Server 14.04 LTS

we need some information on the database How to Install Wordpress 3.9 with Apache2   MySQL 5.5   PHP 5.5 in Ubuntu Server 14.04 LTS

Click on Create Configuration File, followed by Let’s Go in the next step. In the 3rd step, enter the details as follows:

Database Name: dbwordpress

User Name: wpuser

Password: wpP@5sw0Rd

Database Host: localhost

Table Prefix: wp_

Selection 211 How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

After click on Submit. you should get the following page. Click Run Install

run install wordpress How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

Now you will see the WordPress initial configuration page, Fill out the information for the site such as Site title, Username, Password and Your Email, Check list on privacy option if you allow search engine crawling your site. Then and click Install WordPress

WordPress Installation How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

WordPress will confirm the installation process is success. It also show you login account that have been created on previous step.

Selection 212 How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

Hit the log in button if you want login to wordpress dashboard.

Just another WordPress site How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

Additonal Setting – WordPress Permalinks

By default, WordPress create  URLs dynamically that look something like this [ domain/?page_id=4 ] to enable URL friendly you need to have an .htaccess file on root directory where wordpress installed, The first thing you do is edit the file /etc/apache2/sites-available/000-default.conf.

sudo nano /etc/apache2/sites-available/000-default.conf

Add the following line under option ( DocumentRoot /var/www/html) on section 

ServerName domain_or_IP<Directory /var/www/html/>AllowOverride All</Directory>

Example:

add option on file 000 default conf How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

Enable the rewrite module with these command:

sudo a2enmod rewrite

Restart apache2 service:

sudo service apache2 restart

Create empty file .htaccess in your document root

sudo touch /var/ww/html/.htaccess

Give permission file .htaccess with username and group (www-data)

sudo chown www-data:www-data /var/ww/html/.htaccess

Set permission file /var/www/html/.htaccess to 644

sudo chmod 664 /var/www/html/.htaccess

Now you can setting wordpress permaliks from wordpress dashboard, navigate to Settings -> Permalinks

Setting Wordpress Permalinks How to Install Wordpress 3.9 with Apache2 + MySQL 5.5 + PHP 5.5 in Ubuntu Server 14.04 LTS

The following video created by LinuxScoop  and is describes How to install WordPress 3.9 with Apache2 + MySQL 5.5 + PHP5.5 in Ubuntu Server 14.04 LTS . Original video you can found  here

Note: This tutorial have been tested on VPS  DigitalOcean  512MB

Link Reference :

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn