Build a Rails environment in Ubuntu10.04

Source: Internet
Author: User
Tags imagemagick netbeans
Build a rails environment under Ubuntu10.04 under the virtual machine 1: ruby installation 1) installation: sudoapt-getinstallrubybuild-essentiallibopenssl-rubyruby1.8-devirbrdoclibssl-devlibreadline5-devzlib1g-dev2) test installation successful: ruby-v display version number,

Setting up the rails environment of Ubuntu 10.04 under a virtual machine

1: ruby Installation

1)

Installation:

Sudo apt-get install ruby build-essential libopenssl-ruby ruby1.8-dev irb rdoc libssl-dev libreadline5-dev zlib1g-dev

2)

Test whether the installation is successful:

If ruby-v shows the version number, the installation is successful.

2: rubygems Installation

Download rubygems:

Http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz

2: Install rubygems1.8.7:

1) sudo apt-get install rubygems1.8

2) establish a connection: sudo ln-s/usr/bin/gem1.8/usr/bin/gem

Test whether the installation is successful:

If the gem-v version is displayed, the installation is successful.

3: rails Installation

Install rails:

Sudo gem install rails-v = 2.3.4

Test whether the installation is successful:

If rails-v displays the version number, the installation is successful.

4: Install mysql

1) sudo apt-get install mysql-server

2) install the mysql driver

1 sudo apt-get install libmysqlclient15-dev

2 sudo gem install mysql

5: jdk installation (if netbeans is not installed, jdk is not installed)

1) download jdk:

Http://java.sun.com/javase/downloads/index.jsp

2) install jdk:

Create the target directory: sudo mkdir/usr/lib/jvm

Cd jdk file directory (for example, cd Downloads)

Copy file: sudo cp./jdk-6u20-linux-i586.bin/usr/lib/jvm

Cd file copy Folder: cd/usr/lib/jvm

Add execution permission: sudo chmod + x jdk-6u20-linux-i586.bin

Run sudo./jdk-6u20-linux-i586.bin

Then there is a bunch of protocols, with a blank line, until there is a query, naturally enter: yes, press enter to start installation;

The installed JDK is in the/usr/lib/jvm/jdk1.6.0 _ 20 directory;

Set the environment variable through gedit: sudo gedit/etc/profile

Add the following at the end of the file:

Export JAVA_HOME = "/usr/lib/jvm/jdk1.6.0 _ 20"

Export JRE_HOME = "$ JAVA_HOME/jre"

Export CLASSPATH = ".: $ JAVA_HOME/lib: $ JRE_HOME/lib"

PATH = "$ PATH: $ JAVA_HOME/bin: $ JRE_HOME/bin"

Save and exit;

Use: source/etc/profile to reload

3) test whether the installation is successful:

Java-version indicates that jdk is successfully installed;

6: Installation of netbeans (development tools, can be left empty)

1) download netbeans

Http://netbeans.org/downloads/index.html

2) install netbeans

1 add permissions: sudo chmod + x netbeans-6.8-ml-linux.sh

Sudo./netbeans-6.8-ml-linux.sh

3) Chinese netbeans

4)

Toolbar-> View-> display row number

Toolbar-tool-Option-Editor-format setting-remove the check mark for "expanding tabs to spaces"

In the output column, right-click and choose wrap.

1

Download stzhongs. ttf

Http://cid-a304a3ed04e117fd.skydrive.live.com/self.aspx/Font/STZHONGS.TTF

2. Go to jdk's jre/lib/fonts (cd $ JAVA_HOME/jre/lib/fonts) to create the fallback (sudo mkdir fallback) directory and copy stzhongs. ttf file (cp .......).

4) install some gem packages

1 mongrel installation: sudo gem install mongrel

7. svn Installation

Sudo apt-get install subversion

8: Move out of the ihvaeu Project

1) enter the address for storing the project

2) Move out project: svn co http://svn.ihaveu.com/core/server/trunk/

9: Installation of sqlite database and driver

1) sudo apt-get install sqlite3 libsqlite3-dev

Sudo gem install sqlite3-ruby

2) sqlite Testing

Enter sqlite3/home/b456/workspace/mobiletv. db in the client. If sqlite> is displayed, the installation is successful. In this case, the project can use the sqlite3 database.

10: Install the gem package under the project

1) install the imagemagick and rmagick packages.

1 "sudo apt-get install imagemagick

2 sudo apt-get install libmagick9-dev

3 "sudo gem install rmagick

4 "sudo apt-get install memcached

5. Add 'memcached-d' to the top of config-> initializers-> cache_money.rb'

2) Go To The ihaveu project of the client and run: rake gems: install. This step installs the packages required by most projects and runs ruby script/server, the system will prompt you which packages are needed, and install the required packages according to your problems.

1

Problem: nokogiri cannot be installed

Solution:

Sudo apt-get install libxml2-dev libxslt1-dev

Sudo gem install nokogiri

11. Create a database

1) first configure the project root directory-> config-> database. yml File Information

2) create a database: rake: create: all

Problem: Couldn't create database ....

Solution: Modify the socket

Mysql. sock path (my path is/var/run/mysqld. sock)

3) create a table

Create a test database table: rake db: test: prepare

Create a table for the product database: RAILS_ENV = production rake db: migrate

4) import necessary data to the database. rake db: seed

12: Completed

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.