Skip to main content

Setup Ubuntu 14.04 Trusty Tahr Discussion

General • Asked by Chris Oliver

Fallback

thnx


Fallback

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.

Fallback

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.


Fallback

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)

Fallback

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!


Fallback

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'

Fallback

Much cleaner, thanks!

Fallback

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

Fallback

Jay_FK, You're right as a rain!


Fallback

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.

Fallback

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.

Fallback

Hi thanks! Is there a list of patches for each version of Ruby? I am interested in installing 2.0.0-p247 too. Is there any idea on when this will be fixed so we wont need to use this patch for each Ruby install?

Thanks agian for all of your help!

Fallback

From what I read, it sounds like the next releases of Ruby will include patches for it and you have to do this for the time being. Pretty annoying and I hope they have a better solution in the future.

I'm curious, why do you need p247 and not the latest 2.0.0? Isn't everything fully compatible between the two?

Fallback

Well, I am taking a class that specifies Ruby 2.0.0-p247 version in the .ruby-version file. So, I was just assuming I should use that specific version.

Fallback

Ah cool. You're safe to upgrade to p451 then. That part denotes the "patch level" which basically means they fixed some bugs inside Ruby (including some security fixes usually). It shouldn't affect you at all and I'd recommend always trying to use the latest patch level of whichever version of Ruby you use.

Fallback

Excellent! Thanks very much for all of your help.

Fallback

Anytime, glad to help! :)


Fallback

why not use PostgreSQL 9.3 from the Trusty Thar repo?

Fallback

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.


Fallback

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.


Fallback

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

Fallback

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.


Fallback
Fallback

Got it, thanks!


Fallback

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

Fallback

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

Fallback

Nice!


Fallback

Excelente, me sirvió mucho. Saludos


Fallback

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

Fallback

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.

Fallback

Resolved, some access are denied .Thanks for your Reply and thank you for awesome tutorial if i want to install rails i do follow this every time excellent work.

Fallback

Glad you got it working and you're welcome! :)


Fallback

Thanks! Went well. One suggestion, SQLite!

Fallback

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!

Fallback

Makes sense! Thanks for the prompt answer.


Fallback
Fernando Paladini

Awesome tutorial, thanks!!


Fallback

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...


Fallback

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"

Fallback

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


Fallback
Rana Muhammad Waqas

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


Fallback

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

Fallback

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.

Fallback

I cannot find the file.
do you have an idea what the name will look like?

Fallback

It is inside your Rails app, inside the config directory. See this: https://www.evernote.com/sh...

Fallback

thanks a lot I saw the file, but do not see no user name and password inside

Fallback

You add them in. Put them under the development section.

Fallback

Can you be more specific/detailed on this point? I tried using VIM on the file:

development:

<<: *default
database: myapp_development
username: todallyrad
password: ********

Even this isn't working: $ mysql -v
ERROR 1045 (28000): Access denied for user 'todallyrad'@'localhost' (using password: NO)

But it's still not working. I tried following: http://stackoverflow.com/qu...

But again the writers weren't specific/detailed enough for newbies like myself. Like how do you login to mysql and make the necessary password changes?

Fallback

When you use mysql from the command line, you must specify your user and tell it you will type in a password:

mysql -u root -p

It should be the root user by default. Test it with this command and then put those credentials in your database.yml under production.

Fallback

I tried editing the database.yml file with VIM and I get this error when trying to do rake db:create "Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock", "database"=>"myapp_test"}"

Do I need to source the database.yml file after editing it? Would it help if I just totally remove mysql and reinstall it? If I can't get the database.yml file working is everything I did on this page unusable/useless? What would happen if I deleted the database.yml file? Would it go back to the defaults?

Fallback

When you rake db:create in development it also tries to create the test database. Make sure you also have the proper username and password for the test environment. This is telling you it can't connect.


Fallback

Awesome post! Made installation a breeze. Thank you.


Fallback

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

Fallback

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.


Fallback

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

Fallback

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.


Fallback

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


Fallback
Shaun Stanislaus

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

[email protected]:~$ 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.

Fallback

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

Fallback

execute this first and then try installing using rbenv.It worked for me: sudo apt-get install g++ gcc make libc6-dev
patch openssl ca-certificates libreadline6 libreadline6-dev curl zlib1g
zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev
libxslt1-dev autoconf libc6-dev libgdbm-dev libncurses5-dev automake
libtool bison pkg-config libffi-dev

Fallback

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

Fallback

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.


Fallback

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


Fallback

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.

Fallback

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.


Fallback

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

Fallback

Ahhh, missed at the end of page.


Fallback

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


Fallback

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


Fallback

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?

Fallback

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.

Fallback

Fallback

Great! Thanks


Fallback

$ 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?

Fallback

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

Did you install the OpenSSL lib with apt-get?

Fallback

Thanks sir installing OpenSSL lib solved the problem.


Fallback

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


Fallback

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


Fallback

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...


Fallback

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/


Fallback

Awesome - worked like a charm on Ubuntu 14.04!


Fallback

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.

Fallback

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

Fallback

Actually, I think you are right. In my case, I needed to conform with a running application in setting up a development environment, so I was installing Ruby 2.0.0-p353. I just thought it would be helpful to leave that note in case anyone else was doing an install for earlier versions of Ruby.

Fallback

It seems to be a bug in the new readline dependency. I *think* if you're on the latest patch version of 2.0.0 (p481) that it has a patch for that bug.


Fallback
George Labuschagne

Thanks, great post.


Fallback

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


Fallback

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.


Fallback

I am try to execute this comand

cat ~/.ssh/id_rsa.pub and got the following
[email protected]:~/.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

[email protected]:~$ cat ~/.ssh/gitRSAkey.pub
cat: /home/grim/.ssh/gitRSAkey.pub: No such file or directory


Fallback

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.


Fallback

Please delete this comment, I found the solution


Fallback

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

Fallback

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.


Fallback

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


Fallback

"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.

Fallback

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


Fallback

Excelent!


Fallback

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


Fallback

Thanks, so amazing ;)


Fallback

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


Fallback

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


Fallback

Fallback

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


Fallback

Greaat!!! Worked smoothly!


Fallback

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


Fallback

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!

Fallback

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.


Fallback

I followed the guide and got n error at "ssh -T [email protected]". Before this step you need to makean "ssh-add" to add the generated key


Fallback

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?

Fallback

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!


Fallback

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

Fallback

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.


Fallback

Excellent guide. Worked flawlessly. Thank you!


Fallback

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 !


Fallback

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

Fallback
Fallback

Wow, that was fast. Fixed in 12 minutes! o_O

Mad props


Fallback

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.

Fallback

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...


Fallback

Thanks for the Guide Chris :)


Fallback

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

Fallback

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.


Fallback

Thanks dude.


Fallback

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?


Fallback

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

Fallback

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


Fallback

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?

Fallback

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.


Fallback

when I goto local host I receive

ActiveRecord::NoDatabaseError

any ideas...


Fallback

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


Fallback

Thanks so much


Fallback

Nice tutorial, thanks!


Fallback

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...

Fallback

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.


Fallback

Excellent guide!This is what i want


Fallback
Josemar Furegatti de Abreu Sil

Excellent work! Helped me a lot. Thanks


Fallback

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


Fallback

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

Fallback

Nope, This should be all you need.


Fallback

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


Fallback

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


Fallback

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?

Fallback

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).

Fallback

When i restarted my terminal, now i get this message:

mkdir: cannot create directory ‘/home/leonardo/.rbenv/shims’: Permission denied

mkdir: cannot create directory ‘/home/leonardo/.rbenv/versions’: Permission denied

[email protected]:~$


Fallback

cool, it's work


Fallback

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"'

Fallback

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

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

what would be the command to do so

Fallback

write that and tell me the symbol = it is not invalid


Fallback

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


Fallback
Jeremiah Wibberding

good guide!


Fallback

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


Fallback

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


Fallback

[email protected]:/home/dijee# gem install bundler
ERROR: While executing gem ... (ArgumentError)
IPv4 address expects 4 bytes but 1 bytes

Fallback

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

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


Fallback

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.


Fallback

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


Fallback

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???


Fallback
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!

Fallback

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!


Fallback

GPG signature verification failed. Where is the problem?


Fallback

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 "[email protected]"
ssh-keygen -t rsa -C "[email protected]"

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.

Fallback

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

Fallback

Yup! That was it! It wasn't clear in the tutorial to just hit enter and I didn't want to mess anything up. Thanks Chris!

Fallback

Yeah no worries! The times when you see text in square brackes means that's the default value if you hit enter. You'd probably see something like [~/.ssh/id_rsa] which means it will store to that file by default if you don't type a file in. Just one of those little Unix annoyances.


Fallback

Awesome tutorial.

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

Fallback

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. :)

Fallback

Nice :)


Fallback

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

Fallback

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


Fallback

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..."

Fallback

Thanks heaps. Solved my problem.


Fallback

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


Fallback

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

;)


Fallback

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!

Fallback

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


Fallback

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

Fallback

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

Fallback

almost. Rats. I'm still on ubuntu 14.04.
I guess there's a system problem that stops the install, same problem that is keeping me on 14.04. out of scope for the rails install discussion?


Fallback

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

Fallback

That's my goal!


Fallback

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.


Fallback

while try to enter

ssh -T [email protected]
it shows me Permission denied (publickey).

Fallback

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 "[email protected]"
ssh-keygen -t rsa -C "[email protected]"

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 "[email protected]"' command. But, you should put YOUR OWN EMAIL, not "[email protected]" email

Try, and you'll see it works

Greets!


Fallback

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.

Fallback

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

Fallback

Run "sudo apt-get install libgmp-dev"


Fallback

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


Fallback

When I enter 'ssh -T [email protected]' I am getting something like this,

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

Fallback

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).

Fallback

I hit the same problem today doing these steps on a fresh install of desktop Ubuntu 14.04. I found and followed the steps on http://www.ict4g.net/adolfo... which did the trick.

gem uninstall mysql2
gem install mysql2 -v 0.3.20
Modify line in Gemfile file to: gem "mysql2" "~> 0.3.20"
bundle update
rake db:create


Fallback

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

Fallback

use

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


Fallback

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.


Fallback

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


Fallback

Thanks, ready to learning RoR


Fallback

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...


Fallback

Great! Thanks.


Fallback

Both mac and ubuntu guides are awesome


Fallback

amazing, thanks!


Fallback

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/...


Fallback

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.


Fallback

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.


Fallback

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.


Fallback

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.

Fallback

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


Fallback

Awesome!!!


Fallback

Can you add how to fix the yml file?


Fallback
Gabriel Alejandro Carcamo Mara

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


Fallback

loved this blog.


Fallback

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


Fallback

Very much thanks :)


Fallback

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.


Fallback

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.

Fallback

Thanks for much for that Zachary! :)


Fallback

worked without any error .. Thanks alot


Fallback

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


Fallback

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.


Fallback

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


Fallback

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?" :)

Fallback

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


Fallback

Thanks for the guide :) cheers!!!


Fallback

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


Fallback

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


Fallback
Rael Gugelmin Cunha

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


Fallback

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


Fallback

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).


Fallback

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.


Fallback

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

Fallback

I couldn't agree more. :)


Fallback

'Using RVM' is recommended


Fallback

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


Fallback

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


Fallback

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


Fallback

404 error


Fallback

Thank you, it helped me a lot...


Login or create an account to join the conversation.