Here is configuration of my host system:
Processor: Intel Core 2 Duo CPU, RAM: 2GB, Operating System: Windows 7 Enterprise
Now To use Ubuntu (Linux based OS) with above configuration, follow below steps-
1. Download and Install VMWare Player which is free for personal non-commercial use. VMware Player is only distributable with written permission from VMware. So don't share the exe/setup, download it separately.
2. Download ISO of Ubuntu.
3. Create a New Virtual Machine for Ubuntu using VMware Player. Just follow 'Next' Its simple. It takes default 512 MB of RAM but I did allocate 896 MB of RAM as I had 2 GB of RAM. (It might install required files.)
Now you have Ubuntu ready on your windows based system. To install Ruby and Rails using RVM please follow below steps-
1. To install RVM you need git. Run below command to install git-
ubuntu@ubuntu:~$ sudo apt-get install git
And then follow installation steps for RVM here.
OR
Run below command in terminal-
ubuntu@ubuntu:~$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)And then follow steps mentioned in output of above command to update .bashrc.
2. After installing RVM successfully follow below steps to install ruby and rails. Steps mentioned below are used to avoid the issue mentioned here.
ubuntu@ubuntu:~$ rvm pkg install zlib
ubuntu@ubuntu:~$ rvm pkg install openssl
ubuntu@ubuntu:~$ rvm install 1.8.7 -C --with-openssl-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr
3. Create new gemset using rvm.
ubuntu@ubuntu:~$ rvm gemset create rails_3
4. Check available version of ruby and gemset.
ubuntu@ubuntu:~$ rvm list
ubuntu@ubuntu:~$ rvm gemset list
5. Set default versions of Ruby and Rails using rvm. I am using ruby-1.8.7-p352@rails_3 as I have installed ruby 1.8.7 and created gemset named as rails_3.
ubuntu@ubuntu:~$ rvm use --default ruby-1.8.7-p352@rails_3
6. Now you can install rails.
ubuntu@ubuntu:~$ gem install rails
You are ready with ruby and rails, Now you need database. You can simply install mysql or postgresql using apt-get install command or from ubuntu software center.
I wanted to use Oracle but I didn't install it on my ubuntu system (virtual machine) as it's running less than 1 GB RAM which is kind of minimum requirement for oracle database. And I have already installed Oracle XE on my host system so I am going to use it using Host IP address in my database.yml of rails app.
To use oracle I need to install ruby-oci8 and activerecord-oracle_enhanced-adapter gems.
1. Follow steps here to install ruby-oci8 using InstantClient.
2. If you are facing any issues to install gem ruby-oci8, you have to set path for LD_LIBRARY_PATH in your .bashrc. Eg: export LD_LIBRARY_PATH="/opt/oracle/instantclient_11_2"
Apart from these you have to install few required libraries and application like tortoisesvn, NetBeans(IDE) etc. Currently I am using Ubuntu just by using 896MB of RAM and it works fine.
Few things to remember while using this combination-
1. Increase RAM size allocated from 512MB, if you are going to use NetBeans as it takes bit lot memory.
2. Increase number of Processors to 2 if you have core 2 Duo, Default its set to only 1. It really helps.
3. From Virtual Machine Settings -> Hardware -> CD/DVD Device, dis-select 'Connect at power on' check box as you may not have CD-ROM available.
4. CTRL+G is used to enter into Virtual Machine and CTRL+ALT get out of it.
CTRL+ALT+DELETE call is taken by both Virtual Machine and host system. So make sure you will be using host system if you want to lock it.
5. Add terminal in SYSTEM->PREFERENCES->KEYBORAD SHORTCUTS.
You can use- Name: CTRL+ALT_DELETE and Command: gnome-editor
6. If you want to have shared folder between host system and virtual system, refer the article here to update Virtual Machine Tools first and then you can simply add folders from Virtual Machine Settings -> Options -> Shared Folders. You will get them in /mnt/hgfs
Note: I was using a network where I was able to download all required software.
Great post Manohar ! Thanks for sharing this.
ReplyDeleteCool.. Loved it!
ReplyDeleteNice write up - this sounds like a lot less work than getting Rails and all of your gems setup to work on Windows properly. And I bet it will be much faster!
ReplyDeleteThanks!
As Ankit has already said 'Loved it'. Just to let you know this is immensely helpful upto the extent that the specs which used to run for 5 mins on windows, they run in 18.25 secs! This should be now mandatory for people who are building web apps on RoR and still have to work on Windows OS.
ReplyDeleteI just faced one trouble (http://stackoverflow.com/questions/7271642/after-setting-up-rvm-and-ruby-187-getting-this-error-of-undefined-symbol-rb-dig), but later got an answer and resolved it
nice post Manohar keep up the good work on ror application development
ReplyDeleteOffshore Software Development Services
This comment has been removed by the author.
ReplyDelete