开发者

How to install Rails application on ubuntu?

开发者 https://www.devze.com 2023-02-01 22:55 出处:网络
While installing, some errors are displayed. The command I am using is: sudo gem install rails --include-dependencies

While installing, some errors are displayed. The command I am using is:

sudo gem install rails --include-dependencies

or

sudo gem install rails --no-rdoc --no-ri

In both cases, it is the same error. I think my rubygems may not be installed properly?

ERROR: Loading command: install (LoadError) no such file to load -- zlib ERROR: While executing gem ... (NameError) uni开发者_JS百科nitialized constant Gem::Commands::InstallCommand

I have installed ruby-1.9.2-p0 and rubygems-1.3.7

One more thing: Do I have to cd into the ruby or rubygems directory and then install rails or can I do it from default directory?


Open command prompt and please let us know the results

verify Ruby version

ruby -v

verify gem version

gem -v

Use command

gem install rails

verify the rails version

rails -v


$ sudo apt-get install ruby1.9 gem1.9


checkout below mentioned link that would help you to install rails3 using rvm on ubuntu box http://www.jaikeerthi.in/2010/11/install-rails-ubuntu/


You have to install zlib1g and zlib1g-dev

sudo aptitude install zlib1g zlib1g-dev

Some GEMs compile some binaries at installation time and need other libraries (such as zlib) be installed on the system.


Assuming that you are installing on Ubuntu 14.04...

First install rbev to pick a Ruby version for your application.

sudo apt-get update

Install the rbenv and Ruby dependencies with apt-get:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Now let's install rbenv

 cd

git clone git://github.com/sstephenson/rbenv.git .rbenv

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile

source ~/.bash_profile

And now let's install Ruby:

rbenv install -v 2.2.3
rbenv global 2.2.3

Verify that Ruby is installed with this command:

ruby -v

Install bundler to manage gems:

gem install bundler

Now we are set to install Rails:

gem install rails

Then run

rbenv rehash

It's good to verify if the Rails is installed properly:

rails -v

Make sure to install database and Javascript runtime afterwards...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号