문서의 이전 판입니다!
package 를 찾아보면 ruby, ruby1.8 이 있는데 이중에서 어떤 것을 설치해야 할지 모르겠다. 버전이 약간 차이가 있는데, 다른 부분은 어떻게 다른지 알 수 없다. 다시 확인해보니, ruby 를 설치하면 ruby1.8이 함께 설치되는 것이었다. 그러므로 다음과 같이 설치하면 된다.
# apt-get install ruby irb ri libfcgi-ruby1.8 libpgsql-ruby1.8
RubyGems는 Ruby의 표준 패키지 관리프로그램이다. 그런데 아직 Debian Linux에는 RubyGems 패키지가 나오지 않은 듯 하다.
# wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz # tar xvfz rubygems-0.9.0.tgz # cd rubygems-0.9.0 # ruby setup.rb
Debian Linux 에서는 아직 지원되지 않는 패키지라서 직접 소스로 설치해야 한다. 우선 프로그램을 설치할 디렉토리를 생성한다.
# mkdir /opt/rails
mongrel 을 설치하기 위해서는 ruby 1.8.4 이상의 버전이어야 한다.
# cd /opt/src # wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz # tar xvfz ruby-1.8.5.tar.gz # cd ruby-1.8.5 # ./configure; make; make install
RubyGems는 Ruby의 표준 패키지 관리프로그램이다.
# cd /opt/src # wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz # tar xvfz rubygems-0.9.0.tgz # cd rubygems-0.9.0 # ruby setup.rb
# gem update --system # gem install rails --include-dependencies
# gem update --system # gem install mongrel mongrel_cluster --include-dependencies
# cd /opt/src # wget http://ftp.kaist.ac.kr/pub/Apache/httpd/httpd-2.2.3.tar.gz # tar xvfz httpd-2.2.3.tar.gz # cd httpd-2.2.3 # ./configure --prefix=/opt/rails/apache2 --enable-modules=so --enable-so \ --enable-rewrite --enable-deflate \ --enable-proxy --enable-proxy-html \ --enable-proxy-balancer --enable-cache \ --enable-mem-cache --enable-headers # make; make install
# apt-get install libxml2 libxml2-dev libxml2-utils # cd /opt/src # wget http://kr2.php.net/get/php-5.1.6.tar.gz/from/kr.php.net/mirror # tar xvfz php-5.1.6.tar.gz # cd php-5.1.6 # ./configure \ --prefix=/opt/rails/php5 \ --with-apxs2=/opt/rails/apache2/bin/apxs \ --enable-xml \ --enable-libxml \ --with-xmlrpc \ --with-iconv \ --enable-calendar \ --enable-sysvshm=yes --enable-sysvsem=yes \ --enable-debug=no --enable-track-vars=yes \ --enable-url-fopen-wrapper=yes \ --enable-ftp \ --enable-memory-limit --enable-mbstring \ --enable-sockets \ --enable-wddx \ --enable-bcmath --enable-mbstr-enc-trans \ --enable-mbregex --enable-exif \ --with-ttf \ --with-pdo-pgsql --with-pgsql --with-openssl=/usr \ --enable-gd-native-ttf --enable-gd-imgstrttf \ --with-gd \ --with-freetype-dir=/usr \ --with-tiff-dir=/usr \ --with-png-dir=/usr --with-zlib-dir --with-jpeg-dir=/usr \ --with-mysql=/usr/local/mysql \ --with-gdbm=/usr # make; make install
# vi /opt/rails/apache2/conf/httpd.conf LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php .html .htm .inc AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html Include conf/extra/httpd-vhosts.conf # vi /opt/rails/apache2/conf/extra/httpd-vhosts.conf # PHP 파트 <Directory "PHP웹루트디렉토리"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost 아이피주소> DocumentRoot PHP웹루트디렉토리 ServerName PHP도메인이름 </VirtualHost> # Rais 파트 <Directory "RAILS웹루트디렉토리"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost 아이피주소> ServerName RAILS도메인이름 RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /system/maintenance.html [L] RewriteRule ^/$ /index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] AddOutputFilterByType DEFLATE text/html text/plain text/css BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html </VirtualHost>
만약 /opt/www/test 라는 RAILS웹루트디렉토리를 만들고 싶다면 다음과 같이 실행한다.
# cd /opt/www # rails test
# mongrel_rails start -d -p 8000 -e production -P log/mongrel-0.pid -c /opt/www/test # mongrel_rails start -d -p 8001 -e production -P log/mongrel-1.pid -c /opt/www/test # mongrel_rails start -d -p 8002 -e production -P log/mongrel-2.pid -c /opt/www/test # /opt/rails/apache2/bin/apachectl start
이렇게 하고 해당 URL을 웹브라우저로 접근해 본다. ^^
# mongrel_rails stop -P log/mongrel-0.pid -c /opt/www/test # mongrel_rails stop -P log/mongrel-1.pid -c /opt/www/test # mongrel_rails stop -P log/mongrel-2.pid -c /opt/www/test
mongrel_cluster를 이용하면 mongrel_rails 시작/중지시 귀찮은 타이핑 수고를 덜 수 있습니다.
# cd /opt/www/test # mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /opt/www/test
위 명령을 실행하면 RAILS_ROOT/config/mongrel_cluster.yml이 만들어지고, 그 후에는
# cd /opt/www/test # mongrel_rails cluster::start # mongrel_rails cluster::stop
명령으로 기동/중지를 할 수 있습니다.
RoR에 가장 적합한 환경인 lighttpd + FCGI 환경을 구축하려는데, Debian Stable 에 lighttpd 패키지도 존재하지 않는다. 그러므로 별도로 패키지를 받아서 설치해야 한다. 먼저 lighttpd 를 설치하기전에 필요한 패키지부터 설치한다.
# apt-get install libpcre3 zlib1g
http://www.lighttpd.net/download/ 으로 가서 데비안 패키지를 다운로드 받아서 설치한다.
# wget http://www.lighttpd.net/download/debian/sarge/lighttpd_1.4.3-1_i386.deb # dpkg -i lighttpd_1.4.3-1_i386.deb
만약 Debian이 unstable 이라면 다음과 같이 바로 설치할 수 있다.
# apt-get update # apt-get install lighttpd lighttpd-doc
소스를 직접 데비안 패키지로 만들어서 설치하려면 다음과 같이 한다.
???
다음으로 log 디렉토리의 소유자:그룹을 재설정하고 configuration 파일을 생성한다.
# chown www-data:www-data /var/log/lighttpd/ # cd /etc/lighttpd # cp lighttpd.conf.dpkg-new lighttpd.conf