Dear friends,
I installed RoR using the "Agile Web Development with Rails, 3rd
edition" recipe in my Ubuntu 9.04. Apparently all has been installed
well, but when I try to create a new application (page 35) using the
command "rails demo", I get the message "The program 'rails' is
currently not installed. You can install it by typing: sudo apt-get
install rails. bash: rails: command not found."
It seems that Ubuntu not find Rails... and I typed the command "export
PATH=/var/lib/gems/1.8/bin:$PATH.
Sorry, I am RoR and Ubuntu novice.
Thank you in advance!!
I use this script to install the lamp stack, mysql
ruby and rails (on ubuntu 9.10, not sure if any diffs on 9.04).
It assumes that there is a folder ~/downloads. Don't just copy and
paste it, you have to work out where the lines have been folded by the
mailer
# this installs the lamp stack, the ^ is important. See
https://help.ubuntu.com/community/Tasksel
sudo apt-get install lamp-server^
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
# this derived from
http://www.hackido.com/2009/04/install-ruby-rails-on-ubuntu-904-jaunty.html
# bits for building stuff
cd ~
sudo apt-get install build-essential
# ruby and mysql stuff, this assumes that the lamp stack with mysql
has already been installed
sudo apt-get install ruby ri rdoc libmysql-ruby ruby1.8-dev irb1.8
libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off
libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8
rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8
libhtml-template-perl
wget -N -P ~/downloads
http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xvzf ~/downloads/rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb
cd ..
rm -rf rubygems-1.3.5
echo "making symlinks - not sure if this will always be necessary,
must be done if gem -v does not work"
sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
# rails latest version
sudo gem install rails
Are you sure the rails executable file is in that path?
Did you try /var/lib/gems/1.8/bin/rails first?
Try not to rely on "magic" solutions but to understand what's really
happening. If the error says that "rails" is not a program, make sure
that it is installed first, then make sure it is in your path.
Hi Luiz,
I think the problem is that when you use Synaptic/aptitude to install rubygems, rails (v2.2 available from the repo) needs to be installed the same way.
I would suggest you follow Colin’s reply and try installing rubygems from source. Prior to that, libyaml-ruby and libzlib-ruby need to be installed from Synaptic. Once installed, ‘gem1.8’ will be in /usr/bin. Rename it to ‘gem’ and you are good to ‘gem install rails’.
I'm sorry to disagree with this approach, but I think it has a few drawbacks.
The best way I've found to install RoR environment on a Debian-like
distro is to install rubygems form apt-get/aptitude,
then install every gem with the gem command, this will be nicer with
gems update, since debian-like distros are pretty conservatives for
package updates and, generally, gems releases will be faster that the
distros releases.
One more thing, renaming gem1.8 to gem will break the distro's
policies, I'd recommend you to add an alias or to set up
/etc/alternatives (I'm not a Debian-like user, so I cannot tell you
how to do this, but you should google that)
OK but... I forgot to ask... before any try to solve my problem, I
think I have to uninstall RoR and then reinstall. How to do that? I
found something but as I'm a novice, it's difficult to choose a path.
Thank you for all that gently replied!
Usually when you export the path it should work. Check again that the
path corresponds to the gems path where you have the Rails gem. You
can use this command:
gem env
to gather more info about the gem environment and you should be able
to see the GEM_PATH, so check if in that path you have the Rails gem.
It is a boring problem but it is usually a path issue.
Have you installed another version of Ruby? Reply with you gem env
output to get more help.
I had the same problem as you. Namely, I struggled with installing RoR
development environment on my Ubuntu box.
I found a nice and EASY solution: use BitNami RubyStack, which is
available at Ruby Cloud Hosting, Ruby Installer, Docker Container and VM. Everything
is included, and it works out of the box. I highly recommend it.
Hmmmm, thank you. But I saw that BitNami install Mysql and PHP. Well,
I thought to use Firebird but it is more probable that I will use
Postgre and RoR. Is it possible?
Hi friends!
My problem has gone!
With a little shame because it's so easy... :-).
I received a tip to put "PATH=/var/lib/gems/1.8/bin:$PATH" in my
file .profile with gedit. And all goes well!
Thank you to everybody!
Oh yes, it possible to use Postgresql with the BitNami package. But
the downside is that you still end up having MySQL around. :-/
First you install the BitNami Rubystack with MySQL, then you use
Postgresql add-on.