搭建Open edX经验总结

Open edX系统比较庞大复杂,涉及到开源工具和数据源比较多,由于GFW一些数据源访问不了,翻墙网速又比较慢,总之国内配置Open edX系统坑比较多,本文大致介绍在不翻墙的情况如何成功安装运行Open edX系统。

首先,遇到出错的情况要冷静不要着急,仔细分析出错信息,其中肯定有不熟悉的内容,先找来学习出错的是什么模块或工具,然后再根据出错信息判断出错的原因,搜索解决办法,Open edX已经得到很多公司或学校大量实际使用了,笔者想当然的认为搭建运行起来分分钟就能搞定,谁知搞两天没有头绪,过于急躁,没有抱着学习的心态冷静学习和解决问题,结果反复尝试安装不同的方式浪费了很多时间,以致花了一周时间才搞定。

笔者在Ubuntu12.04 64位server、win7和mac上都有过安装尝试,在mac装fullstack坑最少,在win7上的坑主要是破解版的问题有uxtheme.dll造成virtualbox虚拟机无法启动,还原成原版的文件就可以了,总是装fullstack相对比较容易(其中也有一个GFW问题下文会提到),在ubuntu12.04上装遇到的问题比较,下面主要介绍Ubuntu12.04 64位server安装遇到的问题。

安装指南见https://github.com/edx/configuration/wiki/edX-Ubuntu-12.04-64-bit-Installation

其实One step installation只要下面两句脚本

export OPENEDX_RELEASE=named-release/cypress
wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/sandbox.sh -O – | bash

如果顺利的话应该直接可以安装成功,事实上却会遇到很多问题,下面就笔者遇到的问题简要列举分析一下:

  • gem not found 可以通过sudo apt-get install rubygems来解决
  • AppArmor 的问题

failed: [localhost] => {“failed”: true}
msg: * Starting AppArmor profiles * AppArmor not available as kernel LSM.
…fail!

参见https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701714

找到apparmor=0改为1

Adding “apparmor=1 security=apparmor” to GRUB_CMDLINE_LINUX_DEFAULT in
/etc/default/grub and running “sudo update-grub” fixed this issue.

修改后服务器会启动很慢,耐心等待。搞定

后来重启还是会有卡住的情况,重启了几次才又能进入系统,不知道什么原因?

  • mysql-server-5.5的出错信息,不过可以忽略,不解决也能顺利安装

failed: [localhost] => {“changed”: true, “cmd”: “dpkg -L mysql-server-5.5″, “delta”: “0:00:00.013109″, “end”: “2015-09-08 16:05:41.976396″, “rc”: 1, “start”: “2015-09-08 16:05:41.963287″, “warnings”: []}
stderr: Package `mysql-server-5.5′ is not installed.
Use dpkg –info (= dpkg-deb –info) to examine archive files,
and dpkg –contents (= dpkg-deb –contents) to list their contents.
…ignoring
解决办法
sudo rm /var/lib/mysql -rf
sudo apt-get install mysql-client-5.5 mysql-server-5.5

  • https://rubygems.org/无法访问的情况会多次出现

failed: [localhost] => {“changed”: true, “cmd”: “bundle install –binstubs”, “delta”: “0:00:16.114500″, “end”: “2015-09-08 16:07:48.999750″, “rc”: 5, “start”: “2015-09-08 16:07:32.885250″, “warnings”: []}
stdout: Fetching gem metadata from https://rubygems.org/………..
Fetching gem metadata from https://rubygems.org/..

Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer – SSL_connect (https://rubygems.org/gems/addressable-2.3.5.gem)
An error occurred while installing addressable (2.3.5), and Bundler cannot
continue.
Make sure that `gem install addressable -v ’2.3.5′` succeeds before bundling.

FATAL: all hosts have already failed — aborting

PLAY RECAP ************************************************************
to retry, use: –limit @/home/ubuntu/edx_sandbox.retry

localhost : ok=174 changed=34 unreachable=0 failed=1

sudo find ‘Gemfile’ /edx -r
找到Gemfile
将/edx/app/edxapp/edx-platform/Gemfile中的https://rubygems.org/ 改为http://rubygems.org/,但会造成edx-platform在git checkout出错,提示modification无法通过checkout,我用的粗暴的办法:

grep “bundle install –binstubs” /var/tmp/configuraton -r

找到对应的脚本文件位置,将checkout edx-platform的那一段脚本注释掉,因为上次安装已经checkout过了。

安装forum的部分也会遇到类似的问题,解决方法以此类推

尤其需要提到的是在mac和win7上安装fullstac是执行vagrant plugin install vagrant-hostsupdater也会出现类似错误,解决办法是vagrant plugin install vagrant-hostsupdater –plugin-source http://rubygems.org

  • sass的问题

先是出现/bin/sh: 1: sass: not found

sudo gem install compass 可以解决
接着又出现`to_specs’: Could not find sass,一查sass只是编译css的工具无伤大雅,直接在playbooks里找到脚本注释掉OK啦,哈哈

  • msg: file (/etc/update-motd.d/51-cloudguest) is absent的问题

TASK: [aws | update the ssh motd on Ubuntu] ***************************
changed: [localhost] => (item=/etc/update-motd.d/10-help-text)
changed: [localhost] => (item=/usr/share/landscape/landscape-sysinfo.wrapper)
failed: [localhost] => (item=/etc/update-motd.d/51-cloudguest) => {“failed”: true, “item”: “/etc/update-motd.d/51-cloudguest”, “path”: “/etc/update-motd.d/51-cloudguest”, “state”: “absent”}
msg: file (/etc/update-motd.d/51-cloudguest) is absent, cannot continue
changed: [localhost] => (item=/etc/update-motd.d/91-release-upgrade

网上资料说This file /etc/update-motd.d/51-cloudguest is not present on default builds of Ubuntu, it is only present on AWS builds.

一句sudo touch /etc/update-motd.d/51-cloudguest搞定

https://github.com/edx/configuration/issues/2242

  • 破解版win7上vagrant up时会出现VirtualBox虚拟机无法启动的问题

D:\TDDownload\edx>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
> default: Importing base box ‘edx’…
> default: Matching MAC address for NAT networking…
> default: Setting the name of the VM: edx_default_1441899042903_39973
> default: Clearing any previously set network interfaces…
> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
> default: Forwarding ports…
default: 22 => 2222 (adapter 1)
> default: Booting VM…
> default: Waiting for machine to boot. This may take a few minutes…
The guest machine entered an invalid state while waiting for it
to boot. Valid states are ‘starting, running’. The machine is in the
‘poweroff’ state. Please verify everything is configured
properly and try again.

If the provider you’re using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you’re using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you’re using
is not properly configured. This is very rarely a Vagrant issue.

手动启动VirtualBox虚拟机会出现如下问题
Unable to load R3 module C:\Program Files\Oracle\VirtualBox/VBoxDD.DLL (VBoxDD): GetLastError=1790 (VERR_UNRESOLVED_ERROR).
解决办法见http://jingyan.baidu.com/article/ab69b270bb7b2a2ca6189f6d.html 实际上是C:\Windows\System32\uxtheme.dll这个文件被修改了,换成原版的就好了

OK,经过九九八十一难重要装起来了,在服务器上直接wget http://127.0.0.1无法连接,参照https://github.com/edx/configuration/wiki/edX-Managing-the-Full-Stack#unable-to-connect-to-the-lms 执行如下几个命令就OK了。

sudo service nginx status
sudo service nginx start
sudo /edx/bin/supervisorctl status edxapp:
sudo service nginx stop
sudo service supervisor stop
sudo service supervisor.devpi stop
sudo pkill -u www-data
sudo service nginx start
sudo service supervisor start
sudo service supervisor.devpi start

终于把坑填平了,跑起来了

学生界面http://your_ip/
教师课程内容编辑界面http://your_ip:18010

The latest version of fullstack has the demo course pre-loaded and dummy accounts, you can log in to the website as:

教师账号:staff@example.com / edx
verified@example.com / edx
audit@example.com / edx
学生账号:honor@example.com / edx

不过是英文版的,还可以改成中文的

1.切换至 edxapp 账户,并加载对应环境变量
sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/

2.修改 (*)ms.env.json(即lms,cms)
“LANGUAGE_CODE”: “zh-cn”,

3.手动更新assets
sudo /edx/bin/edxapp-update-assets-lms
sudo /edx/bin/edxapp-update-assets-cms

4.最后重启 edxapp:
sudo /edx/bin/supervisorctl restart edxapp:

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值