Ruby on Rails install on ubuntu fail. I can has help? - ruby-on-rails

I am trying to install Ruby, RubyGems, and the Ruby on Rails framework so that it will play nicely with my system. I am having issues with my installation. Could somebody help me? Here are the details of my system and how I went about installation.
Currently I am running ubuntu 10.10 using the Linux Kernel 2.6.35-28-generic. My server is Apache 2.2.16 and I use MySQL 5.1.49.
So, I went to my synaptic package manager and selected the following packages to download:
* ruby1.8 – installs Ruby 1.8.4
* libmysql-ruby – additional libraries to access MySQL
* libruby1.8-dbg – debugging library
* ri – Ruby Interactive Reference
* ruby1.8-dev – header files for building extensions
* rails – Ruby On Rails framework
Once that ran successfully, I downloaded rubygems from http://rubyforge.org/projects/rubygems/. Then I unpacked it, got in the terminal, ran a cd to get in the directory of the newly downloaded rubygems directory, and typed 'sudo ruby setup.rb' That ran with no problem and RubyGems 1.8.5 was installed. Then I ran 'sudo gem install rubygems-update' with no problem.
But when I ran 'sudo gem install rails –include-dependencies' I got the following output:
Fetching: activesupport-3.0.8.gem (100%)
Fetching: rails-3.0.8.gem (100%)
Successfully installed activesupport-3.0.8
Successfully installed rails-3.0.8
2 gems installed
Installing ri documentation for activesupport-3.0.8...
Installing ri documentation for rails-3.0.8...
File not found: lib
ERROR: While generating documentation for rails-3.0.8
... MESSAGE: exit
... RDOC args: --ri --op /var/www/testingwww/rubygems-1.8.5/nclude-dependencies/doc/rails-3.0.8/ri lib --title rails-3.0.8 Documentation --quiet
When I run 'rails -v' I get 'Rails 3.0.8' so it seems to have installed despite the error. But when I try to make a rails app by typing 'rails ./helloWorld' I get the manual page for the rails keyword.
I have looked around for two days now on how to fix this issue, but can't seem to figure it out. Does anybody know how to fix this?

Rails 3 requires version 1.8.7 or 1.9.2.
I'd recommend using RVM to manage your Ruby installation and environments. It will really help to get you going quickly and is simple. It's as simple as
curl -L https://get.rvm.io | bash
to install RVM and then rvm install 1.9.2 will get you going.
Have a look at https://rvm.io for more information.

In addition to Matthew's good Answer, I don't know why you're doing rails ./helloWorld. To generate a new app in Rails 3, you should do rails new helloWorld.

If you need a complete guide to getting rolling with Rails under Ubuntu, you can find a short guide here: http://blog.dcxn.com/2011/06/21/rolling-with-rails-3-on-ubuntu-11-04/
The gist is:
Install RVM (The Ruby version manager)
Install Rails from gem
Get going with Rails
It's a simple process but there are a few things you need to do for it to be completely smooth like making sure you have the pre-requisites for rvm installed via apt before install rvm.
Good luck!

Related

What's the best way to run a RoR project on my localhost

I have a friend's website code, which is in Ruby on Rails.
I have tried to install RoR on my Mac using instructions at gorails.com
OS : Mac Mojave
ruby -v : ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin18]
rails -v :
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem railties (>= 0.a) (Gem::GemNotFoundException)
from /usr/local/bin/rails:22:in `<main>'
What I tried : I installed ruby, and then rails, using gorails tutorial, and kept getting errors stating version number mismatch.
Keep in mind that creating a new app, worked, but trying to run this existing code is a problem.
So then I uninstalled everything and updated the version using rvm, and since then I am getting this error.
When I cd into the webapp folder and run bundle install, I get errors, such as:
zsh: /Users/abc/.rvm/gems/ruby-2.2.3#hs/bin/bundle: bad interpreter: /Users/abc/.rbenv/versions/2.5.3/bin/ruby: no such file or directory
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
RVM are available at rvm.io/packages/openssl.
This project uses a PostgreSQL database, which I have setup already.
If required, I can share the gemfile of this project too.
What is the best way to get this project working?
Am I missing something crucial?
You can't run RVM and RBENV on the same machine. Pick one and remove the other. You're probably best to uninstall both and then pick one, start over.
Uninstall RBENV instructions here or in your case probably brew uninstall rbenv
Uninstall RVM see How can I remove RVM (Ruby Version Manager) from my system?
Close all terminals and then start a new one.
Install RVM see https://rvm.io/rvm/install
Then go to your project, make sure you have the correct ruby version needed by your project. If not, you will need to install with rvm install 2.5.1 for example.
Then run
rvm use 2.5.1 #or some other version
Then you should be able to run bundle install
The rest of the instructions in your link should be ok.

Rails fails to install

I'm trying to install rails on a Mac but am getting some strange errors:
sudo gem install rails
Successfully installed rails-3.2.3
1 gem installed
Installing ri documentation for rails-3.2.3...
file 'lib' not found
Installing RDoc documentation for rails-3.2.3...
file 'lib' not found
rails --version
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
Anyone got any ideas what I'm doing wrong?
The solution to this problem seems to have been that I already had an install of rails in /usr/bin which was in my PATH first.
This "install" was simply a shell script which gave the output above saying it's not installed.
I removed this by hand and reinstalled everything - after some messing around fixing random errors that it produced and a small edit to my PATH, it seems to be working now.

Ubuntu not detecting Rails installation

I recently reinstalled Ubuntu 12.04 after the upgrade package broke my last install. I've been following this walkthrough to restore Rails and continue working on my existing projects. I've already installed rvm, all the packages listed by rvm requirements, and all my development tools (e.g., vim, git, etc.).
However, I get stuck on the rails command, whether I'm trying rails (n,s,g), and returns the error message
$ rails
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I've already done the following:
$ gem install rails
Successfully installed rails-3.2.3
1 gem installed
But based on the following checks, it still hasn't installed.
$ which gem
/home/eyoung/.rvm/bin/gem
$ which ruby
/home/eyoung/.rvm/bin/ruby
$ which rails
(no output)
I'm at my wit's end; any ideas on what's going on?
Extra details:
OS: Ubuntu 12.04 x86_64
Packages: RVM installed Ruby 1.9.3p194 w/ openssl & Rubygems
ruby and gem are on the system $PATH
EDIT: By request,
$ gem list rails
*** LOCAL GEMS ***
rails (3.2.3)
As rails gem was installed and all the other paths look correct, you need to set rvm to use that ruby as your default version. It will set all the paths correctly so you can use your gems and rails command.
rvm use 1.9.3 --default
I updated to 12.04 as well, and ran into the issue as well. After quite a bit of head scratching, I decided to reinstall rvm.
Referencing a previous question.

Accidentally nuked my Rails installation - what do I need to do to recover?

I seem to have broken my Rails installation on Mac OS 10.6.7. Here's the status:
MacBook-Pro$ which ruby
/usr/local/bin/ruby
MacBook-Pro$ which gem
/usr/local/bin/gem
MacBook-Pro$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
MacBook-Pro$ gem -v
1.8.5
I use homebrew to manage these packages:
MacBook-Pro$ brew list
distribute libyaml ossp-uuid python sqlite
gdbm mongodb pip readline wget
git mysql postgresql ruby
My ~/.profile has this:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
Before this ordeal started, I used
sudo gem install rails
I just ran it again and got this:
MacBook-Pro$ sudo gem install rails
Password:
Successfully installed rails-3.0.9
1 gem installed
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
file 'lib' not found
But when I run:
which rails
I get nothing in return.
I think at some point I went into /usr/bin/ which is I think the "which rails" pointed to in order to see what was in the rails file. And I think I may have deleted this file. (Yes, I'm an idiot.)
It looks like I somehow need to connect the location of the rails gem with the OS so that it knows it's there? Or can/should I nuke the whole installation? I'd appreciate any guidance!
This might be a good time to switch to using rvm.
https://rvm.io
Try with gem install with -V option, maybe you'll see where it's installing everything. It installs rails for me in /Library/Ruby/Gems/1.8/gems/rails-3.0.9/bin/rails and /usr/bin/rails. It's hacky but you could copy rails from the first location to the second if it doesn't automatically add for you. Best idea is probably to nuke it and start fresh.

Vanishing Ruby Gems

I'm using Ubuntu 8.10 and I installed Ruby and Ruby on Rails following the directions on this site. The exact directions I followed are no longer there as it appears the rubyonrails.org wiki has changed recently. But I installed it the long way. Installed Ruby, then Gems, then installed Rails using "gem install rails".
I haven't really messed with Rails for a while, and I tried to use the Gem command today and...
The program 'gem' can be found in the following packages:
* rubygems1.8
* rubygems1.9
Try: sudo apt-get install <selected package>
bash: gem: command not found
That's just weird to me because I installed rails using the gem command. I have been seaching my computer for the gems binary so I could create a link to it in the bin directory but I can't find it. I know it's installed becaues when I run 'script/server' and go to localhost:3000 in a browser I get the following version information:
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
Anyone know how I can get my gem command working again? Thanks for any help.
Note: I am new to Rails and fairly new to Ubuntu and Linux in general.
Did you install rubygems from apt-get? If yes, maybe you should try to remove it and install it from source.
Here is another article on installing Rails on Ubuntu:
http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html
Essentially, you can install Ruby from apt-get or source, but it's recommended to install rubygems from source.
You could look to see if it's in:
/usr/bin/gem1.8
if it is, then symlink /usr/bin/gem to it:
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
BTW, here's another tutorial on how to install rails on Ubuntu 8.10:
http://articles.slicehost.com/2009/1/6/ubuntu-intrepid-ruby-on-rails

Resources