Ruby on Rails installation on Wind7 64

Source: Internet
Author: User
Tags ruby on rails

Ruby on Rails in various pits on the window platform, the configuration process is quite painful.


Expected installation content:

MySQL server

Ruby 2.0.0

Rails 4.0.2

MYSQL2 0.3.16


installation files:

MySQL official website: http://dev.mysql.com/downloads/windows/installer/

Select the 64-bit installation file to download the installation


railsinstaller:http://www.railsinstaller.org/en

The official version is 1.9.3 Ruby, but there is an alpha version of the ruby2.0, so choose to install this beta.

This installer contains ruby,rails,git,gem,sqlite and so on, is considered as a key installation, very convenient.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/4B/F8/wKioL1Q2OlmQmrjNAADha7T4kYE565.jpg "title=" Unnamed. png "alt=" wkiol1q2olmqmrjnaadha7t4kye565.jpg "/>


Of course, the only recommended way to learn from the Ruby website is to install Ruby First, install the gem, and then install rails through the gem. However, there are a variety of inexplicable problems when connecting to DB later. Abandon it.


Once the installation is successful, you can play with new project.


MYSQL2 Installation

Development because you want to use MySQL, the DB should be configured as MySQL. (Here is where the tragedy began, hehe)


Ruby installed with the Railsinstaller above is 32-bit. Do not know what is the reason, the direct installation of MYSQL2 will fail, but also need a connector.

First download this connector:http://dev.mysql.com/downloads/connector/c/select the 32-bit zip package, do not use the installation package.

After downloading the decompression, put in a path, this road is best without Chinese no space. To execute the installation command:

Gem install mysql2-v ' 0.3.16 '--platform=ruby--'--with-mysql-dir= ' above connector decompression of the road "'

For example, mine is:

Gem install mysql2-v ' 0.3.16 '--'--with-mysql-dir= ' C:\mysql-connector-c-noinstall-6.0.2-win32 '

This will allow the installation to succeed.


After successful installation, you need to do connectpath/lib inside the Libmysql.dll libmysql.lib these two files into the ruby/bin inside.


Common commands:

Gem Install

Gem Uninstall

Gem List lists the gems that are already installed in the gem

GEM Update update

Gem sources view the source used by the gem


Rails New ProjectName--Create a new ROR project

Rails server--start rail server, similar to booting tomcat

Rails Generate scaffold--new scaffolding, this is the reason why Ruby benefits 1min to build a blog.

Rails Destory Scaffold--removing scaffolding


Bundle Install

Bundle update

Bundle Show--show a gem location


PS: Look at my list of commands, I know that I can not be a little more elementary white ... )


about troubleshooting:

Personally, rails error message is still very powerful, if there is a problem, the first to see what the information is, some general problems even give a solution. It's important to look at information.


Then the most powerful of course is Google Baidu.


Network environment:

Company Limited network, or use agent online, gem related operations are done in CMD, and need to connect to the extranet to get the gem package.

Before installing, it is best to set up the agent:

Set Http_proxy=http://hostname:port

If you use Git for source control, you also need to set up a proxy. (Internet freedom is important, call to unpack Google)


Gem of the default source is a foreign site, unstable, slow, general will be changed to Taobao Mirror, seemingly 15min synchronization once. (http://ruby.taobao.org)


show sources currently in use
Gem Sources

Add a source
gem sources-a URL address

Delete a source
gem sources-r URL address

Update Source Cache
Gem Sources-u


Learning materials:


http://railstutorial-china.org/rails4/

Ruby Development Style Guide

http://guides.ruby.tw/ruby-rails-style-guides/zhCN/

Books

http://railstutorial-china.org/

http://guides.ruby-china.org/


Http://ihower.tw/rails3/index.html


--------------------------------------------------------------------------------------


Install the above step down and you should be able to run a project successfully.

I encountered a lot of problems in configuring the environment,

1 network environment, the company environment needs agents, resulting in a variety of online installation failures. This tangled for a long time, thought will automatically use IE proxy settings.

2 installation version

In the beginning, the 1.9.3 Railsinstaller was installed directly, the Ruby inside was 1.9.3 version, the project used 2.0.0. Discard it and reinstall it. But surprised to find the official version of the installer no 2.0.0. Also did not see the small print of the site mentioned in the beta version.

and then I went straight to ruby2.0.0. (64bit Installation files, install rails and other things through gems after installation.


Ror default to use SQLite, a start did not change to MySQL time, play very smoothly. Then start switching to MYSQL2. It's jammed.

First configuration, online search a variety of tutorials, various failures.

First MYSQL2 installation failed, bundle install failed, gem install MYSQL2 also failed. Slowly Baidu process know need connetor, and then find a variety of versions of connector to try. Because the MySQL installation is 64bit, downloaded the 64bit install version to try, or not. Later know not to install version, to use the zip version, try. After switching to 32bit, there is still no way. Although it is possible to install MYSQL2 successfully, it prompts a ' not valid executable ' error while performing generate scaffold. At this point, completely jammed. Many of the solutions on the Web refer to this problem because 32bit of Ruby and 64bit are incompatible with MySQL. My Ruby is 64bit, I also try to use the 64bit connector also not.

Ps:connector also has version of the points, 6.0.2 and 6.1.5, 6.1.5 used above, sometimes requires 6.0.2, there is a hint to install MySQL.

Some articles refer to the beta version of Railsinstaller, there is no way to go, unloaded the local ruby rails, using the beta version of the Railsinstaller have the above summary.


Although the initial solution to the problem, but still do not know the root cause is what.

The idea of solving the problem is not clear enough, usually a variety of solutions around, mixed together to try, resulting in the last do not know that the program can be, the solution failed completely, which program needs to be tried.

When there are many problems, we can solve them together, which leads to complicated problems and other kinds of inexplicable problems.


-----------------------------------------------------------------------------------------------------------

The problem still exists, there is a project source code in my configured environment still can't. or the MYSQL2 installation problem.


To be Continued ~






















Ruby on Rails installation on Wind7 64

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.