Archive
| Mo | Tu | We | Th | Fr | Sa | Su | |
|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | |||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 | |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 | |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 | |
| 27 | 28 | 29 | |||||
Poll: Social Media
Did you enjoy this article?
Iseng bikin CMS pake ruby on rails http://www.refinerycms.com/ opensource
During the installation process, we selected the “Software Development” package which includes the tools (e.g., gcc, svn, git, make) and libraries needed for building and compiling software.
1. Development tools
First, let’s check to see if you have the basic set of development tools — gcc, make and git. Although these tools are installed as part of the “Software Development” package, you can check if they are on your system by running ‘which gcc make git‘ at the command line.
[root@fc10 ~]# which gcc make git
/usr/lib/ccache/gcc
/usr/bin/make
/usr/bin/git
Note: On Fedora 10 64-bit systems, the full path to gcc is /usr/bin/gcc.
If the tools are not on your system, then you can install them by running the following command.
[root@fc10 ~]# yum install gcc make git
2. Databases: MySQL, SQLite
A typical Rails application is backed by a relational database. We will install both MySQL (v5.0.77) and SQLite (v3.5.9) for our environment. Recent versions of Rails default to using SQLite. If set up on your system, however, MySQL is also easily used.
[root@fc10 ~]# yum install mysql-server mysql-libs mysql-devel
[root@fc10 ~]# yum install sqlite sqlite-devel
3. Ruby language
Next, we’ll install the core packages for Ruby (v1.8.6.287). We’ll also need the two packages ruby-mysql and ruby-sqlite3 for database access from Ruby programs.
[root@fc10 ~]# yum install ruby ruby-devel ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs ruby-mysql ruby-sqlite3
4. RubyGems
RubyGems is the packaging system for Ruby applications and libraries. Each application or library is known as a gem. By default, gems are installed in ‘/usr/lib/ruby/gems‘ (’/usr/lib64/ruby/gems‘ on Fedora 10 64-bit systems). RubyGems lets you easily install and remove gems using the gem command. We’ll install the latest version of RubyGems (v1.3.2).
[root@fc10 ~]# wget -q http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz
[root@fc10 ~]# tar xzf rubygems-1.3.2.tgz
[root@fc10 ~]# cd rubygems-1.3.2
[root@fc10 rubygems-1.3.2]# ruby setup.rb
5. Rails
Now that we have a sparkling RubyGems toolset, the first gem we are going to install is the Rails (v2.3.2) web application framework. An advantage of installing Rails using the gem command is that package dependencies are resolved automatically.
[root@fc10 ~]# gem install rails
6. Mongrel
Rails provides WEBrick, a simple HTTP server that can be used to test applications during development. However, WEBrick is not suited for production environments. Mongrel is a web server commonly used for Ruby web applications. A typical configuration consists of a Mongrel cluster (several Mongrel instances) behind a front-end Apache web server. We’ll install Mongrel 1.1.5.
[root@fc10 ~]# gem install mongrel mongrel_cluster
7. JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format - a sort of “low-fat” alternative to XML. We’ll install the Ruby implementation of the JSON specification, json (v1.1.4). This allows the conversion of Ruby objects to JavaScript objects for use by clients running on the browser.
[root@fc10 ~]# gem install json
8. SQLite3 Ruby
The sqlite3-ruby gem provides Ruby bindings for SQLite3 databases, the default database system for recent Rails environments. We’ll install version 1.2.4.
[root@fc10 ~]# gem install sqlite3-ruby
9. Ruby MySQL
The mysql gem provides a client-side MySQL API for Ruby programs. Before we install the gem, we’ll need to create symbolic links in ‘/usr/lib‘ (’/usr/lib64‘ on Fedora 10 64-bit systems) to point to the MySQL client libraries installed in ‘/usr/lib/mysql‘ (’/usr/lib64/mysql‘ on Fedora 10 64-bit systems).
Fedora 10
[root@fc10 ~]# cd /usr/lib
[root@fc10 lib]# ln -s mysql/libmysqlclient.so
[root@fc10 lib]# ln -s mysql/libmysqlclient.so.15
[root@fc10 lib]# ln -s mysql/libmysqlclient_r.so
[root@fc10 lib]# ln -s mysql/libmysqlclient_r.so.15
Note: On Fedora 10 64-bit systems, the symbolic links should be created in ‘/usr/lib64‘.
Fedora 11 Beta
[root@fc11 ~]# cd /usr/lib
[root@fc11 lib]# ln -s mysql/libmysqlclient.so
[root@fc11 lib]# ln -s mysql/libmysqlclient.so.16
[root@fc11 lib]# ln -s mysql/libmysqlclient_r.so
[root@fc11 lib]# ln -s mysql/libmysqlclient_r.so.16
Or for the brave, just run this on either Fedora 10 or 11:
[root@fc10 ~]# cd /usr/lib
[root@fc10 lib]# for f in mysql/libmysql*.so mysql/libmysql*.so.1[56]; do ln -s $f; done
Note: On Fedora 10 64-bit systems, the symbolic links should be created in ‘/usr/lib64‘.
Now, we are ready to install the Ruby MySQL (v2.7) gem by running the following command.
[root@fc10 ~]# gem install mysql
10. Riding the Rails
Now it’s time to test your installation. A great way to do this is to follow the simple tutorial at ‘Getting Started with Rails‘. Build the blogging application described there twice: once for SQLite3 and then again for MySQL. If the application can be built without errors, your database environments are set up properly.
That’s it! Your shiny new environment is waiting for you to build your next Rails application on Fedora using SQLite and MySQL
cd testing
rake db:setup
rake gems:install
ruby script/server





J o u r n a l


