- 論壇徽章:
- 0
|
Ubuntu下使用RVM 安裝Rails
使用Ubuntu版本:11.04
1.安裝RVM
Java代碼- 1.bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
復(fù)制代碼 2.安裝Ruby
RVM安裝完成后可以使用
Java代碼- 1.rvm requirements
- 命令查看安裝可選項(xiàng)。
- 執(zhí)行rvm install 1.9.2
復(fù)制代碼 Java代碼- 1.ubuntu:~$ rvm install 1.9.2
- 2.Fetching yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/archives
- 3. % Total % Received % Xferd Average Speed Time Time Time Current
- 4. Dload Upload Total Spent Left Speed
- 5.100 460k 100 460k 0 0 51442 0 0:00:09 0:00:09 --:--:-- 63694
- 6.Extracting yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/src
- 7.Configuring yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.
- 8.Compiling yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.
- 9.Installing yaml to /home/wenpeng/.rvm/usr
- 10.Installing Ruby from source to: /home/wenpeng/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
- 11.
- 12.ruby-1.9.2-p290 - #fetching
- 13.ruby-1.9.2-p290 - #downloading ruby-1.9.2-p290, this may take a while depending on your connection...
- 14. % Total % Received % Xferd Average Speed Time Time Time Current
- 15. Dload Upload Total Spent Left Speed
- 16.100 8604k 100 8604k 0 0 24844 0 0:05:54 0:05:54 --:--:-- 30418
- 17.ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/wenpeng/.rvm/src/ruby-1.9.2-p290
- 18.ruby-1.9.2-p290 - #extracted to /home/wenpeng/.rvm/src/ruby-1.9.2-p290
- 19.ruby-1.9.2-p290 - #configuring
- 20.ruby-1.9.2-p290 - #compiling
- 21.ruby-1.9.2-p290 - #installing
- 22.Retrieving rubygems-1.8.17
- 23. % Total % Received % Xferd Average Speed Time Time Time Current
- 24. Dload Upload Total Spent Left Speed
- 25.100 246k 100 246k 0 0 50303 0 0:00:05 0:00:05 --:--:-- 60119
- 26.Extracting rubygems-1.8.17 ...
- 27.Removing old Rubygems files...
- 28.Installing rubygems-1.8.17 for ruby-1.9.2-p290 ...
- 29.Installation of rubygems completed successfully.
- 30.ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
- 31.ruby-1.9.2-p290 - #importing default gemsets (/home/wenpeng/.rvm/gemsets/)
- 32.Install of ruby-1.9.2-p290 - #complete
-
復(fù)制代碼 設(shè)置1.9.2 作為默認(rèn)的Ruby版本
Java代碼- 1.rvm use 1.9.2 --default
復(fù)制代碼 報(bào)錯(cuò)提示
Java代碼- 1.RVM is not a function, selecting rubies with 'rvm use ...' will not work.
-
復(fù)制代碼 解決方法
執(zhí)行
Java代碼- 1.echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
復(fù)制代碼 然后重啟Terminer再執(zhí)行
Java代碼這里還可以直接把這段命令寫進(jìn)/etc/profile
Java代碼- 1.ubuntu:~$ rvm use 1.9.2 --default
- 2.Using /home/wenpeng/.rvm/gems/ruby-1.9.2-p290
復(fù)制代碼 安裝rails 需要的lib
Java代碼- 1.sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
- 2.
- 3.sudo apt-get install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev
復(fù)制代碼 Java代碼如果出現(xiàn)問題的話需要remove掉ruby然后重新安裝
Java代碼- 1.rvm remove ruby
- 2.rvm install 1.9.2
- 3.rvm use 1.9.3 --default
- 4.gem install rails
-
復(fù)制代碼 如果在啟動rails server的過程中提示No JavaScripts Run time 有兩個(gè)解決方法
解決方法1:- Adding the following gems to my Gemfile solved the issue:
- gem 'execjs'
- gem 'therubyracer'
- Then of course:
復(fù)制代碼 這里需要先bundle install therubyracer
然后bundle install
解決方法2:
安裝nodejs
lijg@lijg-desktop:~/workruby/helloapp$ sudo apt-cache search nodejs
[sudo] password for lijg:
coffeescript - interpreter and compiler for the CoffeeScript language
nodejs - Node.js event-based server-side javascript engine
nodejs-dbg - Node.js event-based server-side javascript engine (debug)
nodejs-dev - Development files for Node.js |
|