顯示包含「installation」標籤的文章。顯示所有文章
顯示包含「installation」標籤的文章。顯示所有文章

星期二, 7月 17, 2007

Installing RMagick on Ubuntu

Before install RMagick, we need to install ImageMagick and the delegate libraries used by ImageMagick.

Here are some recommended delegate libraries:

  • FreeType, Version 2.0 or above, to annotate with TrueType and Poscript Type 1 fonts.
  • libjpeg to read and write JPEG v1 format images.
  • The PNG library, to read and write PNG format images.
  • libwmf 0.2.5 or later, to read and write Windows Meta File (WMF) format images.
  • Ghostscript version 8.10, to read and write the PDF and PS document formats.
For the default Ubuntu 7.0.4 installation, I have to install FreeType v2 from a tarball. For the libjpeg, libpng, and libwmf, the runtime library are installed, so I just need to install the development library. Since I am too lazy, I just install those thru Synaptic Package Manager.

For the ghostscript, remember to install fonts into /usr/share/ghostscript; otherwise RMagick will complain during compilation.

Step 1: Install ImageMagick

Go to http://www.imagemagick.org and download the latest version of the software to a temporary directory.
tar xvzf ImageMagick.tar.gz
cd ImageMagick-X.Y.Z
Then configure ImageMagick
./configure --disable-static --with-modules --without-perl \
--without-magick-plus-plus --with-quantum-depth=8
Once you have configured ImageMagick the way you want it, enter these two commands:
make install
sudo make install

Step 2: Install RMagick

Issue the command

sudo gem install rmagick
You will see this output:
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions. This could take a while...
Successfully installed rmagick-1.15.7

Be patient. A lot of time will pass with no output from the gem command. The "Successfully installed" message does not mean that RMagick was successfully installed. The RMagick installation can encounter error conditions that gem can't detect. The following irb session is a better indicator of a successful install.

$ irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version
This is RMagick 1.15.7 ($Date: 2007/06/09 16:45:25 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.5 07/17/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
=> nil

The RMagick HTML documentation is automatically installed at
/usr/local/share/RMagick/index.html.


Done!!!

星期一, 3月 26, 2007

ror installation

My steps to install Ruby On Rails 1.8.5 over ubuntu 6.0.6

Prep
Make sure you have gcc complier and zlib development package installed. If not sure, please run

apt-get install build-essestial
apt-get install zlib1g-dev
Ruby
Download ruby-1.8.5-p12.tar.gz from http://www.rubyonrails.org
tar xzvf ruby-1.8.5-p12.tar.gz
cd ruby-1.8.5-p12
./configure --prefix=/usr/local --enable-pthread
make
sudo make install
sudo make install-doc
cd
..
If you saw lots of text fly by but didn’t get that error, it means that we should now have a brand new Ruby installed.

We can verify this (as well as a correct path setting) by typing the following command:

ruby -v
You should see something like this:
ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux]
zLib
Download zlib package from
http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar zxvf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb
make
sudo make install
cd ..
RubyGems
Download rubygems package rubygems-0.9.2.tgz from
http://rubyforge.org/projects/rubygems/
tar xzvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
sudo /usr/local/bin/ruby setup.rb
cd ..
RubyOnRails
With RubyGems installed, Rails is a simple, one-line install:
sudo gem install rails --include-dependencies
* gem respects the following variables for proxy settings
  • http_proxy
  • HTTP_PROXY
  • NO_PROXY

星期日, 3月 25, 2007

Ruby on Rails 伺服器架設原理

一般來說,Ruby on Rails 架設原理很簡單,分成三個部份。

  1. Frontend Server
  2. Application Server
  3. Database Server
每個部份都有自己的功用。


Frontend Server 負責將所有 HTTP Request forward 給後端的 Application Server,也就是他是作類似 Reverse proxy 的工作。一般來說,Apache 2.2 跑 mod_reverse_proxy 是最常出現的選擇,nginx 也是不錯的選擇。Lighty 1.5 之後跑 mod_proxy_core 也很方便,等到 1.5 release 之後我會作詳細的評估。
Application Server 負 責跑 Ruby on Rails 程式,你寫好的程式就在上面跑。一般來說可以用 Webricks,Fastcgi,scgi,Mongrel 等等 Ruby on Rails Runner來跑。Webricks 太慢,Fastcgi 有穩定性,以及不好設定的疑慮。SCGI 太年輕。目前最穩,最好用,而且已經被驗證過的 Application Server 就是 Mongrel。

Database Server 就是處理資料處理的工作。可以跑 SQLite,MySQL 之類的 RDBMS 。甚至使用 File 來當資料處理,或是使用 NFS 也未嘗不可。不過這裡通常大家都是使用一般大廠的 RDBMS資料庫。

組合方式

Apache 2.2 + Mongrel:穩定,高彈性的組合

Apache 2.2 遇到 user request 用 HTTP 分配給 Mongrel ,然後 Mongrel 去跑。這個組合的好處是每個 Application Server node 都可以很輕易的拆成不同台機器,並且很好管理。Apache 的穩定又是出名的。雖然不見得最快,但是方便 scale 以及穩定是他最好的優點。目前所有組合當中最穩定的方式,很多流量最大的 Ruby on Rails 站台也都是使用這個方式。適合在已經有一定規模的網站。設定方式在此我有介紹。

Lighttpd + Fastcgi:單機最佳選擇
Lighttpd 1.4 跑 PHP 或是跑 Ruby on Rails 都是這樣跑。Lighttpd 為 Frontend Server ,他接到 request ,經由 unix socket 送給身為 Application Server 的 Fastcgi ,Fastcgi 再執行 Ruby on Rails 程式。通常這個方式是 Frontend Server 跟 Application Server 跑在同一個機器上面的,當然每個 Fastcgi 也可以跑在 TCP Mode ,然後 Fastcgi 放在不同機器上面,不過設定不易不常使用這個方式。這個組合的好處是執行效率非常快速,如果 Frontend 跟 Application 放在同一台機器上,Lighty 這個組合遠比 Apache 的組合來得輕快許多。但是缺點是多台機器設定複雜,不易擴展到多台機器上,Fastcgi 又有在高負載下罷工的負面報導。相反的,單台機器上面 Fastcgi 設定管理簡單,速度又飛快,非常適合小網站剛剛起步時,機器不足,流量不大的需求。設定方式在此我有介紹。

Nginx or Lighttpd 1.5 + Mongrel:未來的新選擇

類 似Apache 的組合,但是 nginx 或是 Lighttpd 1.5 都有一個優點,不像 Apache 2.2 那麼肥。反正這個 Frontend 只要作 reverse proxy 的工作,其實不需要 Apache 那麼大的 Server 來作。好處是 Frontend Server 比較快速。壞處是 nginx 這個俄國來的 Server 大家不熟悉,doc 又很少(俄文是很多啦)。Lighttpd 1.5 又只在 pre-release 階段,穩定程度還是得花點時間。不過如果扣掉 Frontend 的 X factor,這個組合兼具輕快跟方便 Scale ,可說是最好的組合。lighty 1.5設定方式在此我有介紹。nginx 的設定檔這裡有範例,可以參考。

[via: http://lightyror.thegiive.net/2006/12/ruby-on-rails_30.html]