`
huangye177
  • 浏览: 5935 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Rails Linux安装配置全集

阅读更多
最近在railscn的群里面总是看到很多朋友希望在linux里面安装rails缺不得其法,我将自己的安装笔记整理了下,包括ubuntu通用安装系列(ruby, ror, mysql, other plugins, etc),apache/mongrel安装,mysql拷贝备份,以及附带的cvs与ftp安装配置。也希望其他朋友有更好的做法能在本贴下留言,解决新手们此类问题。

转发本帖或引用文档,请注明出处。
ye.huang
BLOG: www.yehuang.net
ROR based recommendation Filter/bookmarks:
http://www.nextdoors.info/


Ubuntu common installation
http://www.yehuang.net/archives/30

Apache2 Mongrel-Cluster Configuration
http://www.yehuang.net/archives/31

Mysql Replication
http://www.yehuang.net/archives/60

Ubuntu cvs installation and configuration
http://www.yehuang.net/archives/44

Ubuntu FTP installation
http://www.yehuang.net/archives/47

分享到:
评论
3 楼 lgn21st 2007-04-11  
Ubuntu 6.10下面用apt安装ruby,版本是1.8.4 (2005-12-24),有点旧,不过够用了。

一个问题:Ubuntu将ruby的安装包打散了,分成几个相互依赖的deb包,这样安装倒也没什么不妥,但我用IDEA+Ruby插件时,IDEA提示我需要设置Ruby SDK,我设置到Ubuntu默认的ruby安装目录下/usr/lib/ruby,可是IDEA不干,Google了一圈也没找到特别明确的办法

不得已只好自己从源代码编译一个ruby到/usr/local/ruby,不过这样IDEA就认了,感觉还是源码编译更灵活些
2 楼 huangye177 2007-04-11  
Apache2 Mongrel-Cluster Configuration

$ wget http://apache.justdn.org/httpd/httpd-2.2.4.tar.gz
($ sudo apt-get install apache2 is NOT recommended)

$ sudo gem install mongrel –include-dependencies
$ sudo gem install mongrel_cluster –include-dependencies
$ sudo /usr/sbin/adduser -r mongrel (creating a user for mongrel running)

cd httpd-2.2.4
./configure –prefix=/etc/apache2 –enable-cache –enable-mem-cache \
–enable-deflate –enable-proxy –enable-proxy-html –enable-proxy-balancer \
–enable-rewrite –enable-headers –enable-filecache –enable-ssl \

make
make install

–Note
# Apache and mongrel could work together in two ways, single instance and cluster
# We will describe both of them as follows:

1 — single mongrel instance
–enter your application’s path
$ mongrel_rails start -d -p 8000

–enter your apache2 httpd.conf, usually /etc/apache2 , and add these scripts


ServerName localhost
ServerAlias http://localhost

ProxyPass / http://localhost:8000/
ProxyPass /images !
ProxyPass /stylesheets !
#continue with other static files that should be served by apache

#continue with aliases for static content

ProxyPassReverse / http://localhost:8000/
ProxyPreserveHost on
2 — mongrel cluster
$ sudo gem install daemons gem_plugin mongrel mongrel_cluster –include-dependencies
$ sudo /usr/sbin/adduser -r mongrel

$ cd /path/to/yourapps
$ sudo mongrel_rails cluster::configure -e production \
-p 8000 -N 3

[NOTE! please make sure there’re only one mongrel_cluster.yml file in your system.]

You could test now:
—————
$ sudo mongrel_rails cluster::start
$ sudo mongrel_rails cluster::stop
—————

$ sudo mkdir /etc/mongrel_cluster
$ sudo ln -s /path/to/yourapp/config/mongrel_cluster.yml \
/etc/mongrel_cluster/yourapp.yml
$ cd /etc/init.d/
$ sudo cp /usr/local/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/resources/mongrel_cluster mongrel_cluster
$ sudo chmod +x /etc/init.d/mongrel_cluster

make sure these configuration is uncommented in httpd.conf
NOTE, if you have these modules buit-in, you may ignore it.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

DocumentRoot /path/to/yourapp/public

Edit httpd.conf:
BalancerMember http://localhost:8000
BalancerMember http://localhost:8001
BalancerMember http://localhost:8002
ServerName yourapp.com
ServerAlias http://yourapp.com
ServerAdmin yourapp@yourapp.com

DocumentRoot “/path/to/yourapp/public”
RewriteEngine On

ProxyPass /images balancer://yourCluster/images

ProxyPass /stylesheets balancer://yourCluster/stysheets
ProxyPass /javascripts balancer://yourCluster/javascripts

ProxyPass / balancer://yourCluster/

ProxyPassReverse / balancer://yourCluster/
ProxyPreserveHost on
1 楼 huangye177 2007-04-11  
Ubuntu common installation

Notes: The package name mentioned in this document might be out of date when you see it.If you can’t find a proper one or apt-get announce you no such library, please use
$ apt-cache search package-name
to find a available one.

1. Make sure the universe repository in /etc/apt/sources.list is uncommented:
deb http://archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu dapper universe
deb-src http://us.archive.ubuntu.com/ubuntu dapper universe

2. Make sure you are up to date:
$ sudo apt-get update
$ sudo apt-get dist-upgrade

3. Make sure you already have zlib1g(libzlib-ruby) package installed before ruby
./configure and installed.
$ sudo apt-get install build-essential
$ sudo apt-get install gcc
$ sudo apt-get install g++
$ sudo apt-get install libssl0.9.8      (Important!)
$ sudo apt-get install libssl0.9.7
$ sudo apt-get install libssl0.9.8-dbg
$ sudo apt-get install libssl-dev       (Important!)

$ sudo apt-get install zlib1g-dev (NOTE! zlibl”1″g means the number 1, not charactor l)
or
$ sudo apt-get install libzlib-ruby
or if you can’t find a proper libzlib package, search it using
$ apt-cache search libzlib
firstly and install the proper one.

4. We need to grab the latest ruby gems from rubyforge. You may need to modify this command if a version after 0.90 is available.
$ sudo wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
$ tar -xvzf rubygems-0.9.0.tgz
$ cd rubygems-0.9.0
$ sudo ruby setup.rb
$ sudo gem update –system

5. Install the ruby base packages:

Then tar the file, enter /ext, change Setup.x86 file to uncomment #openssl
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5-p12.tar.gz
./configure; make;make test; make install;

Then we could confirm & update
$ sudo apt-get install libzlib-ruby rdoc ri irb ruby1.8-dev

6. Install ruby tool lib.
$ sudo apt-get install libopenssl-ruby
$ sudo apt-get install libgd-ruby1.8 libyaml-ruby libzlib-ruby
$ sudo apt-get install imagemagick

6.1 You might encounter problems while install imagemagick, here’s the details(from http://www.photopost.com/):
____________6.1 start____________

First, if you already tried to install ImageMagick unsuccessfully, you need to uninstall it for this to work properly (trust me, I learned this after installing it 15 times over an old installation). To uninstall ImageMagick, go to your ImageMagick source directory and type:

$ make uninstall

6.1.1. ImageMagick needs a few support libraries to install properly. You can check for the header files in /usr/include and /usr/local/include to see if each library is installed. If you don’t find one or all of them then they will need to be installed.

tiff.h
png.h
jpeglib.h

6.2.2. Download the following files and FTP them (via binary mode) to a directory on your server (in my case, I chose /home/techimo/imagemagick - that’s a temporary directory for the source files):

ImageMagick-6.2.5-5.tar.gz (sudo wget ftp://mirror.aarnet.edu.au/pub/ImageMagick/ImageMagick-6.2.5-5.tar.gz)
jpegsrc.v6b.tar.gz (sudo wget http://www.photopost.com/jpegsrc.v6b.tar.gz)
libpng-1.0.6.tar.gz (sudo wget http://www.photopost.com/libpng-1.0.6.tar.gz)
libtiff-lzw-compression-kit-1.1.tar.gz (sudo wget http://www.photopost.com/libtiff-lzw-compression-kit-1.1.tar.gz)
tiff-v3.5.5.tar.gz (sudo wget http://www.photopost.com/tiff-v3.5.5.tar.gz)

$ gunzip *.gz
Then unpack everything:

$ tar -xvf ImageMagick-6.2.5-5.tar
$ tar -xvf libpng-1.0.6.tar
$ tar -xvf libtiff-lzw-compression-kit-1.1.tar
$ tar -xvf jpegsrc.v6b.tar
$ tar -xvf tiff-v3.5.5.tar

then:
$ cd libpng-1.0.6
$ cd scripts

Now do an “ls” and look for the makefile that matches your operating system. If you can’t find one for your OS, makefile.gcc should work. Copy the makefile to the libpng-1.0.6 directory:

$ cp makefile.linux ../makefile

In the line above, I used makefile.linux, but you should use your appropriate makefile. Continue:

$ cd ..
$ make
$ sudo make install
$ cd ..

$ cd jpeg-6b
$ ./configure –enable-shared
$ make
$ sudo make install
$ cd ..

(For this next part, if you don’t have “pico”, you can use “vi” instead)

$ cd libtiff-lzw-compression-kit
$ pico Makefile

change
TIFF_SRC_DIR = /tmp/libtiff
to
TIFF_SRC_DIR = ../tiff-v3.5.5

Then save and exit the Editor $ make install
$ cd ..
$ cd tiff-v3.5.5
$ ./configure

Answer yes to TIFF Configuration Parameters

$ make
$ sudo make install
$ cd ..

$ cd ImageMagick-6.2.5
$ ./configure –enable-lzw=yes –enable-shared=yes –disable-static –without-perl
$ make
$ sudo make install

That’s it!
____________6.1 end____________

7. Install Rails
$ sudo gem install rails –include-dependencies
$ sudo gem install mongrel –include-dependencies
$ sudo gem install ajax_scaffold_generator
$ sudo gem install redcloth
$ sudo gem install BlueCloth
$ sudo apt-get install build-essential     (To make sure Mongrel could be installed properly)
$ sudo apt-get install libmagick9-dev ruby1.8-dev (You should make sure imagemagick-ruby is already installed: from step 6.1)

Once you encounter problems while installing ‘RMagick’, you can do the following:
———————–
wget http://rubyforge.org/frs/download.php/16684/RMagick-1.15.0.tar.gz
tar this tar.gz file
./configure –enable-allow-example-errors –disable-htmldoc
make
sudo make install

If you wanna it works together with your mongrel, you might tree more steps:
1.$ sudo  cp RMagick.rb & RMagick.so  /usr/local/lib       (if RMagick.rb & RMagick.so does not exist in this path)
2.$ echo /usr/local/lib >> /etc/ld.so.conf(as root)
3.$  ldconfig(as root)
———————–

You can check whether RMagick is installed properly using this:
$ ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
If success, the result should be like:

This is RMagick 1.14.1 ($Date: 2006/10/21 13:43:23 $) Copyright (C) 2006 by Timothy P. Hunter
Built with ImageMagick 6.2.5 01/11/07 Q16 http://www.imagemagick.org
Built for ruby 1.8.5 (2006-08-25) [i686-linux]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org


8. Install Mysql and mysql/ruby lib.
$ sudo apt-get install mysql-server-5.0 libmysql-ruby1.8
$ sudo gem install mysql

8.1 Mysql configure
After mysql installed on Ubuntu, the listen socket port should be changed like this:
$ sudo vi /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/vendor/mysql.rb

Then, change the value of MYSQL_UNIX_ADDR from ‘/tmp/mysql.sock’ into ‘/var/run/mysqld/mysqld.sock’
MYSQL_UNIX_ADDR = “/var/run/mysqld/mysqld.sock”

8.2 You might encounter problems while install ’sudo gem install mysql’, here’s the details:

____________8.2 start____________

If the problem looks like:

error:
Building native extensions.  This could take a while…
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.


It might be lack of some library, please check mkmf.log to find out.
In my case, it tells me lack of ‘lmysqlclient’, so I searched the packages and install some of them:
$ apt-cache search libmysqlclient

libmysqlclient10 - LGPL-licensed client library for MySQL databases
libmysqlclient10-dev - LGPL-licensed client development files for MySQL databases
libmysqlclient12 - mysql database client library
libmysqlclient12-dev - mysql database development files
libmysqlclient14 - mysql database client library
libmysqlclient14-dev - mysql database development files
libmysqlclient15off - mysql database client library


$ sudo apt-get install libmysqlclient14
$ sudo apt-get install libmysqlclient14-dev

____________8.2 end____________

相关推荐

    Ruby on Rails安装包全集(Linux)

    在Linux环境下安装Ruby on Rails需要一系列的依赖包和步骤,本资源包提供了所需的所有组件,帮助用户在Linux系统上顺利构建RoR开发环境。 1. **readline-5.1.tar.gz**: 这是Readline库的源代码包,它提供了一种交互...

    Linux系统平台上安装和配置Ruby on Rails

    在Linux系统上安装和配置Ruby on Rails是一个常见的任务,特别是在开发Web应用程序时。Ruby on Rails(RoR)是一个基于Ruby语言的开源Web应用框架,它遵循模型-视图-控制器(MVC)架构模式,强调简洁和生产力。在...

    linux-在Ubuntu服务器上安装Rails生产环境的脚本

    在Ubuntu服务器上搭建Rails生产环境是一项关键的任务,它涉及到多个步骤和组件的配置。Rails是Ruby的一个框架,用于构建Web应用程序。在这个过程中,我们将主要关注以下几个核心知识点: 1. **Ruby 安装**:首先,...

    rails 的安装

    标题 "rails 的安装" 涉及到的是Ruby on Rails框架的安装过程,这是一个用于构建Web应用程序的开源框架。Rails是基于Ruby编程语言,它强调DRY(Don't Repeat Yourself)原则,提供了一种优雅的方式来组织和编写代码...

    linux下安装Nginx以及配置文件详解

    ### Linux 下 Nginx 的安装与配置详解 #### 一、Nginx 概述 Nginx(发音为 "engine X")是一款开源的 Web 服务器,它以高性能著称,尤其在处理高并发连接方面表现优异。Nginx 除了作为 HTTP 服务器外,还可以作为...

    自己整理的Linux下Redmine安装过程

    在Linux环境下安装Redmine是一个涉及到多个步骤和技术组件的过程。Redmine是一个开源的项目管理工具,基于Ruby on Rails框架构建,适用于多种操作系统,包括Linux。以下将详细阐述安装Redmine1.1.3的步骤,以及在这...

    centOS Rails3环境搭建

    ### CentOS环境下Rails 3开发环境搭建详解 #### 一、准备工作与环境配置 在开始部署Rails 3开发环境之前,我们需要确保系统上已经安装了一些基本的软件包和工具。这一步骤对于后续的Ruby和Rails安装至关重要。 ##...

    怎样在Ubuntu系统下配置Ruby On Rails开发环境.docx

    本文介绍了如何在 Ubuntu 12.04 系统下配置 Ruby On Rails 开发环境的步骤,包括安装系统需要的包、安装 RVM、安装 Ruby、安装 Rails 环境和安装 MySQL。通过按照这些步骤,开发人员可以快速地搭建 Ruby On Rails ...

    rails安装.rar

    在macOS或Linux上,通常可以通过包管理器(如Homebrew或apt-get)来安装。 安装Ruby后,需要安装RubyGems。RubyGems是一个用于管理和部署Ruby库和应用程序的包管理系统。RubyGems通常与Ruby一同安装,但如果你的...

    Ruby on Rails安装指南.docx

    《Ruby on Rails安装指南》是一份详尽的文档,旨在帮助用户在不同的环境下安装和配置Ruby on Rails开发环境。这份指南适用于使用Ruby 1.8.6和Rails 2.0.2版本的用户,虽然这些版本可能相对较旧,但其安装流程对于...

    Rails 101 入门电子书

    - 安装Rails: 使用gem工具安装最新的Rails版本。 - 测试安装: 创建一个简单的Rails应用来验证是否成功安装。 #### 五、练习作业0-Hello World - **目标**: - 学习如何创建第一个Rails应用程序。 - **过程**: -...

    rails2.3.3

    描述中的"rails linux 安装程序"表明了这个压缩包可能包含在Linux操作系统上安装Rails 2.3.3所需的所有文件和指南。Linux是一种广泛使用的开源操作系统,许多开发者选择在Linux环境下进行Rails开发,因为它提供了...

    linux下redmine安装笔记

    在Linux环境下安装Redmine是一个涉及多个步骤的过程,主要包括Ruby、RubyGems以及Rails的安装。以下是对这个过程的详细说明: 首先,安装Ruby是Redmine的基础。你可以从Ruby的官方网站下载对应版本的源代码,例如...

    Ruby+on+Rails快速Web应用开发实战.pdf

    - **Rails的安装环境**:文档提到了在Windows和Linux操作系统上安装Rails的步骤,这显示了Rails的跨平台特性。 - **Linux上安装Rails**:在Linux上可以通过`apt-get`和RubyGems两种方式进行安装。 - **Windows上安装...

    Ruby+for+Rails

    在Rails中,可以配置数据库连接信息,使用`database.yml`文件。安装MySQL后,通过Gemfile中的`gem 'mysql2'`来添加MySQL驱动,接着运行`bundle install`安装依赖。 4. **Rails基础知识** - **模型(Model)**:...

    Linux操作系统下轻松配置Ruby的程序环境

    本文将详细介绍如何在Linux环境下安装和配置Ruby及相关工具,包括Ruby语言本身、Rails框架、MySQL数据库驱动、FastCGI以及Lighttpd Web服务器等。 #### 安装Ruby 首先,需要从官方网站下载最新的Ruby安装包: - *...

    Ruby On Rails教程

    - **Windows平台安装:** 在Windows环境下安装Rails需要先安装Ruby环境,然后通过RubyGems管理器安装Rails。 - **macOS平台安装:** macOS用户可以通过Homebrew工具轻松安装Ruby及Rails。Homebrew是一个高效的包管理...

    redmine在linux上的安装步骤

    本文详细介绍了如何在 Linux 上安装 Redmine,包括下载和安装 Redmine、配置 Redmine、启动和停止 Redmine、访问 Redmine、配置 MySQL 数据库和配置 PHPMyAdmin 等步骤。通过按照本文的步骤,可以成功地在 Linux 上...

    windows下安装或升级rails

    ### Windows 下安装或升级 Rails 的常见问题与解决方法 在 Windows 平台上进行 Ruby on Rails 开发时,可能会遇到各种各样的安装问题。本文将详细解释一个常见的问题:“在 Windows 下安装或升级 Rails 时,gem ...

Global site tag (gtag.js) - Google Analytics