安装 Moodle:修订间差异
Yucheng Hu(讨论 | 贡献) |
Betty Chou(讨论 | 贡献) |
||
(未显示2个用户的30个中间版本) | |||
第1行: | 第1行: | ||
{{Template:Installing Moodle}} | {{Template:Installing Moodle}} | ||
'' | '' 这个页面解释了如何进行 Moodle 的安装,如果你是技术高手或者有相当的技术经验,请参看页面 [[ 快速安装 Moodle 指南]] 。'' | ||
如果你希望在独立机器上运行 Moodle ,Moodle 提供了一键安装程序,请参看 [[Windows 完整程序安装包]] 和 [[Mac OS X 完整程序安装包]] 。请注意上面 2 个安装包并不适用服务器上安装的情况。 | |||
= =需求 == | ==需求 == | ||
Moodle主要是在Linux上使用[[Apache]]、[[MySQL]]及[[PHP]] | Moodle主要是在Linux上使用[[Apache]]、[[MySQL]]及[[PHP]] 開發(有時也被 稱為LAMP 平台)。 | ||
如果你 | 如果你 懷 疑 LAMP 平台的安全性,LAMP 其 實 是目前最安全和最流行的 組 合。 | ||
同 | 同 時 也有其他的一些 選擇 - 查看下面 鏈 接中的 軟 件部分: | ||
Moodle 安 | Moodle 安 裝 的基本需求如下: | ||
=== 硬件 === | === 硬件 === | ||
* 磁 | * 磁 碟 空 間 :160MB 是程序安 裝 的最小空 閒 磁 盤 空 間 。你也可能需要存 儲 你自己的 資 料的 話 ,5GB 的實際 使用空 間 基本上 夠 用了。 | ||
* | * 備 份空 間 :至少 與 你 實際運 行的程序和 數據 相同的存 儲 空 間 ,如果能 夠進 行 遠 程 備 份,那就更加理想。 | ||
* | * 內 存:256MB 的 內 存 為 最小 內 存, 強 烈建 議 使 用1GB 以上 內 存 。 Moodle 的基本使用情 況 是: 1G 的 內 存能 夠 支 持10 到20 個 的'' 並發''用 戶 。但是 這個 也 與 你的系 統 硬件和 軟 件配置有很大的 關係 。 ' 並發'的意思 為 服 務 器同 時 在 內 存中 處 理的能力,例如用 戶 在某一 個時間點內與 系 統進 行交互,而不是指登 錄 系 統 的用 戶數 量。 | ||
=== | === 軟 件=== | ||
* | * 操作系 統(!). 通常用於運行下面的軟軟件,選擇什麼樣的操作系統通常根據你的技術能力和實際情況來決定。 Linux 和Windows 是最常見的選擇(同時也有很好的技術支持)。 如果你可以自由選擇操作系統的話,Linux 是最佳的方案。 Moodle 測試了Debian, Ubuntu, CentOS, RedHat, Windows 7/2012 和Mac OS X 的兼容性。 | ||
* Web | *Web 服務器, 主要使用[[Apache]] 。 Moodle 沒有完全測試(或者支持)[[IIS]] ,[http://www.lighttpd.net/ lightttpd] ,[http://nginx.org/ nginx] ,[http://www.cherokee-project .com/ cherokee] , zeus 和[http://litespeedtech.com/ LiteSpeed ] ,但是Moodle 應該能夠在上面的服務器上正常工作。除此之外,如果你選擇使用其他WEB 服務器的話,Moodle 將會終止安裝過程。同時你的服務器也配置 PHP 。 WEB 服務器使用什麼版本並不重要,但是請盡量使用最新版。 | ||
* [[PHP]] - | * [[PHP]] - 當前的最低版本是5.3.3 。你需要為你的PHP 安裝一系列擴展,[[PHP]] 頁面列出了所有需要安裝的擴展。如果一些必須的擴展丟失的話,安裝程序會在安裝環境校驗的時候提示您修復並阻止您進入下一步。 | ||
* | * 數據庫。 MySQL 和PostgreSQL 是主要使用的開發數據庫,這2個數據庫進行了主要的兼容性測試,相關的技術文檔也是最全面的。 Oracle 和MSSQL 都能夠被完全的支持(注意,一些可選的插件可能沒有在這2 個數據庫中進行兼容性測試), 但是相關的文檔和與Moodle 相關的文件沒有MySQL/PostgreSQL 這麼全面。 MySQL 能提供更多的文檔,PostgreSQL 能提供更好的穩定性。你需要在系統中安裝PHP 的擴展來支持你選擇的數據庫。 | ||
** [[MySQL]] - | ** [[MySQL]] - 最低版本 5.1.33 | ||
** [[MariaDB]] - | ** [[MariaDB]] - 最低版本 5.3.5 | ||
** [[PostgreSQL]] - | ** [[PostgreSQL]] - 最低版本 8.3 | ||
** [[MSSQL]] - | ** [[MSSQL]] - 最低版本 9.0 | ||
** [[Oracle]] - | ** [[Oracle]] - 最低版本 10.2 | ||
* | * 訪問Moodle 使用的瀏覽器最低版本要求為:Firefox 4, Internet Explorer 8, Safari 5, Google Chrome 11, Opera 9 | ||
== | == 配置你的服務器 == | ||
如果你希望評估Moodle,你也可以在桌面計算機中安裝Moodle。 | |||
有很多方法來安裝你的服務器軟件,這個根據你選擇服務器的不同而不同。一些鏈接和指向將在 [[安裝 AMP]] 中。 | |||
如果你使用虛擬服務器,服務器需要的一些軟件應該已經幫你安裝好了。尤其是在共享服務器上,你需要知道如何修改PHP 的配置,例如如何修改最大上傳文件大小限制。 | |||
不同服務器的配置可能有非常大的不同。 | |||
== 下載和拷貝你的文件到正確位置 == | |||
* | |||
* ''' | '''重要: 有很多地方可以獲得Moodle 的源代碼,但是我們建議你到Moodle 的官方網站moodle.org 上去下載源代碼。如果你遇到任何問題,你通常能夠獲得更好的支持。 ''' | ||
你有 2 個選擇: | |||
* 從http://moodle.org/downloads 網站上下載你需要的版本,然後解壓... | |||
* ''' 或者''' 從Git 代碼倉庫中直接下載源代碼(推薦開發人員使用這個方式,這個方式讓你更新程序更加簡單): | |||
<pre> | <pre> | ||
$ git clone -b MOODLE_25_STABLE git://git.moodle.org/moodle.git | $ git clone -b MOODLE_25_STABLE git://git.moodle.org/moodle.git | ||
</pre> | </pre> | ||
... | ... 這個過程將會切換到Moodle 的2.5 穩定分支( 最新的每週構建) ,並且拷貝完整的Moodle 代碼倉庫。更多GIT 的問題請參考頁面[[Git for Administrators]] 。 | ||
不管你採用何種方式,當你完全獲得Moodle 代碼以後,你應該能夠在你的機器或者服務器上看到一個叫'''moodle''' 的目錄,這個目錄中有一系列的文件和目錄。 | |||
你可以將整個Moodle 目錄拷貝到你Web 服務器的文檔目錄下,在這種情況下你的網站訪問地址為:'''<nowiki>http://yourwebserver.com/moodle</nowiki>''' 。 | |||
或者你也可以直接拷貝Moodle 中的內容到你的Web 服務器文檔目錄下,這樣你的訪問網址就變得更加簡化為'''<nowiki>http://yourwebserver.com</nowiki>''' 。 | |||
* ''' | 當你不太明白的時候,請查看你係統和WEB服務器的相關文檔。 | ||
:''小提示:'' 如果你下載Moodle 安裝程序到你本地計算機上然後上傳到你的服務器上的話,請盡量上傳壓縮文件到服務器上解壓(檢查你的文件'文件管理器')。如果你採用的是FTP 上傳當個文件,請注意查看FTP 的日誌,可能有部分文件在上傳的時候丟失。 | |||
* ''' 保護Moodle 文件:''' 保護Moodle 程序文件不可以被WEB 服務器的用戶隨意更改是非常重要的。例如在Unix/Linux 操作系統下(使用root)執行下面的命令: | |||
<pre> | <pre> | ||
# chown -R root /path/to/moodle | # chown -R root /path/to/moodle | ||
# chmod -R 0755 /path/to/moodle | # chmod -R 0755 /path/to/moodle | ||
</pre> | </pre> | ||
(文件的所有權為administrator/superuser 用戶,也只有administrator/superuser 用戶有寫入權限,但是其他用戶是可以讀的) | |||
== | == 創建空數據庫 == | ||
下一步需要為你Moodle 安裝實例創建一個新的空數據庫。你需要為你的Moodle 安裝實例找到或者設置下面的信息:nformation for use during the final installation stage: | |||
* '''dbhost''' - | * '''dbhost''' - 數據庫的服務器地址。很有可能是''localhost'' 如果的Web 服務器和數據庫服務器在同一台機器上,否則你需要在這裡設置數據庫服務器的名稱 | ||
* '''dbname''' - | * '''dbname''' - 數據庫名稱,你創建的數據庫的名稱,比如''moodle'' | ||
* '''dbuser''' - | * '''dbuser''' - 數據庫用戶,能夠訪問Moodle 數據庫的數據庫用戶名。不要使用 root 和超級用戶的賬號。創建一個賬號,只賦予這個賬號所需要的最低權限就可以 | ||
* '''dbpass''' - | * '''dbpass''' - 數據庫用戶使用的密碼 | ||
如果你的Moodle 站點使用的是虛擬主機服務,你可以通過網頁工具訪問相關的配置信息,如果你不知道如何配置,請詢問你的系統管理員。更多詳細信息,可以通過單擊下面的數據庫分類來獲得: | |||
* [[MySQL]] | * [[MySQL]] | ||
* [[PostgreSQL]] | * [[PostgreSQL]] | ||
第75行: | 第83行: | ||
* [[Oracle]] | * [[Oracle]] | ||
== | == 創建(''moodledata'') 數據目錄 == | ||
Moodle | Moodle 需要一個目錄來存儲所有的文件,包括系統上傳的文件,臨時數據,會話數據等。 | ||
Web 服務器需要這個目錄具有寫入權限。在大型的Moodle 安裝實例中,這個目錄越大越好。 | |||
''' 重要::''' 這個目錄一定不要放置在Web 服務器下,換句話說,這個目錄不能通過網頁訪問到。如果網頁能訪問到這個目錄的話,將會導致非常嚴重的安全漏洞。如果你使用的是Linux 操作系統的話,也請不要將這個目錄放置到root 賬號目錄下和你的Moodle 安裝程序文件目錄下。 Moodle 在安裝的時候將會進行校驗,如果Moodle 發現了文件,將會阻止安裝繼續進行。 | |||
這裡是一個Unix/Linux 的配置示例,在創建此目錄的時候需要設置權限為'''所有人'''都可以訪問。這種情況是因為Moodle 服務器不是共享服務器。與你的服務器管理員取得聯繫來確定何種訪問權限更加合適,同時也需要Web 服務器用戶可以訪問到這些文件。 | |||
<pre> | <pre> | ||
# mkdir /path/to/moodledata | # mkdir /path/to/moodledata | ||
第88行: | 第97行: | ||
</pre> | </pre> | ||
如果你的服務器能夠支持ACL,推薦採用下面的授權方式,例如你的Apache 服務器用戶www-data: | |||
<pre> | <pre> | ||
# chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata | # chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata | ||
</pre> | </pre> | ||
如果你計劃從命令行中執行PHP 腳本,你需要為當前用戶設置同樣的權限: | |||
<pre> | <pre> | ||
$ sudo chmod -R +a "`whoami` allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata | $ sudo chmod -R +a "`whoami` allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata | ||
</pre> | </pre> | ||
==== | ==== Web 目录中配置 moodledata 安全性 ==== | ||
如果你使用的是虛擬主機配置的網站,你沒有辦法配置'moodledata'的安全性。你也許可以在'moodledata'目錄中使用.htaccess 文件來控制訪問權限。這種情況不是對所有系統都是有效的,與你的虛擬主機管理員取得聯繫,尋求他們的幫助。 | |||
創建的文件叫做.htaccess ,這個文件只需要有下面的內容就可以了: | |||
<pre> | <pre> | ||
order deny,allow | order deny,allow | ||
第105行: | 第116行: | ||
</pre> | </pre> | ||
== | == 开始 Moodle 安装 == | ||
现在是时候开始运行安装工具来创建数据库表和配置你的网站了。 | |||
Moodle 推荐使用命令行来进行安装。 | |||
如果因为什么原因你不能使用这种方式进行安装,例如你使用的 Windows 服务器,Moodle 也提供基于 Web 的安装方式。 | |||
=== 命令行安装工具 === | |||
最好使用你系统的 WEB 用户运行命令行安装工具。你需要知道这个是什么 - 查看你的系统管理文档(如:Ubuntu/Debian 是 'www-data' ,Centos 是 'apache' ) | |||
* | * 使用命令行安装工具的示例(使用 root 进行,但是 'www-data' 是你的 Web 用户): | ||
<pre> | <pre> | ||
# chown www-data /path/to/moodle | # chown www-data /path/to/moodle | ||
第119行: | 第133行: | ||
# chown -R root /path/to/moodle | # chown -R root /path/to/moodle | ||
</pre> | </pre> | ||
chowns 命令允许脚本写入新文件 config.php file 。更多有关脚本的使用,请使用下面的命令: | |||
<pre> | <pre> | ||
# php install.php --help | # php install.php --help | ||
</pre> | </pre> | ||
你可能需要被询问到一些本页中没有讨论到的其他设置,如果你也不十分确定配置的信息,请单击确定使用默认配置就可以了。 | |||
完整版本,请查看 [[Administration via command line]] | |||
=== 基于网页安装工具 === | |||
使用你的网页浏览器导航到你的 Moodle 网站主页面就可以使用 Web 方式运行安装脚本了。 | |||
安装进程将会使用一些页面来完成安装进程。你会被要求同意许可协议,查看数据库中被创建的表,提供管理账号信息和网站的细节信息。 | |||
数据库的创建将会需要一些时间,这里请耐心等待。 | |||
当数据库创建完成后,你将会看到 Moodle 的前台和后台界面。这时候,你可以使用 Moodle 提供的界面创建一个新的用户。 | |||
很多时候,你需要下载新的 config.php 文件然后到上传到你的 Moodle 安装实例中,请参照屏幕的提示。 | |||
== 最终配置 == | |||
== | === Moodle 的内部设置 === | ||
在 Moodle 站点管理员界面中有一系列的配置页面(可以从'设置' 块中访问 '网站管理'区)。 | |||
这里有一些重要的系统设置,你需要进行检查。 | |||
* '' 设置> 网站管理 > 插件> 消息输出 > 邮件'' :配置你自己的 SMTP 邮件服务器和授权信息,这样你的 Moodle 安装实例可以向外发送电子邮件。Moodle 网站的支持人员也可以设置这个界面。 | |||
* '' | * '' 设置> 网站管理 > 服务器 > 系统路径'' : 设置你系统的 du, dot 和 aspell 执行文件的路径。 | ||
* '' | * '' 设置> 网站管理 > 服务器 > HTTP'' :如果你的服务器运行在防火墙后,你可能需要在 'Web 代理' 块配置你的代理服务器。 | ||
* '' | * '' 设置> 网站管理 > 区域 > 更新时区'' :运行这个可以将你配置的时区信息写入到系统中。 | ||
* '' | |||
=== | === 余下的任务 === | ||
* ''' | * ''' 配置定时任务''': Moodle 的后台任务,比如社区外发电子邮件和进行课程备份时通过脚本来执行的,你可以设置你的脚本执行时间和间隔。这个就是我们常说的定时任务,请参看[[Moodle 定时任务指南]] 。 | ||
* ''' | * ''' 配置备份''' :查看 [[Moodle 站点备份]] 和 [[Moodle 自动课程备份]]. | ||
* ''' | * ''' 检查邮件能否正常工作''' :使用一个有效的电子邮件地址在你的 Moodle 安装实例中[[Moodle 添加用户 | 添加测试用户]] 。查看这个用户能否正常的接收到系统发出的电子邮件。如果不能,请查看电子邮件的配置。电子邮件的配置信息位于 [ 设置> 网站管理 > 插件> 消息输出 > 邮件]。请在系统正常运行前,确保电子邮件功能是能够正常使用的,因为系统是通过电子邮件功能向用户提供找回密码服务的。如果你是系统管理员,但是你也忘记了密码,你需要用电子邮件功能来找回你的密码。 | ||
* ''' | * ''' 增强 Moodle 网站安全性''': 请阅读 [[Security recommendations]] 的相关内容。 | ||
=== | === 安装已经完成了 :) === | ||
* | * 创建新的课程:现在你可以开始 [[Adding a new course| 创建一个新的课程]] ;-) | ||
=== | === 如果安装的时候出现错误了... === | ||
你可以尝试下面的一些操作... | |||
* | * 参考 [[Installation FAQ]] | ||
* | * 小心检查你的文件权限。你的操作系统运行用户能否正常读取(不是写入)Moodle 程序文件?你的操作系统运行用户能否正常读取和写入 Moodle 的数据目录: | ||
* | * 检查你的数据库权限。你的数据库用户是否已经具有了正常的数据库操作权限,当数据库和程序运行在不同服务器上的时候尤其需要注意这种情况。 | ||
* | * 当你的 Moodle 安装程序不能创建(config.php) [[Moodle 配置文件]] ,你可以手动拷贝 config-dist.php 文件为 config.php,然后再尝试编辑文件中有关数据库的配置信息部分。config-dist.php 在 Moodle 安装程序的根目录下。安装程序便可以继续进行了。 | ||
* | * 当你已经有了 config.php 文件,你可以编辑这个文件来让 Moodle 程序输出调试信息。 Moodle 程序输出的调试信息可以向你提供更加详细的程序运行状态,以便于你查找问题在哪里。如果你具有服务器的访问权限,你也可以查看 Web 服务器的错误信息。 | ||
* | * 重新检查 php.ini / .htaccess 文件的设置。这里有些技术参数可能需要修改,比如 memory_limit ,你是否已经调整了 php.ini / .htaccess 文件的技术参数设置?记住,每次调整后需要重启服务器使设置生效。 | ||
* | * 在你进行系统安装之前,你是否选择了任何非核心插件,主题和代码?如果你已经选择了,请移除这些配置然后重试,这是因为有些插件可能存在错误或者不兼容的情况。 | ||
* | * 提交你的问题到[http://moodle.org/mod/forum/view.php?id=28 Moodle 安装问题] 。 ''' 请''' 列出你当前运行的软件版本,解释你是怎么进行安装的,发生了什么情况,你看见了什么样的错误信息,你进行了怎样的尝试。尽管系统有可能出现白屏,但是这不是没有原因的,请尽量找到错误信息。 | ||
* 你也可以提交问题到 OSS 计算技术 [[http://www.ossez.com/forum-54-1.html http://www.ossez.com/forum-54-1.html]]的 Moodle 相关板块,在这里我们将会向你提供中文帮助。 | |||
== | == 特定平台的安装 == | ||
''' | ''' 注意''' 通常社区能够提供更多的相关信息。下面的内容可能没有经过验证,也有可能已经过时了,请结合上面的内容一同阅读。 | ||
* [[Windows installation]] | * [[Windows installation]] |
2014年10月1日 (三) 06:56的最新版本
这个页面解释了如何进行 Moodle 的安装,如果你是技术高手或者有相当的技术经验,请参看页面 快速安装 Moodle 指南。
如果你希望在独立机器上运行 Moodle,Moodle 提供了一键安装程序,请参看 Windows 完整程序安装包 和 Mac OS X 完整程序安装包。请注意上面 2 个安装包并不适用服务器上安装的情况。
需求
Moodle主要是在Linux上使用Apache、MySQL及PHP開發(有時也被稱為LAMP平台)。
如果你懷疑 LAMP 平台的安全性,LAMP 其實是目前最安全和最流行的組合。
同時也有其他的一些選擇 - 查看下面鏈接中的軟件部分:
Moodle 安裝的基本需求如下:
硬件
- 磁碟空間:160MB 是程序安裝的最小空閒磁盤空間。你也可能需要存儲你自己的資料的話,5GB的實際使用空間基本上夠用了。
- 備份空間:至少與你實際運行的程序和數據相同的存儲空間,如果能夠進行遠程備份,那就更加理想。
- 內存:256MB 的內存為最小內存,強烈建議使用1GB 以上內存。 Moodle 的基本使用情況是: 1G 的內存能夠支持10 到20 個的並發用戶。但是這個也與你的系統硬件和軟件配置有很大的關係。 '並發'的意思為服務器同時在內存中處理的能力,例如用戶在某一個時間點內與系統進行交互,而不是指登錄系統的用戶數量。
軟件
- 操作系統(!).通常用於運行下面的軟軟件,選擇什麼樣的操作系統通常根據你的技術能力和實際情況來決定。 Linux 和Windows 是最常見的選擇(同時也有很好的技術支持)。 如果你可以自由選擇操作系統的話,Linux 是最佳的方案。 Moodle 測試了Debian, Ubuntu, CentOS, RedHat, Windows 7/2012 和Mac OS X 的兼容性。
- Web 服務器, 主要使用Apache。 Moodle 沒有完全測試(或者支持)IIS,lightttpd,nginx,.com/ cherokee, zeus 和LiteSpeed,但是Moodle 應該能夠在上面的服務器上正常工作。除此之外,如果你選擇使用其他WEB 服務器的話,Moodle 將會終止安裝過程。同時你的服務器也配置 PHP。 WEB 服務器使用什麼版本並不重要,但是請盡量使用最新版。
- PHP - 當前的最低版本是5.3.3。你需要為你的PHP 安裝一系列擴展,PHP 頁面列出了所有需要安裝的擴展。如果一些必須的擴展丟失的話,安裝程序會在安裝環境校驗的時候提示您修復並阻止您進入下一步。
- 數據庫。 MySQL 和PostgreSQL 是主要使用的開發數據庫,這2個數據庫進行了主要的兼容性測試,相關的技術文檔也是最全面的。 Oracle 和MSSQL 都能夠被完全的支持(注意,一些可選的插件可能沒有在這2 個數據庫中進行兼容性測試),但是相關的文檔和與Moodle 相關的文件沒有MySQL/PostgreSQL 這麼全面。 MySQL 能提供更多的文檔,PostgreSQL 能提供更好的穩定性。你需要在系統中安裝PHP 的擴展來支持你選擇的數據庫。
- MySQL - 最低版本 5.1.33
- MariaDB - 最低版本 5.3.5
- PostgreSQL - 最低版本 8.3
- MSSQL - 最低版本 9.0
- Oracle - 最低版本 10.2
- 訪問Moodle 使用的瀏覽器最低版本要求為:Firefox 4, Internet Explorer 8, Safari 5, Google Chrome 11, Opera 9
配置你的服務器
如果你希望評估Moodle,你也可以在桌面計算機中安裝Moodle。
有很多方法來安裝你的服務器軟件,這個根據你選擇服務器的不同而不同。一些鏈接和指向將在 安裝 AMP 中。
如果你使用虛擬服務器,服務器需要的一些軟件應該已經幫你安裝好了。尤其是在共享服務器上,你需要知道如何修改PHP 的配置,例如如何修改最大上傳文件大小限制。
不同服務器的配置可能有非常大的不同。
下載和拷貝你的文件到正確位置
重要: 有很多地方可以獲得Moodle 的源代碼,但是我們建議你到Moodle 的官方網站moodle.org 上去下載源代碼。如果你遇到任何問題,你通常能夠獲得更好的支持。
你有 2 個選擇:
- 從http://moodle.org/downloads 網站上下載你需要的版本,然後解壓...
- 或者 從Git 代碼倉庫中直接下載源代碼(推薦開發人員使用這個方式,這個方式讓你更新程序更加簡單):
$ git clone -b MOODLE_25_STABLE git://git.moodle.org/moodle.git
...這個過程將會切換到Moodle 的2.5 穩定分支(最新的每週構建),並且拷貝完整的Moodle 代碼倉庫。更多GIT 的問題請參考頁面Git for Administrators。
不管你採用何種方式,當你完全獲得Moodle 代碼以後,你應該能夠在你的機器或者服務器上看到一個叫moodle的目錄,這個目錄中有一系列的文件和目錄。
你可以將整個Moodle 目錄拷貝到你Web 服務器的文檔目錄下,在這種情況下你的網站訪問地址為:http://yourwebserver.com/moodle 。
或者你也可以直接拷貝Moodle 中的內容到你的Web 服務器文檔目錄下,這樣你的訪問網址就變得更加簡化為http://yourwebserver.com 。
當你不太明白的時候,請查看你係統和WEB服務器的相關文檔。
- 小提示: 如果你下載Moodle 安裝程序到你本地計算機上然後上傳到你的服務器上的話,請盡量上傳壓縮文件到服務器上解壓(檢查你的文件'文件管理器')。如果你採用的是FTP 上傳當個文件,請注意查看FTP 的日誌,可能有部分文件在上傳的時候丟失。
- 保護Moodle 文件: 保護Moodle 程序文件不可以被WEB 服務器的用戶隨意更改是非常重要的。例如在Unix/Linux 操作系統下(使用root)執行下面的命令:
# chown -R root /path/to/moodle # chmod -R 0755 /path/to/moodle
(文件的所有權為administrator/superuser 用戶,也只有administrator/superuser 用戶有寫入權限,但是其他用戶是可以讀的)
創建空數據庫
下一步需要為你Moodle 安裝實例創建一個新的空數據庫。你需要為你的Moodle 安裝實例找到或者設置下面的信息:nformation for use during the final installation stage:
- dbhost - 數據庫的服務器地址。很有可能是localhost如果的Web 服務器和數據庫服務器在同一台機器上,否則你需要在這裡設置數據庫服務器的名稱
- dbname - 數據庫名稱,你創建的數據庫的名稱,比如moodle
- dbuser - 數據庫用戶,能夠訪問Moodle 數據庫的數據庫用戶名。不要使用 root 和超級用戶的賬號。創建一個賬號,只賦予這個賬號所需要的最低權限就可以
- dbpass - 數據庫用戶使用的密碼
如果你的Moodle 站點使用的是虛擬主機服務,你可以通過網頁工具訪問相關的配置信息,如果你不知道如何配置,請詢問你的系統管理員。更多詳細信息,可以通過單擊下面的數據庫分類來獲得:
創建(moodledata) 數據目錄
Moodle 需要一個目錄來存儲所有的文件,包括系統上傳的文件,臨時數據,會話數據等。
Web 服務器需要這個目錄具有寫入權限。在大型的Moodle 安裝實例中,這個目錄越大越好。
重要:: 這個目錄一定不要放置在Web 服務器下,換句話說,這個目錄不能通過網頁訪問到。如果網頁能訪問到這個目錄的話,將會導致非常嚴重的安全漏洞。如果你使用的是Linux 操作系統的話,也請不要將這個目錄放置到root 賬號目錄下和你的Moodle 安裝程序文件目錄下。 Moodle 在安裝的時候將會進行校驗,如果Moodle 發現了文件,將會阻止安裝繼續進行。
這裡是一個Unix/Linux 的配置示例,在創建此目錄的時候需要設置權限為所有人都可以訪問。這種情況是因為Moodle 服務器不是共享服務器。與你的服務器管理員取得聯繫來確定何種訪問權限更加合適,同時也需要Web 服務器用戶可以訪問到這些文件。
# mkdir /path/to/moodledata # chmod 0777 /path/to/moodledata
如果你的服務器能夠支持ACL,推薦採用下面的授權方式,例如你的Apache 服務器用戶www-data:
# chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata
如果你計劃從命令行中執行PHP 腳本,你需要為當前用戶設置同樣的權限:
$ sudo chmod -R +a "`whoami` allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata
Web 目录中配置 moodledata 安全性
如果你使用的是虛擬主機配置的網站,你沒有辦法配置'moodledata'的安全性。你也許可以在'moodledata'目錄中使用.htaccess 文件來控制訪問權限。這種情況不是對所有系統都是有效的,與你的虛擬主機管理員取得聯繫,尋求他們的幫助。
創建的文件叫做.htaccess,這個文件只需要有下面的內容就可以了:
order deny,allow deny from all
开始 Moodle 安装
现在是时候开始运行安装工具来创建数据库表和配置你的网站了。
Moodle 推荐使用命令行来进行安装。
如果因为什么原因你不能使用这种方式进行安装,例如你使用的 Windows 服务器,Moodle 也提供基于 Web 的安装方式。
命令行安装工具
最好使用你系统的 WEB 用户运行命令行安装工具。你需要知道这个是什么 - 查看你的系统管理文档(如:Ubuntu/Debian 是 'www-data',Centos 是 'apache')
- 使用命令行安装工具的示例(使用 root 进行,但是 'www-data'是你的 Web 用户):
# chown www-data /path/to/moodle # cd /path/to/moodle/admin/cli # sudo -u www-data /usr/bin/php install.php # chown -R root /path/to/moodle
chowns 命令允许脚本写入新文件 config.php file。更多有关脚本的使用,请使用下面的命令:
# php install.php --help
你可能需要被询问到一些本页中没有讨论到的其他设置,如果你也不十分确定配置的信息,请单击确定使用默认配置就可以了。
完整版本,请查看 Administration via command line
基于网页安装工具
使用你的网页浏览器导航到你的 Moodle 网站主页面就可以使用 Web 方式运行安装脚本了。
安装进程将会使用一些页面来完成安装进程。你会被要求同意许可协议,查看数据库中被创建的表,提供管理账号信息和网站的细节信息。
数据库的创建将会需要一些时间,这里请耐心等待。
当数据库创建完成后,你将会看到 Moodle 的前台和后台界面。这时候,你可以使用 Moodle 提供的界面创建一个新的用户。
很多时候,你需要下载新的 config.php 文件然后到上传到你的 Moodle 安装实例中,请参照屏幕的提示。
最终配置
Moodle 的内部设置
在 Moodle 站点管理员界面中有一系列的配置页面(可以从'设置' 块中访问 '网站管理'区)。
这里有一些重要的系统设置,你需要进行检查。
- 设置> 网站管理 > 插件> 消息输出 > 邮件:配置你自己的 SMTP 邮件服务器和授权信息,这样你的 Moodle 安装实例可以向外发送电子邮件。Moodle 网站的支持人员也可以设置这个界面。
- 设置> 网站管理 > 服务器 > 系统路径: 设置你系统的 du, dot 和 aspell 执行文件的路径。
- 设置> 网站管理 > 服务器 > HTTP:如果你的服务器运行在防火墙后,你可能需要在 'Web 代理' 块配置你的代理服务器。
- 设置> 网站管理 > 区域 > 更新时区:运行这个可以将你配置的时区信息写入到系统中。
余下的任务
- 配置定时任务: Moodle 的后台任务,比如社区外发电子邮件和进行课程备份时通过脚本来执行的,你可以设置你的脚本执行时间和间隔。这个就是我们常说的定时任务,请参看Moodle 定时任务指南。
- 配置备份:查看 Moodle 站点备份 和 Moodle 自动课程备份.
- 检查邮件能否正常工作:使用一个有效的电子邮件地址在你的 Moodle 安装实例中 添加测试用户。查看这个用户能否正常的接收到系统发出的电子邮件。如果不能,请查看电子邮件的配置。电子邮件的配置信息位于 [设置> 网站管理 > 插件> 消息输出 > 邮件]。请在系统正常运行前,确保电子邮件功能是能够正常使用的,因为系统是通过电子邮件功能向用户提供找回密码服务的。如果你是系统管理员,但是你也忘记了密码,你需要用电子邮件功能来找回你的密码。
- 增强 Moodle 网站安全性: 请阅读 Security recommendations 的相关内容。
安装已经完成了 :)
- 创建新的课程:现在你可以开始 创建一个新的课程 ;-)
如果安装的时候出现错误了...
你可以尝试下面的一些操作...
- 参考 Installation FAQ
- 小心检查你的文件权限。你的操作系统运行用户能否正常读取(不是写入)Moodle 程序文件?你的操作系统运行用户能否正常读取和写入 Moodle 的数据目录:
- 检查你的数据库权限。你的数据库用户是否已经具有了正常的数据库操作权限,当数据库和程序运行在不同服务器上的时候尤其需要注意这种情况。
- 当你的 Moodle 安装程序不能创建(config.php) Moodle 配置文件,你可以手动拷贝 config-dist.php 文件为 config.php,然后再尝试编辑文件中有关数据库的配置信息部分。config-dist.php 在 Moodle 安装程序的根目录下。安装程序便可以继续进行了。
- 当你已经有了 config.php 文件,你可以编辑这个文件来让 Moodle 程序输出调试信息。 Moodle 程序输出的调试信息可以向你提供更加详细的程序运行状态,以便于你查找问题在哪里。如果你具有服务器的访问权限,你也可以查看 Web 服务器的错误信息。
- 重新检查 php.ini / .htaccess 文件的设置。这里有些技术参数可能需要修改,比如 memory_limit,你是否已经调整了 php.ini / .htaccess 文件的技术参数设置?记住,每次调整后需要重启服务器使设置生效。
- 在你进行系统安装之前,你是否选择了任何非核心插件,主题和代码?如果你已经选择了,请移除这些配置然后重试,这是因为有些插件可能存在错误或者不兼容的情况。
- 提交你的问题到Moodle 安装问题。 请 列出你当前运行的软件版本,解释你是怎么进行安装的,发生了什么情况,你看见了什么样的错误信息,你进行了怎样的尝试。尽管系统有可能出现白屏,但是这不是没有原因的,请尽量找到错误信息。
- 你也可以提交问题到 OSS 计算技术 [http://www.ossez.com/forum-54-1.html]的 Moodle 相关板块,在这里我们将会向你提供中文帮助。
特定平台的安装
注意 通常社区能够提供更多的相关信息。下面的内容可能没有经过验证,也有可能已经过时了,请结合上面的内容一同阅读。
- Windows installation
- Unix or Linux Installation
- Mac Installation
- Amazon EC2 Cloud Services Installation