如何在CentOS 6 安装Wordpress

Origin: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-6--2


关于 Wordpress

Wordpress is a free and open sourcewebsite and blogging tool that uses php and MySQL. It was created in 2003 andhas since then expanded to manage 22% of all the new websites created and hasover 20,000 plugins to customize its functionality.

Wordpress 是一个免费开源的、使用php MySQL技术的网站和博客建设工具。它始于2003年,从那时起22%的新网站都是使用它管理,拥有2000个用于自定义功能的插件。

安装

The steps in this tutorial require theuser to have root privileges. You can see how to set that up here insteps 3 and 4.

教程的安装步骤需要用户有root权限。你可以参照步骤3 4 查看如何设置。

Before working with wordpress, you need tohave LAMP installed on your server. If you don't have the Linux, Apache, MySQL,PHP stack on your server, you can find the tutorial for setting it up here.

在安装Wordpress前,你需要在服务器完成安装LAMP。如果你还没有LinuxApacheMySQLPHP ,你可以找找关于它们安装的教程。

Once you have the user and requiredsoftware, you can start installing wordpress!

一旦你拥有root用户和上述必须的软件,你可以开始安装Wordpress了。

第一步下载Wordpress

We can download Wordpress straight fromtheir website:

可以直接从官方网站下载Wordpress

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

This command will download the zippedwordpress package straight to your user's home directory. You can unzip it thethe next line:

上面的命令会下载打包好的Wordpress 压缩包到你的用户目录。你可以使用下面的命令解压缩。

tar -xzvf latest.tar.gz

第二部创建Wordpress 数据库和用户

After we unzip the wordpress files, theywill be in a directory called wordpress in the home directory.

解压之后,所需文件会在用户目录的的wordpress文件夹内。

Now we need to switch gears for a momentand create a new MySQL directory for wordpress.

磨刀不误砍柴工,现在我们需要创建一个用于Wordpress新的MySQl 目录

Go ahead and log into the MySQL Shell:

输入以下命令登录MySQL

mysql -u root -p

Login using yourMySQL root password, and then we need to create a wordpress database, a user inthat database, and give that user a new password. Keep in mind that all MySQLcommands must end with semi-colon. First, let's make the database (I'm callingmine wordpress for simplicity's sake; feel free to give it whatever name youchoose):

使用你的MySQL root用户密码登录,接着我们需要创建一个Wordpress 数据库以及对应该库的用户和新密码。记住MySQL命令必须以分号结尾。首先,我们创建数据库(为了简单起见,我的库名为Wordpress,你可以选用任何你喜欢的名字)

CREATE DATABASE wordpress;

Query OK, 1 row affected (0.00 sec)

Then we need tocreate the new user. You can replace the database, name, and password, withwhatever you prefer:

接着我们创建一个用于wordpress的新用户(名字和密码你可以任意设定)

CREATE USER wordpressuser@localhost;

Query OK, 0 rows affected (0.00 sec)

Set the passwordfor your new user:

为你新建的用户设置密码

SET PASSWORD FOR wordpressuser@localhost=PASSWORD("password");

Query OK, 0 rows affected (0.00 sec)

Finish up by granting all privileges tothe new user. Without this command, the wordpress installer will not be able tostart up:

授予Wordpress 库表权限给新用户,没有这一项步骤的话,Wordpress安装不能开始。

GRANT ALL PRIVILEGES ON wordpress.* TOwordpressuser@localhost IDENTIFIED BY 'password';

Query OK, 0 rows affected (0.00 sec)

Then refresh MySQL:

刷新MySQL

FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:

退出

exit

第三步配置Wordpress

The first step to is to copy the samplewordpress configuration file, located in the wordpress directory, into a newfile which we will edit, creating a new usable wordpress config:

第一步是从Wordpress解压目录复制一份样例配置文件,到我们用于编辑的配置文件。

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Then open the wordpress config:

使用vi 编辑配置文件

vi ~/wordpress/wp-config.php  

Find the section that contains the fieldbelow and substitute in the correct name for your database, username, andpassword:

找到如下部分,并用你自己的数据库、用户、密码取而代之。

// ** MySQL settings - You can get this infofrom your web host ** //

/** The name of the database for WordPress */

define('DB_NAME', 'wordpress');

 

/** MySQL database username */

define('DB_USER', 'wordpressuser');

 

/** MySQL database password */

define('DB_PASSWORD', 'password');

Save and Exit.

保存并推出。

第四步复制文件到Web目录

We are almost done uploading Wordpress tothe server. The final move that remains is to transfer the unzipped WordPressfiles to the website's root directory.

我们快完成了。最后一步是将刚才解压后的Wordpres文件移动到服务器的web根目录

sudo cp -r ~/wordpress/* /var/www/html

From here, WordPress has its own easy tofollow installation form online.

在此之后,可以通过在线完成Wordpress的安装设置。

However, the form does require a specificphp module to run. If it is not yet installed on your server, download php-gd:

但是,还有以恶搞特定的php模块需要安装,如果php-gd模块还没有安装,请输入如下命令

sudo yum install php-gd

Last of all restart Apache:

最后重启Apache 服务

 sudoservice httpd restart

第五步进入Wordpress 在线安装

 

Once that is all done, the wordpressonline installation page is up and waiting for you:

上面的步骤完成后,Wordpress在线安装页面在等着您。

Access the page by adding/wp-admin/install.php to your site's domain or IP address (eg.example.com/wp-admin/install.php) and fill out the short online form (it shouldlook like this).

通过在域名或者你的服务器IP后面输入/wp-admin/install.php 进入安装页面,在线完成。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章