New Discussion

Notifications

You’re not receiving notifications from this thread.

Setup Ubuntu 14.04 Trusty Tahr Discussion

237
General
Toni Češarek Toni Češarek

thnx

I am new so please don't be harsh. I want to learn Ruby on Rails and I was told that I should install it on Ubuntu so I downloaded Ubunto 14.04 LTS (the desktop version). That is great! Now I wanted to install Ruby on Rails. I did a search and found your website. I am afraid I am lost at: The first step is to install some dependencies for Ruby. Where do I enter command lines? I can't even find help on Ubunto LOL. I am a Windows vet and trying to convert but for now I am lost for a monent and would appreciate your help. Thanks so much.

No worries! There is a application called Terminal that you want to type these commands in. Open up that and type them in there and you should be fine.

Thank you. The terminal app worked perfectly. Just a note that with Ubuntu 14.04 I was getting an error message stating they could not verify the authenticity of the host github.com after creating my key but gave me the option to add it permanently. When I ran the command line to verify my key I got the message

Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
Hi Msjay2u! You've successfully authenticated, but GitHub does not provide shell access.

The next time I ran it to verify I just got the success message without the warning line.

Seems there is a problem with their DNSSEC (Domain Name System Security Extensions)

That error/warning is just to make sure you know you're connecting to a computer that you've never talked to before. Glad everything is working well!

Instead of
sudo sh -c "echo 'deb http://apt.postgresql.org/p... precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
use
sudo add-apt-repository 'deb http://apt.postgresql.org/p... precise-pgdg main'

Much cleaner, thanks!

You need python-software-properties installed to use add-apt-repository.

Great article thanks! I seem to be unable to install other versions of Ruby. For example, if I cd into a directory and try to install Ruby 2.0.0-p247 I get an error on compile. Is this due to the deadline issues going around? Anyone know how to fix this? I tried to install using the patch as noted above, but that did't work either.

You can run the following command if you'd like to install Ruby 2.0.0-p451 instead of 2.1.1:

curl -fsSL https://gist.github.com/LeonB/10503374/raw | rbenv install --patch 2.0.0-p451

It requires a different patch than 2.1.1 does.

why not use PostgreSQL 9.3 from the Trusty Thar repo?

You're right, I'll switch it over to the Trusty repo. Eventually when PostgreSQL's official repo is available for trusty I'll switch it back because you're always guaranteed to get the latest version on their repo. The Ubuntu repositories tend to lag behind the official releases so I lean towards using the postgres provided ones if I can.

Ed Halferty Ed Halferty

Installing from source can cause frustration down the road when you need to work on a project written with a different ruby version. Usually the changes needed to get it working on a different ruby version are minimal, but working with other people who have conflicting ruby versions becomes difficult if you're back- or forward-porting code. But on a production environment, or a box that will only be used for personal ruby projects, it's sometimes nice to know that your ruby is installed in the simplest way possible - directly in the path.

How about adding a few steps to setup an app server like unicorn passenger or puma? That would be great

Good idea, but those are more for production environments. The Deploy Rails tutorial is more geared for setting up a server and covers Nginx + Passenger. This tutorial is for your development environment.

Eugene Fidelin Eugene Fidelin

Fix download url to "ftp://ftp.ruby-lang.org/pub..."

Got it, thanks!

Eugene Fidelin Eugene Fidelin

Please mention common compile fail because of "readline error" and this patch that fixes it https://github.com/sstephen...

This is fixed now in the latest versions of 2.1 and 2.0 that were released yesterday!

Excelente, me sirvió mucho. Saludos

HI i got this error while installing ruby with rvm on 14.04

Partial file(18). Only a part of the file was transferred. Removing partial and re-trying.
rvm installed successfully.
rvm requirements is passed

Sounds like the download got interrupted. You probably should delete the file they mention (assuming they tell you which one didn't finish) and try again.

Thanks! Went well. One suggestion, SQLite!

You should have sqlite3 installed if you followed all the steps. And to generate a Rails app with Sqlite, just skip the -d option and use rails new myapp

I'll add a comment to the last part to make that more clear. Thanks!

Fernando Paladini Fernando Paladini

Awesome tutorial, thanks!!

Hi for `add-apt-repository` command I think what you need is "software-properties-common" package instead of the python stuff, see: https://askubuntu.com/quest...

Hi Chris,
Great article. I was able to follow the steps untill MySQL installation, after that I created an app,
$rails new myapp -d mysql
And was shown the following error,
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...

Gem::RemoteFetcher::UnknownHostError: no such name (https://rubygems.org/gems/r...
An error occurred while installing rake (10.3.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.2'` succeeds before bundling.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`

Please help me out. I did a "bundle install" but it just said "Unknown Host name"

Sounds like you had internet connectivity problems. Try running it again and see if it works next time?

Rana Muhammad Waqas Rana Muhammad Waqas

I did the setup but how do I start building application, I am new to ruby on rails

Hello,
I am new to Rails: How can update my config/database.yml file to match the database username and password.

You can just open that file in your favorite text editor and set the username and password keys inside it. I'd recommend using Sublime Text or something similar to do that.

Mark Evans Mark Evans

Awesome post! Made installation a breeze. Thank you.

Great tutor :D
Can I prepare my RoR project in offline mode? without internet connection.
Thanks

If you've already downloaded all the gems and ruby versions, you can work offline but if you need to install anything new, you'll need an internet connection.

Kelvin Knighton Kelvin Knighton

this version of ruby has been hunting me, 1.9.3p484: first i had rbenv but i did alot of stuff with that included installing 2.1.2 and i put ruby -v and 1.9.3 pops up, i dealt with that all day yesterday and alot today, just 30 mins ago i unstalled rbenv and install rvm and install 2.1.2 and still 1.9.3p484 pops up, i would really be thankful for any advice you could give me on this

If you have multiple versions of ruby, you'll want to set the default (or use rbenv/rvm to switch). For me, I have 1.8.7, 1.9.3, 2.0, and 2.1 installed on my machine. I set 2.1.2 as the default, but certain applications switch back to 1.9 and 1.8.7 for me.

I'd guess you just haven't set the default to 2.1.2 yet and that's what is missing.

when i try [ rvm --default use 2.1.1 ] this happens RVM is not a function, selecting rubies with 'rvm use ..' will not work.

Take a look at this: http://stackoverflow.com/qu...

Shaun Stanislaus Shaun Stanislaus

i couldn't install it. can someone help me out?

shaun@ubuntu:~$ rvm install ruby-2.1.2
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/14.04/x86_64/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..................
Error running 'requirements_debian_update_system ruby-2.1.2',
showing last 15 lines of /home/shaun/.rvm/log/1402160742_ruby-2.1.2/update_system.log
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list

++ return 100
Requirements installation failed with status: 100.

Does sudo apt-get update work? It's saying something is wrong with that.

I'm having this same problem does anyone have a solid solution for this error?

You see this because of your apt-get update fail to update some packages. If there is any failure in your apt-get update the install rvm is not working. So you have to fix all the failures in apt-get update command.

Solution :-
remove 3rd party packages give 404 error in update.
sudo add-apt-repository --remove <package-name>

do this there is not error in apt-get update.
then install the rvm

I think this will help to solve the problem.

At some point an article on installing and using nginx and passenger would be great:-)

Steve Metzger Steve Metzger

Chris, get setup ...it worked well..... but maybe i placed myapp in the wrong location. Its in /home/ubuntu/myapp. I cannot ping 127.0.0.1:3000 and cannot access the Ubuntu AMI externally. Rails server ran successfully on port 3000. Thanks for any ideas.

Hey Steve, this setup is primarily for development. On a production AMI on AWS you probably want to run a server like Passenger so that it can serve up the app on port 80. This tutorial might be more what you're looking for https://gorails.com/deploy/...

If you're wanting to do development on AWS though, you probably just need to open up port 3000 in your security group because I can bet the firewall is blocking it.

Why on sites which are pleasant to me there are no social buttons with "like buttons"? Good guide, thanks.

Ahhh, missed at the end of page.

Mark Railton Mark Railton

Thanks Chris, this is just what I was looking for to get my development server up and running.

Great post! Thanks. A tweet button would be nice.

Thanks for the tutorial, it all worked, got only one problem. I need to have root privileges to create new app (or even check rails version). When I try creating new app as normal user I get error:
The program 'rails' can be found in the following packages:
* ruby-railties-3.2
* ruby-railties-4.0
Is there way to change that, so I wouldn't have to be constantly logged in as root while working on my projects?

If you used rbenv, make sure you run rbenv rehash after installing the Rails gem. That makes the gem's executables available to use. It currently isn't available, so Ubuntu is suggesting a different installation method.

Great! Thanks

$ rbenv install 2.1.2
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudf...
Installing ruby-2.1.2...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20140711233341.7690
Results logged to /tmp/ruby-build.20140711233341.7690.log
Last 10 log lines:
io-console 0.4.2
json 1.8.1
minitest 4.7.5
psych 2.0.5
rake 10.1.0
rdoc 4.1.0
test-unit 2.1.2.0
installing rdoc: /home/codemilan/.rbenv/versions/2.1.2/share/ri/2.1.0/system
installing capi-docs: /home/codemilan/.rbenv/versions/2.1.2/share/doc/ruby
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

Did you install the OpenSSL lib with apt-get?

Great article! Note: I needed to move .bashrc entries to .zshrc, so everthing worked like a charm.
(https://github.com/sstephen...

Great article! Note: I needed to move .bashrc entries to .zshrc, then everything worked like a charm.
(https://github.com/sstephen...

Thiago Colares Thiago Colares

Great article! Notice for zhs user when installing by using rbenv: I needed to move .bashrc entries to .zshrc, then everything worked like a charm. https://github.com/sstephen...

Change the rvm installation command for

\curl -sSL https://get.rvm.io | bash -s stable
If you want an all-in-one installation, try pass the --rails argument after "stable".
Source:
http://rvm.io/

Awesome - worked like a charm on Ubuntu 14.04!

John Creamer John Creamer

Very helpful. I did get hung up at one point with a failed ruby build in rbenv, apparently related to readline bug. This was fixed by running a patch per https://github.com/sstephen... where I substituted my ruby version for the one listed.

Thanks John. That *should* be fixed in Ruby 2.1.2. Is that what you were installing?

George Labuschagne George Labuschagne

Thanks, great post.

Unbelievable!!!! Finally a guide that works with no gotchas.... Thanks heaps

Thank you for a wonderful tutorial! Too many of the instructions you find about rails nowadays are from several years ago and aren't the best practices.

I am try to execute this comand

cat ~/.ssh/id_rsa.pub and got the following
grim@Reaper:~/.ssh$ cat ~/.ssh/id_rsa.pub
cat: /home/grim/.ssh/id_rsa.pub: No such file or directory

Then I switched it to the RSA key I made and got the same thing

grim@Reaper:~$ cat ~/.ssh/gitRSAkey.pub
cat: /home/grim/.ssh/gitRSAkey.pub: No such file or directory

Thanks for the great step-by-step. It's been a long time since I used unix/linux, and the world has become much more complex. I instzalled on a new, clean Ubuntu 14.04 and had no problems at all.

Please delete this comment, I found the solution

Ganesh Mohan Ganesh Mohan

I am running ubuntu 12.04 LTS. Will these procedures work on it as well??

The package names have probably changed a bit. You may want to switch to the 13.04 version as it probably has some more similar package versions.

Thanks for the great writeup! I have put this entire process into a shell script to run during vagrant provisioning, and here were a couple of gotchas related to the rbenv install, for those taking this path. This was using the "ubuntu/trusty64” vagrant box (Ubuntu 14.04).

1) In your Vagrantfile, in the config.vm.provision line that calls the script, add the "privileged: false" option at the end, so that it runs as the vagrant user, not sudo. Otherwise the PATH updates (e.g. rbenv) will go into the wrong .bashrc file and the script won't be able to find rbenv later. (Or I guess you could specify that the PATH updates go to /home/vagrant/.bashrc).

2) The "exec $SHELL" commands will cause the script to terminate. I tried a number of solutions to get the PATH updates to take effect, as described in this StackOverflow thread (http://stackoverflow.com/qu..., but eventually the only solution that worked for me was to comment those out and use the full path to rbenv and gem.

Thus I replaced these lines:
rbenv install 2.1.2
rbenv global 2.1.2
gem install rails -v "=4.1.5"
rbenv rehash

With these:
~/.rbenv/bin/rbenv install 2.1.2
~/.rbenv/bin/rbenv global 2.1.2
~/.rbenv/shims/gem install rails -v "=4.1.5"
~/.rbenv/bin/rbenv rehash

"You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/id_rsa.pub"

cat: /home/usr/.ssh/id_rsa.pub: No such file or directory

Got it. Now to figure out the extent of my pebkac.

ssh wasn't adding my identity correctly. fixed by manually doing it

ssh-keygen -q -t rsa -N 'password' -C 'email' -f ~/.ssh/id_rsa
ssh-add

Afonso Praça Afonso Praça

Excelent!

Well thanks a lot .... installed beautifully .......... for a beginner in ruby on rails ... took me a while to figure this out ...........

Thanks, so amazing ;)

Phuong Thi Tran Phuong Thi Tran

The newest ruby 2.1.3 released. How can i update using rbenv?

Fernando Pineda Fernando Pineda

Very thanks, it is the best getting started that i have seen...

Thanks a lot!

I had problems with add-apt-repository. Seems like the dependency might need to be software-properties-common (not sure)

Greaat!!! Worked smoothly!

excellent excellent: one of the best written instructions set i have ever ever seen on the interent. and i've been to a lot of forums and read a lot of things, esp coming as a ubuntu user learning this thing: but where or where dear friend is the config/database.yml file located? it's really the only thing that is missing........999.999/1000 almost perfect almost full marks

ok i have found it. the config/database.yml file is located at ~/myapp/config/database.yml (of course the tilde "~" denotes the home directory) it's easy once you know but if u dont' know it is a big headache!

Ah yep! Pretty much anytime someone (like myself) mentions a file without giving a full path, they mean inside your Rails app's directory like that.

Renos Zannettos Renos Zannettos

I followed the guide and got n error at "ssh -T git@github.com". Before this step you need to makean "ssh-add" to add the generated key

So... this all worked great... until I opened a new terminal and it didn't know where to find rails until I manually typed exec $SHELL in there again. How to make this automatically work?

That's what will happen if you missed the echo lines to write that code into your ~/.bashrc file. Without those lines, it won't load your ruby environment so they're important!

Chris, great information, i was able to install smoothly. i am on amazon AWS ubuntu instance, after creating the app, from my desktop browser, testing localhost:3000 did not work, i tried using ip address of the server and also dns name, http, https, no luck, any idea, how i can test this? Thanks for great instructions

If you set this up remotely, you need to manually run the rails server in an SSH connection and then visit the server IP with the port of 3000. So http://SERVER_IP:3000

A better thing to follow for AWS is the deploy tutorial where your Rails apps are hosted on something remote like AWS or Digital Ocean. It uses Nginx & Passenger so that your Rails apps are always running.

Excellent guide. Worked flawlessly. Thank you!

AndroidWolf59 AndroidWolf59

Very good article.

On my laptop with Ubuntu I've just used:
rvm install 2.1.3
rvm use 2.1.3 --default
ruby -v

And all it's OK . Thank you so much !

enriquemorenotent enriquemorenotent

The guide recommends 2.1.3, but the instructions install 2.1.2 ;)

Fixing. :)

Latest release of RVM will throw an error stating signature verification failed. Execute this line: gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 before downloading RVM.

Kushagra Sharma Kushagra Sharma

you can use this tutorial to come out from that error you may want to use ruby version control ....... see here how to install RVM http://buffercode.in/instal...

Subramanyam Molleti Subramanyam Molleti

Thanks for the Guide Chris :)

Should we use the NodeSource distributions repo for nodejs instead of Chris Lea's repo? https://github.com/nodesour...

Good question. I'm not sure about NodeSource, but I'd say as long as Chris Lea keeps updating his repo (and he seems to quite consistently), you're fine with that. Feel free to try out NodeSource and let me know how it goes.

Thanks dude.

I follow the instuction and using rvm

everything was fine, but when I install rails, I got this error.

ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://api.rubygems.org/qu...

any ideas why? and how to fix it?

Alexandru Ghita Alexandru Ghita

sudo apt-get install libffi-dev is also needed on ubuntu 14 for ruby 2.2.1
https://github.com/sstephen...

Thanks! I've added that to the instructions. :)

Dan Dascalescu Dan Dascalescu

When running rbenv install 2.2.1, I get rbenv: no such command `install'.

Anyway, why in the world is it so complicated to just install the latest Ruby?

Make sure you run the ruby-build lines before that.

You could skip all this and use apt-get to install Ruby, but the reason we do this is so that when a new version comes out later, you can easily upgrade without losing anything. apt-get will stick you with one version and you won't be able to upgrade it until the Ubuntu developers get around to adding the new version which takes quite some time.

when I goto local host I receive

ActiveRecord::NoDatabaseError

any ideas...

Vincent De Guzman Vincent De Guzman

Hello, I got dependency error with libcurl4-openssl-dev

Ahmed Sliman Ahmed Sliman

Thanks so much

Paulo Souza Paulo Souza

Nice tutorial, thanks!

Why is there no simpler way to set Ruby i[? Why are the packages in Ubuntu no longer maintained properly? It's kind of idiotic. To be honest, it makes it harder to automate deployment on multiple machines. You can't provision like this...

Well, the issue isn't that the packages aren't maintained properly. It's that the software doesn't get upgraded to be compatible with the latest Ruby releases always. Sometimes you have code that works on specific versions of Ruby and that means you will need to install that version specifically on your server. That's why everyone recommends using a Ruby version manager of some kind like rbenv to handle this. Once you get the hang of it, it goes smoothly, but at first it can be daunting and a bit of a pain to set up.

Excellent guide!This is what i want

Josemar Furegatti de Abreu Sil Josemar Furegatti de Abreu Sil

Excellent work! Helped me a lot. Thanks

I completed all installation successfully but am unable to access my localhost using port 3000 through my web browser. Would appreciate your help. Thanks.

No need to install ruby-dev environment or what? Isn't that necessary?

Nope, This should be all you need.

Love it! love it! love it! Thanks man....Inspired.

Finally, a straight and simple installation guide, Thanks a ton.

Hello, im on elementary os freya, i did this steps:

cd
git clone git://github.com/sstephenso... .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenso... ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/sstephen... ~/.rbenv/plugins/rbenv-gem-rehash

but when i try to do:

rbenv install 2.2.2

i get this message:

The program 'rbenv' is currently not installed. You can install it by typing:

apt-get install rbenv

any idea?

You might need to restart your terminal. Sometimes the PATH doesn't get set correctly so restarting the terminal helps or re-running these commands (namely the "echo" lines).

rorikurniadi rorikurniadi

cool, it's work

how to repair this error; i want eliminate this configuration and I want to clear all settings and leave as if nothing had happened

bash: /home/nitroherman/.bashrc: línea 168: error sintáctico cerca del elemento inesperado `PATH="$HOME/.rbenv/bin:$PATH"'

bash: /home/nitroherman/.bashrc: línea 168: `esacexport PATH="$HOME/.rbenv/bin:$PATH"'

You can just remove that line from the bashrc file. I believe it should be

export PATH="$HOME/.rbenv/bin:$PATH"

Joakim Wahlgren Joakim Wahlgren

Great tutorial! Thanks for putting the time and effort into creating it for us new to the wonderful world of Ruby on rails.

Jeremiah Wibberding Jeremiah Wibberding

good guide!

Julio Cesar G F Julio Cesar G F

Hi! Can you help me?!

i can't fix this:
$ rake db:create
Could not find gem 'sass-rails (~> 4.0.3) ruby' in any of the gem sources listed in your Gemfile or installed on this machine.
Run `bundle install` to install missing gems.

--- ERROR REPORT TEMPLATE -------------------------------------------------------
- What did you do?

I ran the command `/usr/local/rvm/gems/ruby-2.2.1/bin/bundle install`

- What did you expect to happen?

I expected Bundler to...

- What happened instead?

Instead, what actually happened was...

Error details

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Unfortunately, an unexpected error occurred, and Bundler cannot continue.

I'll go to:
https://github.com/bundler/...
but can't find this problem

Thank you so much. Finally got my ruby server to run on Ubuntu

dijee ponsel dijee ponsel

root@squid35:/home/dijee# gem install bundler
ERROR: While executing gem ... (ArgumentError)
IPv4 address expects 4 bytes but 1 bytes

Sounds like you've got an issue with your internet connection.

http://stackoverflow.com/qu...

Junaid Farooq Junaid Farooq

I dont know who i behind this work. but its awesome. May Allah give you more and more success in you whole life. Keep you away from every thing which cause harm for you. Ameen.

Kushagra Sharma Kushagra Sharma

you may want to use ruby version control ....... see here how to install RVM http://buffercode.in/instal...

TacoMeatDaGod TacoMeatDaGod

I'm entering: cat ~/.ssh/id_rsa.pub

and I get this error message

cat: /home/apacheomega/.ssh/id_rsa.pub: No such file or directory

what am I doing wrong???

Ernest Aleixandre Ernest Aleixandre

I watched the installation progress to see what URLs were used for download. I noticed Ruby was being downloaded from cloudfront.net:

http://dqw8nmjcqpjn7.cloudf... . I pasted the URL in VirusTotal and all came back clean except the AutoShun scan which said it was a malicious site. I'm assuming this is a false positive?

Anyone else have any comments or concerns about this?

ClamAV scan of the filesystem came back clean afterwards.

Thanks for the detailed, seamless instructions!

That should be good. Cloudfront is a CDN so it caches files so you can download them faster around the world. It's something you have to configure so Ruby's website is probably forwarding you to that. Good to verify that it's not malicious in any case!

GPG signature verification failed. Where is the problem?

Coire Walker Coire Walker

I'm having trouble at the git install section, after these steps:

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -C "YOUR@EMAIL.com"

After the four consecutive steps I am asked where to save my file. When I enter a destination folder it fails. Am I supposed to create a file for it to be saved in? If so, how etc? Thanks in advance.

You want to save it to the default location by just hitting ENTER. What's the failure say?

Ariel Cabib Ariel Cabib

Awesome tutorial.

You're missing '~' in the Installing Ruby section, after the 'cd', in the 'Using rbenv' code snippet.

Fun fact! You don't need ~ because it will default to that if you don't put it in. I learned that not too long ago. :)

--no-ri and --no-rdoc are deprecated. You might want to update it to --no-document.

Yes indeed! I noticed that recently. Thanks for the reminder!

Brian Todoroff Brian Todoroff

For postgresql you need to make sure the user your create matches the username you are logged in as. If not you'll run into errors that "Peer authentication failed for user..."

Thanks heaps. Solved my problem.

Suhail Ameen Suhail Ameen

Thanks for the detailed step by step guide .....

Hey Guys! Nice post, I have some problems when I tried to run rake db:schema:load, due to some postgres missing plugins, to solve that I had to install postgres-contrib

so, it's better use
sudo apt-get install postgresql postgresql-contrib libpq-dev

instead of
sudo apt-get install postgresql libpq-dev

;)

Joshua Rumbut Joshua Rumbut

Using Ubuntu 14.04 (Trusty) and RVM I needed install ruby with

rvm install 2.2.3 --disable-binary #or if you already did install: rvm reinstall 2.2.3 --disable-binary

in order to have the development headers available for nokogiri et al.

Thanks for the guide!

Hi @joshuarumbut:disqus , thanks for this comment! helped a lot.

as of Sep/6/2015 this guide is still on point. great job and thank you for this :)

I keep it updated as much as I can! :)

Guide that finally that let me install rails without visiting stackoverflow again :)

That's my goal!

Sounds like you don't have an SSH key on your machine. You might need to generate a new one or install an old one if you have one you created previously.

Prasanna Moharana Prasanna Moharana

while try to enter

ssh -T git@github.com
it shows me Permission denied (publickey).

Leonardo Godoy Leonardo Godoy

Hi Prasanna,

When you put the follow command:

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -C "YOUR@EMAIL.com"

You should put your own email.

After that, you need to create new account on www.github.com, next, you need to create a new ssh key, and, after that, you can put the 'ssh -T "YOUR@EMAIL.com"' command. But, you should put YOUR OWN EMAIL, not "git@github.com" email

Try, and you'll see it works

Greets!

Prasanna Moharana Prasanna Moharana

Hello am facing an issue in gems installation. PS. already tried sudo apt-get install build-essential
-sudo apt-get install libmagickwand-dev
and all those but till error arise..
tried lots of command but gems installation showing error.

Leonardo Godoy Leonardo Godoy

are you try with "sudo gem install..."? Maybe works

Run "sudo apt-get install libgmp-dev"

when i try to visit via http://localhost:3000 i get This webpage is not available. ERR_CONNECTION_REFUSED

~/myapp$ rails server

=> Booting WEBrick

=> Rails 4.2.4 application starting in development on http://localhost:3000

=> Run `rails server -h` for more startup options

=> Ctrl-C to shutdown server

[2015-09-16 18:43:18] INFO WEBrick 1.3.1

[2015-09-16 18:43:18] INFO ruby 2.2.3 (2015-08-18) [x86_64-linux]

[2015-09-16 18:43:18] INFO WEBrick::HTTPServer#start: pid=4826 port=3000

When I enter 'ssh -T git@github.com' I am getting something like this,

The authenticity of host 'github.com (192.30.252.130)' can't be established.

Its working now, but when I enter rake db:create, I am getting,

Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

Julián Hernández Julián Hernández

I have an error: "specified 'mysql2' for database adapter but the gem is not loaded..."

use

gem 'mysql2', '~> 0.3.18' in gem file

Great job! I appreciate your help! TY so much! But, i have one information that can be necessary and important to someone.

The version of my ubuntu is 14.04, and the current version of the mysql2 is installed with the last version (stable) ruby.

If
you have a problem similar as: " Gem::LoadError Specified 'mysql2' for
database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your
Gemfile", and your server not work, the solution can be a following:

Open
your folder that contain your project, and find your Gemfile. In the
gemfile, add the version of the mysql2 '~> 0.3.20' . For example:

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use mysql as the database for Active Records
gem 'mysql2', '~> 0.3.20'

After these steps, you can be continue your setup normally.

Regards!

Diego Cassol.

helped me! Thanks

Excellent..! Now I can achieve my purpose....thank you very much

Marco A. Muñoz R. Marco A. Muñoz R.

Thanks, ready to learning RoR

Hi there. I encountered some problems when setting up ruby on rails using this tutorial, if you have time please take a look at my question on stackoverflow:

http://stackoverflow.com/qu...

Geologist UareA Geologist UareA

Great! Thanks.

Both mac and ubuntu guides are awesome

amazing, thanks!

Worked great, thanks! Just one additional step for Postgre, before doing rake db:create I had to change all instances of "peer" to "md5" in "/etc/postgresql/9.1/main/pg_hba.conf" and run "sudo service postgresql restart". More information: http://stackoverflow.com/a/...

Hi, I am new on ruby, and i tried to install ruby as mentioned in this article (I am using linux mint 17.2, I think it would be the same with ubuntu 14.04 right?) and I got this error :

Downloading ruby-2.2.3.tar.gz...
-> https://cache.ruby-lang.org...
error: failed to download ruby-2.2.3.tar.gz

also I've tried for the other version, but end up with the same error. I think the issue is not the network because I tried manually download the file and it was works. What should I do ?

Thank you.

This is the best guide and obviously the most popular on Google. Its #1 guide. Even Youtube videos are not more explanatory than this guide.

Ahesanali Suthar Ahesanali Suthar

While installing ruby using rbenv i got
compilation error it says
Ssl_v3 undefined something like it.
Even though i have installed libssl-dev too.

Yongkai Zhang Yongkai Zhang

I'm trying to install ruby 2.2.3 in my ubuntu. I'm running this ubuntu from a bootable Disk with persistence.

I followed the guide above until rbenv install 2.2.3, then I received a installation failed message. the message is as shown below:
-------------------------------------------------------------------------------------------------------------------------------------------
BUILD FAILED (Ubuntu 14.04 using ruby-build 20151226)

Inspect or clean up the working tree at /tmp/ruby-build.20151228054323.20365
Results logged to /tmp/ruby-build.20151228054323.20365.log

Last 10 log lines:
The Ruby openssl extension was not compiled.
The Ruby readline extension was not compiled.
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev libreadline-dev zlib1g-dev` to fetch missing dependencies.

Configure options used:
--prefix=/home/ubuntu/.rbenv/versions/2.2.3
LDFLAGS=-L/home/ubuntu/.rbenv/versions/2.2.3/lib
CPPFLAGS=-I/home/ubuntu/.rbenv/versions/2.2.3/include
-------------------------------------------------------------------------------------------------------------------------------------------

Can anyone please teach me what is wrong and how I can solve it?
Thank you very much.

Yongkai Zhang Yongkai Zhang

UPDATED: I managed to solve it. What i did was to fetch missing dependencies with super user right.
The command below will fetch the missing dependencies:

sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev

Then I run rbenv install 2.2.3 and it worked

Awesome!!!

Marcus Whelan Marcus Whelan

Can you add how to fix the yml file?

Gabriel Alejandro Carcamo Mara Gabriel Alejandro Carcamo Mara

Thanks a lot for this guide, at last it works!

Rakesh Rajwar Rakesh Rajwar

loved this blog.

I have created a video based on this guide at https://www.youtube.com/wat...

Swarup Rajbhandari Swarup Rajbhandari

Very much thanks :)

For those who having problem with ruby gem, please do this:

gem update
gem clean

Some old gems wont uninstall itself. This would solve gem problem.

Zachary Preston Zachary Preston

I greatly appreciate this guide. I'm getting into Linux and Ruby on Rails after 17 years of developing in MS technologies. It's a Renaissance. There are several good "getting started" guides, and this is only my fifth so far, but it is the best.

Thanks for much for that Zachary! :)

siddhesh latkar siddhesh latkar

worked without any error .. Thanks alot

Thanks just awesome article :)
I don't like rvm :/

Neither "quick" method works in a standard 14.04 64 Bit.
Following the instructions the
rnenv method will run forever and never finish. ever.

rvm method fails with error 100.

Build from source I got to work.

Łukasz Szeremeta Łukasz Szeremeta

You can add this before bundler install:
echo "gem: --no-document" > ~/.gemrc

Thanks man. Every time I do a clean install of Rails I'm like, "Now what was that page called that worked every time and actually made sense?" :)

That means a lot! Thanks so much for saying that Gilbert! :D

Sarath Nambiar Sarath Nambiar

Thanks for the guide :) cheers!!!

Arvind Rachuri Arvind Rachuri

Amazing! It solved a lot of problems and saved me a lot of headaches!

2.3.0 moans every time rails starts up. Something about mutexes. Hey ho.

Rael Gugelmin Cunha Rael Gugelmin Cunha

A friendly reminder that there is an official Ubuntu package for RVM: https://github.com/rvm/ubun...

Ryan Dingle Ryan Dingle

this guide is perfect.. all steps are success :) tnx

Shalev Levi Shalev Levi

Had a long issue with the Git SSh key file name. Would recommend explaining where to leave blank (and maybe add a link to the awesome Github guide).

Mitch VanDuyn Mitch VanDuyn

This guide was great, and in fact I used it to install on windows 10 with the new WSL bash window (at least to where I have rails running)... Just for people's info here are the changes and additions to get things to work nicely.

1) after installing bundler make sure to do a "find ~/.bundle/cache -type d -exec chmod 0755 {} +" due to a sort-of issue with latest bundler.
2) then if using rails 5 make sure to use the --skip-spring --skip-listen options and make sure that this line in development.rb is commented out (it should be)
#config.file_watcher = ActiveSupport::EventedFileUpdateChecker

Number #2 is because inotify is not implemented (yet) in windows WSL.

when i search 'install rvm on ubuntu' google give this site at 3rd position, it should be first

I couldn't agree more. :)

'Using RVM' is recommended

Good for new versions of ruby and rails but not working on Old ruby and rails versions.
How to install Nginx with phusion passenger ssl support on ubuntu 14.04

angelica duque angelica duque

thanks for it, i almost give up with rails.
it works perfectly

hieu le van hieu le van

Thanks so much, I got my first ruby website :) Thanks again

Darpan Patil Darpan Patil

404 error

ZhAinoS %z% ZhAinoS %z%

Thank you, it helped me a lot...

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 88,275+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.