Misc.

How to install ruby on rails with sqlite3 on windows 7?

I have started working on ruby on rails and need to install it on windows 7. I searched on google and found installation help on different sites that is not complete for all packages, so I am writing here and hope it will be helpful.

I downloaded packages related to ruby on rails that are pik-0.3.0.pre, rubyinstaller-2.0.0-p247-x64, DevKit-mingw64-64-4.7.2-20130224-1432-sfx, sqlite-autoconf-3071700.tar.gz.

pik-0.3.0.pre is a tool to manage multiple versions of ruby on windows and it can be used from git bash, windows command line.

Install pik

First install pik anywhere in your system. I installed on D drive, so when successfully installed, open your command line(cmd.exe). Run following command

>pik help commands

Note: if pik is undefined command then check your environment variable. You have to create environment variable for this.

You will see following list

Now before proceed to next first download other packages. Download rubyinstaller-2.0.0-p247-x64 and DevKit-mingw64-64-4.7.2-20130224-1432-sfx from
http://rubyinstaller.org/downloads/

Install Devkit
After downloading extract both on your drive. To install Devkit, open command prompt (cmd.exe) and cd to the folder where you installed devkit and run following commands

>ruby dk.rb init
and

>ruby dk.rb install

Note: if “ruby” is not working then create Environment Variable for ruby.

Add Ruby to pik
Now add ruby to pik by running following command.
>pik add ruby (or path to ruby directory).

Install Rails
Now install rails for this run following command.

>pik gem install rails
It will install different gems that will be used by rails. It will take some time to complete installation.
After that you can see gems list by following command.
>gem list
Or
>pik gem list (this command will show ruby version too)

Install Sqlite3

Till now pik, ruby2.0.0, and devkit is installed. Sqlite is the default db server for rails, so now you need to install sqlite3. To do this, follow following steps.

Download and extract the autoconf package from http://sqlite.org/download.html

  • Run msys.bat (you can find it in the ruby devkit root folder)
  • cd into the path where you downloaded the sqlite source (for instance: “cd /d/sqlite3” for path “d:\sqlite3” if you are new to MSYS/MINGW32)
  • Run “./configure”
  • Run “make”
  • Run “make install”

Now we need to install sqlite3 gem again, this time specifying the platform and the path to the newly compiled binaries:

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=[path\to\sqlite3.h] --with-sqlite3-lib=[path\to\sqlite3.o]

For example, I used it as with my sqlite3 path:

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=/d:/sqlite3/ --with-sqlite3-lib=/d:/sqlite3/.libs/

It will take some time to install sqlite3 gem, you will see installation process command on MSYS.

Whenever you create rails app make sure it points to correct sqlite3 version. You can edit your Gemfile of your app and comment # gem ‘sqlite3’ and add gem ‘sqlite3′,’1.3.7’ save it and go to command prompt (cmd.exe) or git bash, cd to your application and run command “rails server” now check your application in browser.

Congrats you have installed ruby on rails with sqlite3 on windows.

websourceblog

ReactJs, NodeJs, Amazon Web Services, Symfony, Laravel, CodeIgniter, Zend Framework, WordPress, Drupal, Magento, Angular

Recent Posts

How to install and configure Apache2 on WSL2?

I hope you already have WSL2 installed and enabled. So, setting up Apache2 on WSL2…

3 months ago

How to install NVM on Windows?

Install NVM on Windows Node Js is a JavaScript runtime environment used widely in today’s…

5 months ago

How to reset WSL 2 user’s password?

You can easily reset WSL 2 users' password, by just following the following steps. Open…

9 months ago

DreamHost Web Hosting

DreamHost a web hosting company, founded in 1997. It is offering sort of hosting services,…

1 year ago

How to add submenu or menu in any specific menu option in WordPress programmatically?

Menus in WordPress are highly versatile and can be easily modified to change in your…

2 years ago

Laravel 8 error target class controller does not exist.

Laravel is famous and robust PHP framework, widely used in different type of projects. While…

2 years ago