edX 学习二:搭建 edX 平台

折腾了好几天,试过官方的 edX Developer StackedX Ubuntu 12.04 installation 两种方法没成功之后,终于按照 Quick Start to working with the edX Platform 这篇文章搞定,缺点就是不是最新的 edX 环境。

按照官方文档,在安装时主要会卡在两个地方(主要还是网络问题):

  • 安装 MongoDB(这个地方时间长点还可以执行下去,大概 10 几个小时)

  • 安装 ORA(花了一天一夜也没执行下去)

最后这两种方法都放弃,使用了直接下载 box 的方式。就是 box 文件下载需要点时间,我家里 20M 光纤用了 4 个小时左右。

使用 MITxVM distribution 安装

The MITxVM box is built on a base Ubuntu 12.04LTS distribution. The edX platform runs using django/python, and is served via gunicorn and nginx. Virtual Box is used to provide a host-only network, 192.168.42.*. The four edX services listen on eth0 on four separate IP addresses. The system uses mysql for the main database, and mongo for Studio.

Installed repos include edx-platform, xqueue, xserver, latex2edx, edx-ora, ease.

1. 安装 Vagrant 和 VirtualBox

2. 下载示例课程 edx4edx_lite 到 data 目录

# mkdir mitx-vagrant
# cd mitx-vagrant
# mkdir data
# cd data
# git clone https://github.com/mitocw/edx4edx_lite.git

3. 在 mitx-vagrant 启动虚拟机。

下载 mitxvm-edx-platform-02sep13a.box (large file: 3.8 GB)

md5sum: 7d3671a92f8ba4f8e6b54db91a90bc91

# vagrant init mitxvm mitxvm-edx-platform-02sep13a.box 
# vagrant up

...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /opt/mitx-vagrant
==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it	

4. 访问站点

登录账号:

  • email “xadmin@mitxvm.local“,password “xadmin”。
  • 如果要创建用户,激活用户需要使用 “xmanage” 命令,否则无法收到激活邮件。
  • 登录以后,可以看到 edx4edx_lite 这个示例课程。

5. 虚拟机管理

MITx virtual machine Vagrant box 使用 xmanage

# vagrant ssh -- xmanage help

ommands available:

restart-lms      - restart the LMS (for vagrant boxes, running at http://192.168.42.2)
                   This will force re-loading of course data
restart-cms      - restart the CMS (aka the Studio system)
restart-edge     - restart the Edge server (part of the Studio system)
restart-preview  - restart the Preview server (part of the Studio system)

restart-xqueue   - restart the xqueue main system
restart-consumer - restart the xqueue consumer
restart-xserver  - restart the xserver (python code grader)

logs <appname>   - view last 100 lines of log file for <appname>
                   appname should be one of lms, cms, edge, preview, xserver, xqueue

activate <user>  - activate user specified by username <user>
setstaff <user>  - make user (specified by username <user>) into staff

update-mitx      - update mitx system code (use with care!)
update           - update this management script (from central repo)
help             - print out this message, as well as local NOTES.txt file
            

5. 问题

  • Vagrant error : Failed to mount folders in Linux guest

      # vagrant ssh
      # sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
      # vagrant reload
      
    
  • Unknown command: ‘activate_user’

    这里发现 xmanage activate 命令不可用,其它命令正常。在 Google Groups 上看到这个问题,但没解决。如果遇到以下错误,这里可以通过 admin 登录来激活。

      $ xmanage activate batizhao
      activating user batizhao
      Unknown command: 'activate_user'
      Type 'django-admin.py help' for usage.
      To complete the activation, please logout then log back in