Ubuntu 10 Ruby 1.9 Rails 3 not working?

徘徊边缘 提交于 2019-12-03 16:43:49

log in as root user


remove old ruby

list ruby packeges

dpkg -l | grep ruby

then remove all ruby packeges

aptitude purge <package name>

if you have rvm installed

rvm remove all

then

rvm implode

or

rvmsudo rvm implode

install ruby

still logged in as root

install all of the necessary tools and libraries

apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

install rvm

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Then add this line as the last line in your .bashrc:

nano ~/.bash_profile

if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi

test RVM install

rvm notes

Next, you can begin ruby 1.9.2 installation by running

rvm install 1.9.2

The install will take up to several minutes and once it completes you have to set ruby 1.9.2 as the default version

rvm --default ruby-1.9.2

test your new ruby install ruby -v

install Rails 3

gem install rails

If you want to get a quick database up and running with sqlite, then you’ll need to sqlite3 and the libsqlite3-dev packages

apt-get install sqlite3 libsqlite3-dev

gem install sqlite3-ruby

create new app

rails new testapp

cd testapp

Make sure you are in your test app directory and run

rails s

Open your browser at http://localhost:3000

well, I believe this line:

-bash: /usr/bin/rails: /usr/bin/ruby1.8

means that you already have a /usr/bin/rails binary which is using ruby1.8 interpreter. Try moving it somewhere:

mv /usr/bin/rails /usr/bin/rails-1.8

then go to your project directory, and bundle install.

if you already have the rails bundled, try reinstalling the gems.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!