如何在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 進入安裝頁面,在線完成。


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