canvas lmsのインストール:compileが通るまで

  1. canvas lmsのダウンロード via git
    # git clone https://github.com/instructure/canvas-lms.git canvas
    Cloning into 'canvas'...
    remote: Counting objects: 182267, done.
    remote: Compressing objects: 100% (173/173), done.
    remote: Total 182267 (delta 59), reused 0 (delta 0)
    Receiving objects: 100% (182267/182267), 122.70 MiB | 9.45 MiB/s, done.
    Resolving deltas: 100% (132453/132453), done.
    
    # git branch --set-upstream stable origin/stable
    The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
    Branch stable set up to track remote branch stable from origin.
    # git branch --set-upstream-to stable origin/stable
                                                                            
  2. rubygem-bundlerのインストール
    # yum install rubygem-bundler
                                                                    
    この状態で、canvas lmsのインストールを開始すると次のエラーが場合がある。
    # bundle install --without mysql
    Bundler version 1.6.0 is required; you're currently running 1.3.1. Maybe try `gem install bundler -v 1.7.2`, or `gem uninstall bundler -v 1.3.1`.
                                                                    
    このときは、素直にバージョンをあげます。
    # gem install bundler -v 1.7.2
    Fetching: bundler-1.7.2.gem (100%)
    Successfully installed bundler-1.7.2
    Parsing documentation for bundler-1.7.2
    Installing ri documentation for bundler-1.7.2
    1 gem installed
                                                                    
  3. compile:その1
    rootでコンパイルすると、すごく怖いメッセージがでます(次は怖いメッセージ)。
    # bundle install --without mysql
    Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
    installing your bundle as root will break this application for all non-root
    users on this machine.
                                                            
    ただ、無視して作業をしてみました。次のエラーがでました。
    Gem files will remain installed in /usr/local/share/gems/gems/json-1.8.1 for inspection.
    Results logged to /usr/local/share/gems/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
    An error occurred while installing json (1.8.1), and Bundler cannot continue.
    Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
                                            
    このときは次をいれます(gccはjsonをコンパイルするために必要です)。
    # yum install gcc
    # gem install json -v '1.8.1'
    Building native extensions.  This could take a while...
    Successfully installed json-1.8.1
    Parsing documentation for json-1.8.1
    Installing ri documentation for json-1.8.1
    1 gem installed
                                            
  4. compile:その2上を終えたうえで再度コンパイル
    An error occurred while installing nokogiri (1.5.6), and Bundler cannot
    continue.
    Make sure that `gem install nokogiri -v '1.5.6'` succeeds before bundling.
                                    
    なので、次の作業(作業にはlibxml2-develとlibxslt-develが必要です)
    # yum install libxml2-devel
    # yum install libxslt-devel
    # gem install nokogiri -v '1.5.6'
    Building native extensions.  This could take a while...
    Successfully installed nokogiri-1.5.6
    Parsing documentation for nokogiri-1.5.6
    Installing ri documentation for nokogiri-1.5.6
    1 gem installed
    
    # yum install gcc-c++
    # gem install eventmachine -v '1.0.3'
    Building native extensions.  This could take a while...
    Successfully installed eventmachine-1.0.3
    Parsing documentation for eventmachine-1.0.3
    Installing ri documentation for eventmachine-1.0.3
    1 gem installed
                     
  5. compile:その3
    このあたりで、やっとpostgresqlがないと作業が進まなくなります。
    # yum install postgresql postgresql-lib postgresql-server
    # yum install postgresql-devel
    # gem install pg -v '0.15.1'
    Building native extensions.  This could take a while...
    Successfully installed pg-0.15.1
    invalid options: -f fivefish
    (invalid options are ignored)
    Parsing documentation for pg-0.15.1
    Installing ri documentation for pg-0.15.1
    1 gem installed
                    
    sqliteも必要です。
    # yum install sqlite-devel
            
  6. compile:その4
    # bundle install --without mysql
    
    Your bundle is complete!
    Gems in the group mysql were not installed.
    Use `bundle show [gemname]` to see where a bundled gem is installed.
    
    終わったようです。
 

canvas lmsのインストール:起動させるまで

まず、起動させるためのコマンドを打ちます。
# bundle exec rails server
すごく文句を言われます。そのため、次の作業が必要。
  1. java runtime
    次のエラーが出た時の対処です。
    # bundle exec rails server
    Ruby 2.0 support is untested
    Ruby 2.0 support is untested
    Ruby 2.0 support is untested
    /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
                                                    
    必要なものをいれます。
    # yum install jre java-1.6.0-openjdk
    
    # java -version
    java version "1.7.0_65" OpenJDK Runtime Environment (rhel-2.5.1.2.el7_0-x86_64 u65-b17) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
    ただ、これだけではなぜかruntimeを認識しません。。。。
    # bundle exec rails server
    Ruby 2.0 support is untested
    Ruby 2.0 support is untested
    Ruby 2.0 support is untested
    /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
                                                                                    
    似た案件で困っている人がいるので真似してnode.jsをいれます。centos 7では標準のパッケージではないので、Enterpriseから取得できるようにします。
    # yum install epel-release
    # yum install nodejs
                                                                    
  2. activesupportに関するエラー
    /usr/local/share/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
                                                            
    gemコマンドでなく、yumでインストールしますが解消しません。。。。
    # yum install -y rubygem-nokogiri                                
    こんなときは、nokogiriを消して入れなおします(消すときはバージョンも指定するらしい)。
    # gem uninstall nokogiri -v '1.5.6'
                            
  3. /usr/local/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (cannot load such file -- pg_ext) (LoadError)
                    
    このときは、
    # gem install pg
    # gem install activerecord-postgresql-adapter
            
 

canvas lms: postgresql

# for config in amazon_s3 database delayed_jobs domain file_store outgoing_mail security external_migration; do cp config/$config.yml.example config/$config.yml; done
 
PAGE TOP