A Ruby Book (free to use)

Are you sure you ran rails server before navigating to localhost:3000 ? did it throw any errors?

Dheeraj Kumar

Dheeraj,        And others... I am now convinced to use Linux/Ubuntu in my VirtualBox installation. I followed the tutorial that was posted earlier. Colin, on this list, recommended this posting: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog I’ll have to lookup that link and try to find it again. I did everything in the tutorial, got all the way to the bottom... where it says “Now you can see your installation of test_app and there is a smiley face. I try that very last step, where everything above it worked fine and so I go to my browser, enter http;//localhost:3000 There might have been a directory, I’ll have to dig up that tutorial link. Whatever it said for where to go in the browser is where I went. It says “Cannot display page...” Not found... etc.

Why have you just posted this question again? Did you see the suggestions in my last post?

       Now in the course I took online at Lynda.com, called “Up and Running with Linux for PHP Developers.” The location where we would be installing software is giving me an error saying I don’t have permission to use that directory. It is /media/sf_sandbox/ I did try the sudo command in front of cd to go to that directory and it said it didn’t recognize sudo cd. It is both embarrassing and very frustrating that it continues to take me so long to get this working. After all this time, I STILL don’t have a rails install that I can browse to. I’ve never ever had this kind of problem with anything, any programming language or language environment.

I don't think this is the right place to ask for help with installing php on linux. It does not seem to have much to do with Rails.

Colin

I meant no offense. Please, don't take it that way. Let me explain my post... I had originally intended to use Windows as the environment for running Ruby on Rails, as a course I was following used both Windows and Mac. I finally felt convinced that it would be just as well to use Linux. I had respectfully asked if I could share my experience in trying this.

I'm just very frustrated as I'm sure anyone can understand. This should not be so difficult to get up and running. I finally did get Ruby on Rails in stalled correct (or almost correctly) and installed a test_app. Then when I tried to create an application with mysql database, it failed. Some other folks seemed to report some similar problems which I discovered when I did a web search. Unfortunately, the solutions were lacking in the articles and stack overflow posts that I read.

The use of Linux was a key part of the issue as it was suggested as a solution to the problem of not being able to install Ruby when I was using Windows.

Anyway, I keep going in circles. I get a message saying that I need to install gem msyql2 which I do and it reports back with no error and so I try again to install the app with the rails command and I get the same error. Thanks in advance for your help and time, Bruce

You need to add it to the gemfile and run the bundle command.

Dheeraj Kumar

Hi Bruce,

Bill,

First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/

uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect. Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/

 Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago.  I get Not Found at the test_app link that I included just above.  I can go to the [http://localhost:8080/](http://localhost:8080/) uri and see some web content that was put there.  However, the test_app that worked fine just a little while ago, is not working now.  Had it been working I would have said that the last problem to address is creating an application with mysql support. 

  It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR. 
  1. test_app from the tutorial: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/ was working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public.

  2. How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line:

rails new simple_cms –d mysql

I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter

gem install mysql2 –v ‘0.3.11’

Then I try my install again… when asked to continue and over-write, I say Y. Then I get the same error.

What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt.

  1. Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you’re having your problem?

I don’t know what the latter means. I can look at the Gemfile and it has this in it:

source :rubygems

gemspec

I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.

Thanks,

Bruce

Bill,         First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.

Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.

Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/      Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.

Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).

If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.

      It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR. 1) test_app from the tutorial: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public. 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line: rails new simple_cms –d mysql I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter gem install mysql2 –v ‘0.3.11’ Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error. What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt. 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem? I don’t know what the latter means. I can look at the Gemfile and it has this in it: source :rubygems

gemspec

Your gemfile should have quite a bit more than that inside it, at least on a bare Rails app. Here's one now:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

# Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

# Gems used only for assets and not required # in production environments by default. group :assets do   gem 'sass-rails', '~> 3.2.3'   gem 'coffee-rails', '~> 3.2.1'

  # See GitHub - sstephenson/execjs: Run JavaScript code from Ruby for more supported runtimes   # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

# To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON # gem 'jbuilder'

# Use unicorn as the app server # gem 'unicorn'

# Deploy with Capistrano # gem 'capistrano'

# To use debugger # gem 'debugger'

IF that file exists at the base of your rails root, and you cd into that folder and type bundle install, you should see a lot of terminal whizz by, and your app should suddenly have everything it needs to start up properly.

I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.

You've probably borked your Apache install somewhat. See if you can get to a bare virtual host, just a folder with index.html in it. IF that works, then go up a level and make sure that passenger is properly installed, and you've configured a new virtual host for your Rails app. Don't try to share a vhost with another app.

Walter

No offense, but I suggest you ditch the Lynda tutorial. If it doesn’t mention a gem file or a bundle command, that’s not a good sign.

The best (and only) guide to every beginner to Ruby on Rails is a book, called Agile Web Development with Rails. You can find it here: http://pragprog.com/book/rails4/agile-web-development-with-rails

Dheeraj Kumar

I'll comment below.

Bill,         First, I really appreciate your help. At the risk of sounding na�ve, in response to Dheeraj�s post that �You need to add it to the gemfile and run the bundle command.� How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.

Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.

Yes, I was trying from the host OS. I do have KDE installed in Linux so I can browse to the Webrick link.

Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn�t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/      Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.

Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).

I wonder why I cannot get an app created in RoR with support for mysql?

If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.

Can you expand on this? What will Passenger do?

      It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR. 1) test_app from the tutorial: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn�t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public. 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn�t need mysql. However, when I added that to the command line: rails new simple_cms �d mysql I got the message: �An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that �gem install mysqsl2 �v �0.3.11�` succeeds before bundling. So, I then enter gem install mysql2 �v �0.3.11� Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error. What is curious is that if I include the ` after the gem install mysql �v �0.3.11� it gives me a different prompt. 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem? I don�t know what the latter means. I can look at the Gemfile and it has this in it: source :rubygems

gemspec

Your gemfile should have quite a bit more than that inside it, at least on a bare Rails app. Here's one now:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

# Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

# Gems used only for assets and not required # in production environments by default. group :assets do   gem 'sass-rails', '~> 3.2.3'   gem 'coffee-rails', '~> 3.2.1'

  # See GitHub - sstephenson/execjs: Run JavaScript code from Ruby for more supported runtimes   # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

# To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON # gem 'jbuilder'

# Use unicorn as the app server # gem 'unicorn'

# Deploy with Capistrano # gem 'capistrano'

# To use debugger # gem 'debugger'

IF that file exists at the base of your rails root, and you cd into that folder and type bundle install, you should see a lot of terminal whizz by, and your app should suddenly have everything it needs to start up properly.

How do I get a Gemfile that is like that? My installation process didn't seem to work.

I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.

You've probably borked your Apache install somewhat. See if you can get to a bare virtual host, just a folder with index.html in it. IF that works, then go up a level and make sure that passenger is properly installed, and you've configured a new virtual host for your Rails app. Don't try to share a vhost with another app.

I need to learn more. Like how to get a bare virtual host... do you mean reinstall apache somehow? Create a new install of Ubuntu in the VirtualBox? I do have root access to a dedicated server but it uses CentOS and so that is different and I'm only just now learning Linux. Thanks, Bruce

Walter

I'll comment below.

Bill,        First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.

Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.

Yes, I was trying from the host OS. I do have KDE installed in Linux so I can browse to the Webrick link.

Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/     Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.

Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).

I wonder why I cannot get an app created in RoR with support for mysql?

Please copy and paste the exact rails new … command you typed into terminal when you created your test app.

There are tons of flags you can use to set up rails with various databases. By default, it will use SQLite3, because that just works most places. If you pass -d mysql to the new command, you will get a mysql connector. But note that you don't have to do this at the beginning of your project. You can create a default (SQLite) application, then transfer it to MySQL or PostgreSQL or anything else that's supported, later in the project life-cycle by changing a few lines of your gemfile and database.yml files.

If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.

Can you expand on this? What will Passenger do?

Passenger is one of the ways to serve Rails applications. Think of it as mod_php but for Rails. It's an Apache module that understands the structure of a Rails application and how to pass Web requests from Apache into Rails. Learn more at http://modrails.org

     It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR.

I would take the patient advice of many others on this list, and please put down the Lynda tutorial. Pick up the http://railstutorial.org path instead. This is a FREE course that teaches you how to go from nothing to a working, tested Rails app hosted on Heroku (which is also free) and will give you the leg up you need without immersing you in the minutia of installation hell where you seem to be circling. You will still want to get a working local install of Rails, which will include being able to browse your test site (hosted out of Webrick) locally at http://localhost:3000 But that is really not as hard as your combination of aged tutorial and lack of experience in Linux is giving you. There are even instructions in railstutorial that will show you how to get Rails installed directly under Windows, although I would urge you to charge on and get it to work in your Linux environment instead.

1) test_app from the tutorial: How to install Ruby on Rails in Ubuntu 12.04 LTS – SUDOBITS Blog **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public. 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line: rails new simple_cms –d mysql I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter gem install mysql2 –v ‘0.3.11’ Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error. What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt. 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem? I don’t know what the latter means. I can look at the Gemfile and it has this in it: source :rubygems

gemspec

Your gemfile should have quite a bit more than that inside it, at least on a bare Rails app. Here's one now:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

# Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

# Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1'

# See GitHub - sstephenson/execjs: Run JavaScript code from Ruby for more supported runtimes # gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

# To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON # gem 'jbuilder'

# Use unicorn as the app server # gem 'unicorn'

# Deploy with Capistrano # gem 'capistrano'

# To use debugger # gem 'debugger'

IF that file exists at the base of your rails root, and you cd into that folder and type bundle install, you should see a lot of terminal whizz by, and your app should suddenly have everything it needs to start up properly.

How do I get a Gemfile that is like that? My installation process didn't seem to work.

Again. Please post the rails new command that you typed (at its most basic, this will be `rails new mynewapp` and it will be followed by a bunch of feedback from the rails command, culminating in a working Rails app). Also post the output of rails -v in your terminal.

I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.

You've probably borked your Apache install somewhat. See if you can get to a bare virtual host, just a folder with index.html in it. IF that works, then go up a level and make sure that passenger is properly installed, and you've configured a new virtual host for your Rails app. Don't try to share a vhost with another app.

I need to learn more. Like how to get a bare virtual host... do you mean reinstall apache somehow? Create a new install of Ubuntu in the VirtualBox? I do have root access to a dedicated server but it uses CentOS and so that is different and I'm only just now learning Linux.

If you started with a distribution of Linux that included Apache already configured, you may have a working copy of Apache. Try launching Apache in your terminal:

sudo apachectl configtest sudo apachectl start

(substitute apache2ctl if apachectl doesn't work -- depends on the distro)

If configtest doesn't report any errors, start may tell you Apache is already running. If not, it will start it. When Apache is running, then try going to http://localhost in your Linux browser, and see what you see there. You should see the default host, which in many Ubuntu versions is a white page with the words It Works! really big at the top.

If that works, then move on to installing Passenger, which will get you a connection between Apache and Rails. The Passenger installer will probably tell you to install a half-dozen packages, and it will tell you explicitly how to do this. Like I said, it's very patient.

Walter

Hello,        Thanks Walter for your suggestions and information. I definitely follow advice. Here's some surprising news. I actually got everything working right inside Windows while still trying to get things to work in Linux!!! My Linux installation does not even have the mysql gem or the mysql2 gem installed. I thought for sure I had it installed earlier.          Some of the issues of trying to get Rails working in Linux as recommended deal with my ability to do simple things like capture the output of any command to a file. This would greatly help me to answer some of your questions about what is going wrong.          I did figure out some things about a rails app that change how I might try to access a page. For example, if I launch Webrick, and then navigate to http://localhost:3000/demo/index I get my demo controller and index action. It is inside an app called simple_cms, or it could be in demo_app. However, if I try to visit http://localhost:3000/simple_cms/demo/index that doesn't work. I get a "Routing Error" No route matches (GET) "simple_cms/demo/index        So, how does Rails know which application to run if you had many apps installed? For example, I have a testing environment where I use xampp. I thought I'd install my rails app there and just use apache which is already installed on my system. And I have many websites/applications in the htdocs folder. Therefore, if I wanted to setup a simple cms based on php, I'd maybe put it in htdocs/simple_cms/ and then I would know that I need to include the directory simple_cms so that Apache knows how to deliver pages, with each folder being self-contained. With Rails, how would this work, I have a folder where I put files, for example the htdocs folder (maybe I shouldn't use that for the Rails apps to avoid confusion), my sites directory. So, I might have inside the sites directory the following: simple_cms mysecond_app mythird_app and these would all be directories under the sites directory. How does Ruby on Rails know which one to serve?

        Ok, at the risk of going off topic and discussing Linux issues, could I ask that you tell me how I might issue the commands you mention, such as the rails new command such that the output can be sent to a file that is easy to find. I currently use putty for Windows and haven't figured out how to select content and copy it to the Windows clip board so that I could then paste that to a text editor.      My problems are with regard to where I left off in my Linux installation of Ruby on Rails, I couldn't get the gem mysql or gem mysql2 to install. When I type in gem list, I don't see either of those. I type in my linux sandbox: rails new demo_app -d mysql I get Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. Below that, an error occurred while installing mysql2 (0.3.11) and Bundler cannot continue. Make sure that 'gem install mysql2 -v '0.3.11'` succeeds before bundling. At which point, I try to do Sudo Gem install mysql2 and I get asked for my password and then it says the command sudo gem isn't recognized. So, I try it without sudo and it fails to install.       I did pick up that book that happens to be directly related to the tutorial that you sent to me. Thanks, Bruce

Hello,      Thanks Walter for your suggestions and information. I definitely follow advice. Here's some surprising news. I actually got everything working right inside Windows while still trying to get things to work in Linux!!! My Linux installation does not even have the mysql gem or the mysql2 gem installed. I thought for sure I had it installed earlier.        Some of the issues of trying to get Rails working in Linux as recommended deal with my ability to do simple things like capture the output of any command to a file. This would greatly help me to answer some of your questions about what is going wrong.        I did figure out some things about a rails app that change how I might try to access a page. For example, if I launch Webrick, and then navigate to http://localhost:3000/demo/index I get my demo controller and index action. It is inside an app called simple_cms, or it could be in demo_app. However, if I try to visit http://localhost:3000/simple_cms/demo/index that doesn't work. I get a "Routing Error" No route matches (GET) "simple_cms/demo/index

     So, how does Rails know which application to run if you had many apps installed? For example, I have a testing environment where I use xampp. I thought I'd install my rails app there and just use apache which is already installed on my system. And I have many websites/applications in the htdocs folder. Therefore, if I wanted to setup a simple cms based on php, I'd maybe put it in htdocs/simple_cms/ and then I would know that I need to include the directory simple_cms so that Apache knows how to deliver pages, with each folder being self-contained. With Rails, how would this work, I have a folder where I put files, for example the htdocs folder (maybe I shouldn't use that for the Rails apps to avoid confusion), my sites directory. So, I might have inside the sites directory the following: simple_cms mysecond_app mythird_app and these would all be directories under the sites directory. How does Ruby on Rails know which one to serve?

Only one Rails app can be running at a time on a single port. You can start one with rails s -p 3001 in one directory, and then cd into a different directory and use rails s, and you'll have two different Rails apps running at once on 3000 and 3001. You'll need to put the correct port into your browser to see each one, and this is kind of silly (unless you're experimenting with having one app talk to another, as in an oath server/client setup, say) but there you go, that's how it works. If you have Apache running, and passenger, and you've configured multiple virtual hosts, then you can access them on the same port just by setting up some sort of name resolution on your local box. Put the following in /etc/hosts:

127.0.0.1 one.app.dev 127.0.0.1 two.app.dev

and as long as you have configured your vhosts to have those names in Apache, you will be able to access those two made-up domain names on your local computer without entering any port number (they'll be running in port 80 -- the default).

      Ok, at the risk of going off topic and discussing Linux issues, could I ask that you tell me how I might issue the commands you mention, such as the rails new command such that the output can be sent to a file that is easy to find. I currently use putty for Windows and haven't figured out how to select content and copy it to the Windows clip board so that I could then paste that to a text editor.

Try using the Web interface to this list; either the Google Groups one, or the original at Rails - Ruby-Forum Then you can copy and paste from your terminal in Linux. I have only ever tried to use virtualbox on Mac OS X, where there is a menu command to move the clipboard from the guest to the host and vice-versa. You might also look into that option.

   My problems are with regard to where I left off in my Linux installation of Ruby on Rails, I couldn't get the gem mysql or gem mysql2 to install. When I type in gem list, I don't see either of those. I type in my linux sandbox: rails new demo_app -d mysql I get Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. Below that, an error occurred while installing mysql2 (0.3.11) and Bundler cannot continue. Make sure that 'gem install mysql2 -v '0.3.11'` succeeds before bundling. At which point, I try to do Sudo Gem install mysql2 and I get asked for my password and then it says the command sudo gem isn't recognized. So, I try it without sudo and it fails to install.

You may need to back up quite a bit. Make sure that rubygems is installed, and the way you do that is with the command gem env in a terminal. If you don't get a nice listing of your Ruby and Rubygems environment, then start your googling. Don't use a package to install rubygems, use the source!

Once you have rubygems working, then find a package for the mysql-dev package, which will have all the headers you need to install the mysql2 gem. You didn't paste the entire error message, but I'm betting you don't have the source code on your system that the rubygems environment needs to build that gem. There are two parts to it (and some other gems as well) -- the ruby part, which is platform-agnostic, and the native C bindings, which have to be compiled for your hardware. Without the source code for MySQL, you won't be able to build the latter part.

    I did pick up that book that happens to be directly related to the tutorial that you sent to me. Thanks, Bruce

Hope this helps, and hope you get things going and begin to understand how it all works.

Walter

In a terminal you can probably do Edit > Copy (or Ctrl-Shift-C) then open your editor and paste the contents in and save it.

By the way you are much more likely to get helpful answers here if you can keep your questions simple. No need to give us your life history, just describe the problem you are having. Also best to ask only one question at a time.

Colin