I have been developing rails applications on windows xp. I now need to deploy these apps to a different computer, which has Ubuntu 10.04.1 LTS. To install ruby and rails on my windows machine, I used the RailsInstaller. I now need to get ruby and rails working on my Ubuntu machine. It isn't connected to the internet so pretty much every tutorial I found hasn't worked. Can I just transfer my installed files from my windows machine? In my RailsInstaller directory on my windows machine, there is the following directories: DevKit, Git, Ruby1.9.3, and scripts. It also has unins000.exe and unins000.dat. Will it work to just transfer these files or is there some other way to get ruby on rails working on my Ubuntu machine?
Windows and Ubuntu are two different operating systems. Read about operating systems here
You cannot copy software files from one Operating system to another. You can only move code and documents (images, music etc).
Anyway, since you are using Ubuntu, the tool that allows you to install software is called 'aptitude'. You will install software 'packages' from the terminal. It is similar to the command prompt in windows. You can open it by searching in the dash.
The command to install software is apt-get install package-name. You need to give it root privileges so you will have to prefix the command with sudo.
By default aptitude will fetch package from online repositories. But you can also make it install from a local file.
Another way for offline installation is to get the '.deb' package file of the software and run dpkg -i filename.deb.
Okay. So the idea is to download the software packages needed for ubuntu and use the installation tools provided to install them.
Ok For Ruby we have something called Ruby Version Manager or RVM. It allows you to have multiple versions of Ruby on your computer. I think that wont be necessary for you. But still we will go with RVM because of its ability to let you install ruby offline with ease.
Read more here: http://rvm.io/rvm/offline
As you might know, Rails is a gem of Ruby. In the above link you will find how to install Gems offline. Just download the Rails gem and install it using the local option of bundler. Ok I might have confused you with this paragraph. But you read the RVM documentation and you will understand.
If you do get an internet connection, there is an awesome tutorial (step by step) at DigitalOcean.com to guide you.
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
I know its for Ubuntu 12.04. But you wouldnt face much problem.
Good luck. And learn about operating systems.
Installation of Ruby on Rails for Production server is pretty straight forward. Below are the relevant steps.
1.INSTALL THE NEEDED LIBRARIES
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev
2.DOWNLOAD AND INSTALL RUBY 1.9.3
sudo apt-get update
sudo apt-get install ruby1.9.3
Note you can install latest Ruby too.
3.INSTALL RAILS
sudo apt-get install ruby-dev
sudo apt-get install build-essential g++
sudo gem install railsconfigure rails application with nginx and unicorn
4.INSTALL SQLITE ADAPTER
sudo apt-get install libsqlite3-dev
If you passed all above steps without any ERROR, Now it's time to create a rails demo application OR SCP existing one and test it out.
Below is the steps to create new rails application
rails new demo
cd demo
uncomment therubyracer gem in Gemfile
sudo apt-get install build-essential g++
bundle install
rails g scaffold order name:string
rake db:create
rake db:migrate
Open config/routes file and uncomment root 'welcome/index' and replaced with 'orders/index'
$rm -rf public/index
That's all, Now run your Rails application.
Checkout http://railscasts.com/episodes/335-deploying-to-a-vps and search for "capistrano" to deploy. It's an art.
"It isn't connected to the internet so pretty much every tutorial I found hasn't worked"
You are way off the beaten path here. but if you can get your git repo to a machine that is connected to the internet, you can deploy to Heroku easy, and/or run capistrano from there.
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 am trying to get a development environment up and running. I installed virtualbox and then used vagrant with the hashicorp/precise32 box. I access the VM through ssh and am trying to install the latest version of ruby.
I pasted
wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
tar -xzvf ruby-install-0.5.0.tar.gz
cd ruby-install-0.5.0/
sudo make install
into the command line from https://github.com/postmodern/ruby-install#readme
The prompt shows sudo make install and when I hit enter I get a message that says "sudo: make: command not found."
What am I doing wrong?
I know there are boxes with ruby already setup but I wanted to go through the process myself so learn a bit along the way.
A separate issue I came across was that this box has an outdated version of ubuntu. When I try to upgrade it warns me not to do it over SSH. Is there a better way?
Thanks
Maybe you don't have make installed on Ubuntu. You can install the package build-essential which will install make and other building tools.
sudo apt-get install build-essential
also, here's a good reference on installing Ruby, Ruby on Rails, and other tools on Ubuntu.
When I used "sudo apt-get install ruby-full build-essential" in the terminal I got this:
$ sudo apt-get install ruby-full build-essential
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.medibuntu.org_dists_quantal_non-free_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
Can anybody tell me how can I install Ruby on Rails in my Linux Mint machine?
I think you don't need features of rvm. You just want to install ruby easy, fast and without troubles, right? Good news to you. We got an alternative to rvm. It's called rbenv. You can find an installation guide here.(don't skip ruby-build, it is necessary!).
And yes, follow ubuntu instructions since Mint is build on it (though there's debian-based version but I suppose you use ubuntu-based one).
I installed yesterday Mint 16 and rbenv on it. Works fine.
PS: don't forget to sudo apt-get install build-essential first.
I actually use Mint on my main development system. I'd also recommend using RVM to manage all your Ruby and Rails installation/versions. The command to install it is:
\curl -L https://get.rvm.io | bash -s stable
You can also append --ruby and --rails to get (I believe) the most recent versions of the two of them. I'd recommend not using apt-get for installing Ruby, as I've noticed that it can be out of date and/or lead to strange errors like those that you're seeing. You can get more information from the RVM website. I really enjoy using Mint, so I hope that helps.
Use rvm to install Ruby then simply install rails gem , but before that fix your repository related problem.
sudo rm -rf /var/log/apt/list
sudo apt-get update
sudo apt-get upgrade
Then install rvm see rvm.io for installation info
If you are new want to setup everything from start then see this blog post
https://www.computersnyou.com/4235
Use rbenv
instead, use this link DigitalOcean since mint is an ubuntu based distro, it will work.
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 trying to get a Ruby on Rails app hosted free somewhere, and Heroku is looking like my last resource. It is supposed to work on Linux, and the gem installs with no errors, but whenever I run any Heroku command it spits out several errors, all connected, and talking about a failed 'require.' I looked it up in the code, and it says:
require 'readline'
That is it.
I have tried to install every variation of libreadline that I can find and think of, but none of it makes any difference. Any ideas here?
It could be that your system installed version of Ruby is not build with readline support. If so then you could reinstall it from source and select the correct configure parameters for readline support. That's not only annoying but means you'd have to manually maintain updates yourself.
Better still would be to abandon your system Ruby altogether in favor of one installed with RVM
Install RVM as described here
Install libreadline-dev
$ sudo apt-get install libreadline-dev
Install a version of ruby (e.g. 1.8.7)
$ rvm install 1.8.7
$ rvm --default 1.8.7
Install your rails and Heroku gems under the RVM ruby
$ gem install rails heroku taps ... # Note no sudo!
See if your problem persists
If so, then do this:
$ cd ~/.rvm/src/ruby-1.8.7-p299/ext/readline
$ ruby extconf.rb
$ make
$ make install
Ubuntu's ruby-full package depends on libreadline-ruby and should pull in everything both you and it needs. If you have tried installing ruby by installing a bunch of separate packages you might be missing something. If that's the case go back and install ruby-full.
I have a script I use to rebuild my Rails Environment whenever I install the latest Ubuntu. It installs everything you need for Heroku (which is where I host my apps) as well. You might want to take a peek at it and see if there is anything there that you are missing.
If ruby-full doesn't sort you out, I would second Bjg's advice and ditch the system ruby for RVM.
I got it to work, but it was rather a hack. I hunted down the readline.so file from where it was installed (in some strange spot) and did a hard link to where ruby was looking for readline, and it worked. Not optimum, and I will definitely try what you guys recommend next time. Thanks!