I installed Ruby 2.1.2 via rvm install 2.1.2, but Passenger uses 1.9.3 where my gems aren't available.
After I found the error, I tried to change the passenger_ruby to /usr/local/rvm/gems/ruby-2.1.2 but I got this error:
App 30033 stderr: *** ERROR ***: Cannot execute /usr/local/rvm/gems/ruby-2.2.2: Permission denied (13)
so I switched back to the normal Ruby version using:
passenger_ruby /usr/bin/ruby;
And with /usr/bin/ruby I get this error document:
http://jsfiddle.net/p3pde70d/
So how can I change the Ruby version to 2.1.x for Passenger?
Likely need to install bundler under the system ruby.
sudo gem install bundler
Though for running ruby 2.1.x, I recommend not using rvm or rbenv with a server setup. It's better to install a new version of ruby for that system. I typically will just compile the version I want from source. No idea what OS you're on, but for a debian system, can do something like this:
sudo apt-get install build-essential
That grabs all necessary software to compile things like ruby.
cd ~
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz # you may need to install wget through apt-get
tar xvf ruby-2.2.2.tar.gz
cd ruby-2.2.2.tar.gz
./configure
sudo make
sudo make install
Watch for errors on the configure step. It will tell you if you are missing any further dependencies. After it completes successfully, system ruby should be updated. From there install bundler :)
Related
I have a computer serves as a server. I have bitnami-gitlab stack on it. And now I want to install my rails app to this server. The thing confuses me, bitnami-gitlab has ruby interpreter and other apps (rails , gem, bundler etc.). Gitlab application uses git user on ubuntu. When I type;
sudo su git
which ruby
It gives me the directory of ruby which is inside of bitnami installation directory. Now, I want to install ruby, rails, apache and passenger to deploy my rails app. What is the appropriate way to do? I want to start my rails app as boot time. Should I install ruby to root user or my own user?
When I install ruby, will my gitlab application crahs?
Here is how I do it >
First, update apt-get:
sudo apt-get update
Then if you do not have it install Curl, for installing RVM
sudo apt-get install curl
Then run the appropriate RVM install there are multiple options like added rails, puma JRuby etc. check RVM website for more info. For just ruby run >
\curl -L https://get.rvm.io | bash -s stable
Now exit the shell session and start a new one
source ~/.rvm/scripts/rvm
RVM has its own requirements that can be auto installed by running >
rvm requirements
Now managing you ruby environments is easy and you can have multiple versions without making a mess.
To install any ruby version you need just run (x.x.x) version of the ruby>
rvm install x.x.x
To list versions you have installed run >
rvm list
Note also that now you can specify in your GEMFILE what version to use. Simply add ruby 'x.x.x' and rvm uses the version you specified as long as its already installed. Not having it raises error.
I just switched from Heroku to Amazon Web Services. Previously I ran all of my Rails command line commands using my Command Prompt with Ruby (from my Windows PC). However, after I logged into my Amazon Linux EC2 instance, and then went into the directory of my app I receive this error:
/usr/bin/rails:9:in `require': no such file to load -- rubygems (LoadError)
from /usr/bin/rails:9
when I try to run any commands like rails console.
I reviewed this question, but it doesn't seem like multiple Ruby libraries apply to me because
which -a ruby
only yields one location:
/usr/bin/ruby
Also, this question didn't seem to help as I haven't. When I tried typing in
rvm use 1.9.3
I receive this message:
-bash: rvm: command not found
It's my first time seeing a Linux environment, so any help would be appreciated. Thank you!
I was running into he same issue with the identical error message. From my EC2 instance, I noticed my ruby version was 1.8 (ruby -v). I rebooted the EC2 instance, and this caused Elastic Beanstalk to spin up a new EC2 instance and terminate the old one. The new instance was running 1.9.3, and I became unblocked. I hate magical solutions, but with the old instance terminated, there was no more triage I could do. Hope this helps.
-bash: rvm: command not found
This clearly says that rvm is not installed on your machine or if installed you haven't set the path properly.
Check path
Sometimes there is gem versioning pointing to the wrong one.
This happened with me sometime back----
Disregard! sudo bundle install was bundling 2.3.8 instead of 3.0.0.beta3. Fixed it by specifying the version in my Gemfile.
To make sure the compilation goes smoothly, scroll back in your terminal session and look at the list of prerequisite packages that should be installed (it’s probably best to cut and paste the whole lot of names to save yourself from typing errors).
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion
Now you can use use rvm to download, compile, and install Ruby.
1 rvm install 1.9.3
2 rvm use 1.9.3 --default
Guess it's more of a problem related to RVM and some weird linkage to osx's system ruby? (I installed RVM on a user level)
I have used gem install bundler.
Then run rvm install works fine
I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
Ubuntu now have rubygems as a package
For Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
sudo apt-get install rubygems-integration
On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:
sudo apt-get install ruby-dev
If on Ubuntu 14.04 try below
sudo apt-get install rubygems-integration
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
ruby setup.rb
That's it :)
If you install the full ruby application set with
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
For me in Ubuntu 20.04 I did 3 things to create a new Ruby and Rails app.
Install Ruby development version
sudo apt install ruby-dev
Install rails from gem
sudo gem install rails
Create new application
rails new blog
I got error while installing rails(sudo apt install rails) only, So I installed devlopment version. I got permission related error while not using Sudo as well while installing gems and rails.
For Ubuntu
First install ruby:
sudo apt install ruby
Note that : sudo snap install ruby will throw this error :
error: This revision of snap "ruby" was published using classic
confinement and
thus may perform arbitrary system changes outside of the security
sandbox that snaps are usually confined to, which may put your system at
risk.
If you understand and want to proceed repeat the command including
--classic.
Finally, download latest tar version of ruby gems here:
https://rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
sudo ruby setup.rb
is there any way to install Ruby 1.9.2 or 1.8.7 + Rails 3 on my debian squeeze?
You probably don't want to use RVM on a production machine. Its $PATH magic will break in non-obvious places (e.g. cron jobs), and you'll be up a creek.
You could simply build from sources and use checkinstall to create a .deb for yourself. Here's a tutorial for Ubuntu that should translate pretty well into debian.
First install rubygems, I think it's the only Debian package. Then (as Ruby gems):
rvm (install with it ruby 1.9.2, or Ruby version you want)
bundler
rails
And then you can manage application gems with Bundler.
Have you looked at railsready-debian-lenny (it is claimed to work on Squeeze too)? Don't forget to install dependencies pointed in readme.md
The steps below outlines installing Ruby On Rails as a normal user.
Check first if the user has sudo rights. To do this try executing a simple command
$sudo ls -a
[sudo] password for unlimit:
unlimit is not in the sudoers file. This incident will be reported.
If you see a message like above, you will need to add the user to the sudoer file, this can be done by
$echo 'unlimit ALL=(ALL) ALL' >> /etc/sudoers
Check if you have ruby installed. Execute the command below
$ruby -v
-[bash]: ruby:command not found
If you see something like this, this means ruby is not installed. Install it
$sudo apt-get install ruby
Install additional libraries
$sudo apt-get install build-essential
$sudo apt-get install curl
$sudo apt-get install libssl-dev
Install rvm
$curl -L get.rvm.io | bash -s stable
Set the rvm path
$source $HOME/.rvm/scripts/rvm
You should add this to the .bashrc file.
Fetch the latest rvm and reload it
$rvm get head && rvm reload
Install ruby 1.9.3
$rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm.usr
I needed to install the readline lib
$sudo apt-get install libreadline-dev
Get the rails gem
$gem install rails -v 3.2.3
Check if you have rails
$rails -v
Rails 3.2.3
Get the readline package
$rvm pkg install readline
Get sqlite3
$sudo apt-get install sqlite3 libsqlite3-dev
You are all set to create your first rails app
$rails new app HelloWorld
You can find more info http://unlimit.in/installing-ruby-on-rails-on-debian.html
The best way to install Ruby and any Gems you like is with RVM. It will compile the latest version of Ruby for you and give you tools to manage gemsets.
Relying on the distribution's packages is usually a bad idea, because they are typically out-of-date.
I am getting the following error:
$script/console
Loading development environment (Rails 2.2.2)
/opt/ruby-enterprise-1.8.6-20080709/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
Where can i get the file and what directory should it go in?
Thanks!
The readline module is normally part of the Ruby package itself.
Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.
On Debian/Ubuntu:
apt-get install libreadline-dev
Or on RHEL/CentOS, try
yum install readline-devel
Update:
You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list in a text editor, and change all occurrences of archive.ubuntu.com to old-releases.ubuntu.com. Then, run apt-get update and try the above again.
I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.
You need to install the ncurses and readline libraries.
On Ubunutu you could do
sudo apt-get install libreadline5-dev libncurses5-dev
and then you will have to recompile readline which comes with your ruby source
cd <ruby-src-dir>/ext/readline
ruby extconf.rb
make
sudo make install
If you are using RVM you could simply do
rvm package install readline
EDIT:
On newer RVM versions, this last command is
rvm pkg install readline
Add the following line to your Gemfile and run bundle update
gem 'rb-readline'
credits to similar question/answer at install ruby 1.9.3 using rvm on ubuntu
This easiest way to get relief from this problem,
just add to your Gemfile:
gem 'rb-readline'
And then run bundle install
Run the command
rvm requirements
It shows the requirements and dependencies. Install those and reinstall the ruby on rvm
rvm remove 1.9.2
rvm install 1.9.2
It works!
EDIT
If you can't find the requirements option update your rvm.
rvm update --head # older rvm
or use rvm upgrade
Maybe this is a bullshit answer, but I ran into this problem today after upgrading postgres from 9.5.3 to 9.6, along with which homebrew upgraded readline from 6.something to 7. I ended up rolling back my postgres to 9.5.3 and that resolved the issue.