Wordpress 中文
注册
Advertisement

英文版URL:http://codex.wordpress.org/index.php?title=Installing_WordPress

WordPress以它的快速安装而闻名。在大多数情形下,WordPress安装可以在5分钟之内完成。、

安装前预备知识[ | ]

安装前,你需要准备一些东西。

安装前需要准备的东西[ | ]

你需要你的主机访问权限和一些常用软件:

安装前你需要做[ | ]

安装前:

  1. 首先确定你的空间主机达到了运行WordPress的最低配置.
  2. 下载最新版的WordPress.
  3. 解压缩到本地.
  4. 安装时随时查看本页寻找帮助,最好打印下来(没必要吧?).

5分钟安装指南[ | ]

下面是快速安装指南,适用于大多数情况。更多信息见下面的详细安装说明

  1. 下载并解压缩WordPress,如果你还没有的话。
  2. 在你的主机的MySQL上为WordPress建立一个数据库,并设定具有访问和修改权限的用户。
  3. wp-config-sample.php改名为wp-config.php.
  4. 用你最喜欢的文字编辑器(记事本)打开wp-config.php填入你的数据库信息.
  5. 将WordPress文件上传至你的主机空间:
    • 如果你想直接使用顶级域名(e.g. http://example.com/)访问Blog, 将你的所有文件(不包含最外层的WordPress文件夹)上传至你的空间顶级目录。
    • 如果你想使用子域名(e.g. http://example.com/blog/), 将文件加wordpress改名为你所想要的子域名,比如Blog,再上传到你的空间顶级目录。
  6. 在浏览器访问wp-admin/install.php运行WordPress脚本。
    • 如果你安装在顶级域名,你需要访问 http://example.com/wp-admin/install.php
    • 如果你使用子域名,比如blog, for example, 你应该访问http://example.com/blog/wp-admin/install.php

好了,不出意外的话,你已经安装成功了。

更多阅读

详细安装说明[ | ]

第一步: 下载并解压缩[ | ]

下载并解压缩从http://wordpress.org/download/下载的WordPress的文件包

  • 如果你需要将WordPress上传到一个远端的web服务器,你需要先用你最喜爱的浏览器下载WordPress文件包到你的本地电脑并解压缩w
  • 如果你可以通过shell 登陆到你的web服务器, 并且熟悉基于控制台的工具,你可能希望通过wget (或者 lynx 或者另一个基于控制的web浏览器)来下载WordPress到你的web server这样可以避免使用 FTPing:
    • wget http://wordpress.org/latest.tar.gz
    • 使用这条命令解压缩文件包:
      tar -xzvf latest.tar.gz

WordPress文件包会被解压缩到一个名叫 wordpress 的文件目录中,这个文件目录和你下载的in the same directory that you downloaded latest.tar.gz文件在同一个目录下。

Step 2: Create the Database and a User[ | ]

If you are using a hosting provider, you may already have a WordPress database set up for you, or there may be an automated setup solution to do so. Check your hosting provider's support pages or your control panel for clues about whether or not you'll need to create one manually.

If you determine that you'll need to create one manually, follow the instructions for accessing phpMyAdmin on various servers, or follow the instructions for Using cPanel or Using phpMyAdmin below.

If you are installing WordPress on your own web server, follow the Using phpMyAdmin or Using the MySQL Client instructions below to create your WordPress username and database.

Using cPanel[ | ]

Main article: Using cPanel

If your hosting provider uses cPanel, you may follow these instructions to create your WordPress username and database.

  1. Log in to your cPanel.
  2. Click MySQL Databases.
  3. If a user relating to WordPress does not already exist under the Users section, create one:
    1. Chose a username for WordPress ('wordpress' is good) and enter it in the UserName field.
    2. Choose a difficult-to-guess password (ideally containing a combination of upper- and lower-case letters, numbers, and symbols), and enter it in the Password field.
    3. Write down the username and password you chose.
    4. Click Add User.
  4. If a database relating to WordPress does not already exist under the Databases section, create one:
    1. Choose a name for your WordPress database ('wordpress' or 'blog' are good), enter it in the Db field, and click Add Db.
  5. Under Databases, select your WordPress username from the User dropdown, then select your WordPress database from the Db dropdown. Make sure All is checked under Privileges, then click Add User to Db.
  6. When you return to the main MySQL Account Maintenance screen, cPanel will list information about the database you just created. You should see the username you just added to the database (with ALL PRIVILEGES), as well as a few sample Connection Strings for you to use in Perl or PHP scripts to connect to the database. The PHP code will have the following format:
$dbh = mysql_connect("hostname", "username", "<PASSWORD HERE>") or die ("message");
mysql_select_db("databasename");
Write down the values of hostname, username, databasename, and the password you chose. (Note that hostname will usually be localhost.)

Using phpMyAdmin[ | ]

If your web server has phpMyAdmin installed, you may follow these instructions to create your WordPress username and database.

Note: These instructions are written for phpMyAdmin 2.6.0; the phpMyAdmin user interface can vary slightly between versions.

  1. If a database relating to WordPress does not already exist in the Database dropdown on the left, create one:
    1. Choose a name for your WordPress database ('wordpress' or 'blog' are good), enter it in the Create new database field, and click Create.
  2. Click the Home icon in the upper left to return to the main page, then click Privileges. If a user relating to WordPress does not already exist in the list of users, create one:
    1. Click Add a new User.
    2. Chose a username for WordPress ('wordpress' is good) and enter it in the User name field. (Be sure Use text field: is selected from the dropdown.)
    3. Choose a difficult-to-guess password (ideally containing a combination of upper- and lower-case letters, numbers, and symbols), and enter it in the Password field. (Be sure Use text field: is selected from the dropdown.) Re-enter the password in the Re-type field.
    4. Write down the username and password you chose.
    5. Leave all options under Global privileges at their defaults.
    6. Click Go.
  3. Return to the Privileges screen and click the Check privileges icon on the user you've just created for WordPress. In the Database-specific privileges section, select the database you've just created for WordPress under the Add privileges to the following database dropdown. The page will refresh with privileges for that database. Click Check All to select all privileges, and click Go.
  4. On the resulting page, make note of the host name listed after Server: at the top of the page. (This will usually be localhost.)

Using the MySQL Client[ | ]

If you have shell access to your web server, are comfortable with using the command line, and your MySQL user has the permissions to create MySQL users and databases, you may follow the example session below to create your WordPress username and database.

$ mysql -u ''adminusername'' -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> CREATE DATABASE ''databasename'';
Query OK, 1 row affected (0.00 sec)
 
mysql> GRANT ALL PRIVILEGES ON ''databasename''.* TO "''wordpressusername''"@"''hostname''"
    -> IDENTIFIED BY "''password''";
Query OK, 0 rows affected (0.00 sec)
  
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> EXIT
Bye
$ 

In the above:

  • adminusername will typically be root, unless you have another high-privileged account set up.
  • wordpress or blog are good values for databasename.
  • wordpress is a good value for wordpressusername.
  • hostname will usually be localhost. If you don't know what this value should be, check with your system administrator. If you are the system administrator, figure out what this value should be.
  • password should be a difficult-to-guess password, ideally containing a combination of upper- and lower-case letters, numbers, and symbols.

Write down the values you used for databasename, wordpressusername, hostname, and password.

Using Plesk[ | ]

See:

第三步,设置wp-config.php[ | ]

你需要修改的代码是:

// ** MySQL settings ** //
define('DB_NAME', 'wordpress');     // 数据库名字
define('DB_USER', 'username');     // MySQL用户名
define('DB_PASSWORD', 'password'); // ...密码
define('DB_HOST', 'localhost');     // 数据库访问地址,99%你不需要改动
  1. Returning to where you extracted the WordPress package in Step 1, rename the file wp-config-sample.php to wp-config.php.
  2. Open the renamed wp-config.php file in your favorite text editor and fill in the following information, per the example above:
    DB_NAME
    The name of the database you created for WordPress in Step 2 .
    DB_USER
    The username you created for WordPress in Step 2.
    DB_PASSWORD
    The password you chose for the WordPress username in Step 2.
    DB_HOST
    The hostname you determined in Step 2 (usually localhost, but not always).
  3. Save the file.

更多信息可见编辑wp-config.php.

Step 4: Place the files[ | ]

Now you will need to decide where on your web site you'd like your blog to appear:

  • In the root directory of your web site. (For example, http://example.com/)
  • In a subdirectory of your web site. (For example, http://example.com/blog/)

Note: The location of your root web directory in the filesystem on your web server will vary across hosting providers and operating systems. Check with your hosting provider or system administrator if you do not know where this is.

In the Root Directory[ | ]

  • If you need to upload your files to your web server, use your favorite FTP client to upload all the contents of the wordpress directory (but not the directory itself) into the root directory of your web site.
  • If your files are already on your web server, and you are using shell access to install WordPress, move all of the contents of the wordpress directory (but not the directory itself) into the root directory of your web site.

In a Subdirectory[ | ]

  • If you need to upload your files to your web server, rename the wordpress directory to your desired name, then use your favorite FTP client to upload the directory to your desired location within the root directory of your web site.
  • If your files are already on your web server, and you are using shell access to install WordPress, move the wordpress directory to your desired location within the root directory of your web site, and rename the directory to your desired name.

Step 5: Run the Install Script[ | ]

Using your favorite web browser, visit wp-admin/install.php within the directory into which you just installed WordPress on your web site.

  • If you installed into a subdirectory called blog, you would visit http://example.com/blog/wp-admin/install.php.
  • If you installed into the root directory of your web site, you would visit http://example.com/wp-admin/install.php.

The following screenshots show how the installation progresses and the install script will now guide you through what remains of the process.

File:Install-step1.png

Getting Started Screen

File:Install-step2.png

Entering details

File:Install-step3.png

All done!

Install Script Troubleshooting[ | ]

  • If you get an error about the database when you run the install script:
    • Go back to Step 2 and Step 3, and be sure you got all the correct database information and that it was entered correctly into wp-config.php.
    • Be sure you granted your WordPress user permission to access your WordPress database in Step 3.
    • Be sure the database server is running.

常见安装问题[ | ]

下面是最常见的安装问题。要了解更多 WordPress 安装问题的解决方法,请参考安装常见问题解答

  • :我看见很多 Headers already sent 错误。我如何修复?
  • :您可能在编辑 wp-config.php 时出现了语法错误。
  1. 下载 wp-config.php (如果您没有 Shell 权限)。
  2. 用您喜爱的文本编辑器打开。
  3. 检查一下,文件的第一行应当只包含 <?php,并且在它之前**没有**任何字符 (空格也不能有)。
  4. 检查一下,文件的最后一行应当只包含 ?>,并且在它之后**没有**任何字符 (空格也不能有)。
  5. 保存文件,如果需要,将其重新上传,然后在浏览器中刷新页面。
  • :我的页面乱七八糟。当我查看网页源代码时我看到了许多“<?php ?>”标签。
  • :如果 <?php ?> 标签被发送到浏览器,说明您的 PHP 工作不正常。所有的 PHP 代码都应当在服务器向浏览器发送 HTML 代码之前执行完毕。(这就是它被称为处理程序的原因。) 请确认您的 Web 服务器符合运行 WordPress 的需求,PHP 被正确安装和配置,获知联系您的主机提供商或系统管理员以寻求帮助。
  • :我获得了很多连接数据库错误的信息,但是我不确定我的配置是否正确。
  • :尝试重置您的 MySQL 密码。如果您有 Shell 访问 MySQL 的权限,尝试执行 SQL 语句:
 SET PASSWORD FOR 'wordpressusername'@'hostname' = OLD_PASSWORD('password');

如果您使用的 MySQL 版本早于 4.1,使用 PASSWORD 替换 OLD_PASSWORD。如果您没有 Shell 访问权限,您应该可以简单的在 phpMyAdmin 中执行上面的 SQL 语句。如果还是有错误提示,您可能需要使用主机的控制面板为您的数据库用户重置密码。

Installation Instructions in Other Languages[ | ]

For installation instructions in other languages, see WordPress in Your Language.

Installing Multiple Blogs[ | ]

Detailed information about Installing Multiple Blogs is available.

本地安装WordPress[ | ]

如果您家里有足够强劲的电脑,和足够快的互联网连接,您可能想使用自己的电脑作为服务器,省下购买主机空间的钱。下面的教程会指导您如何配置一个服务器环境,并在自己的电脑上安装 WordPress。

Resources[ | ]

Advertisement