快速安装 Moodle 指南:修订间差异

来自MoodleDocs
跳转至:导航、​搜索
第63行: 第63行:
See [[Cron]] for more options.
See [[Cron]] for more options.


==Congratulations!==
== 祝贺!==


You are now ready to use your Moodle site.
你已经成功安装了你的 Moodle 站点了。


If you run into problems, check the [[Installation FAQ]] and visit the Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum].
If you run into problems, check the [[Installation FAQ]] and visit the Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum].

2013年8月14日 (三) 13:30的版本

这个页面主要针对具有 Web 服务器和应用程序安装经验的系统管理员。否则请参看安装 Moodle

基本要求

  • 你需要自行配置 Web 服务器(比如 Apache),数据库(比如 MySQLPostgreSQL)和 PHP。
  • Moodle 的运行需要一系列的 PHP 扩展。Moodle 在安装的时候会进行校验,如果你有任何需要的扩展没有安装上来,请先行安装扩展,然后重启安装进程。
  • 如果你希望你的 Moodle 具有外发电子邮件功能,你可能需要配置(Unix/Linux)服务器下的 Sendmail 或者直接使用 SMTP 邮件服务器。

获得 Moodle 程序文件

你基本上有 2 个选择:

  • http://moodle.org/downloads 网站上下载你需要的版本
  • 从Git 代码仓库中直接下载源代码(推荐开发人员使用这个方式,这个方式让你更新程序更加简单):
git clone -b MOODLE_25_STABLE git://git.moodle.org/moodle.git 

这个过程将会切换到 Moodle 的 2.5 稳定分支(最新的每周构建),并且拷贝完整的 Moodle 代码仓库。

Note: 仅从 Moodle 官方网站上提供的下载地址下载程序。其他版本,例如,虚拟主机提供的安装服务或者随 Linux 分发的版本库不能保证所有程序能够正常的进行工作,同时 Moodle 官方网站也不提供支持。

创建数据库

  • 使用你选择的数据库服务器,创建一个新的数据库。默认的编码格式必须使用 UTF-8 编码。例如,MySQL 数据库:
CREATE DATABASE moodle DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
  • 为你的数据库创建一个具有正确权限的用户名和密码,例如,MySQL 数据库:
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'yourpassword';

Create data directory

  • Create an empty directory to hold Moodle files. It must not be in the area served by the web server and must have permissions so that the web server user can write to it. Typically, either make it owned by the web server user or give it write permissions for 'everyone'.

Install Moodle code

  • Unzip / move / copy the Moodle code (obtained above) so that it will be served by your web server (e.g. on Debian based Linux, move to /var/www/moodle)
  • Check the permissions and make sure that the web server does not have permissions to write to any of the files in the Moodle code directories (a very common root cause of sites being hacked).
  • If you need to, configure your web server to serve the Moodle site with your chosen URL.

Configure Moodle

  • In the Moodle code directory, find the file config-dist.php and copy it to a new file called config.php (but read next step, 'Install Moodle', first).
  • Edit config.php with your favourite editor and change the appropriate settings to point to your site, directories and database. Note: the Moodle install script will create config.php for you if it does not exist but make sure you (re-)set permissions appropriately afterwards

Install Moodle

  • Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):
/usr/bin/php /path/to/moodle/admin/cli/install.php

The CLI creates the config.php for you and will not run if you created one in the previous step.

  • After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).

Set up cron

  • You will need a cron job to run periodically. A typical Unix cron entry will be as follows:
*/15 * * * *    /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null

See Cron for more options.

祝贺!

你已经成功安装了你的 Moodle 站点了。

If you run into problems, check the Installation FAQ and visit the Using Moodle Installation problems forum.