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

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)架构模式,强调简洁和生产力。在...

    rails 的安装

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

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

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

    怎样在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版本的用户,虽然这些版本可能相对较旧,但其安装流程对于...

    rails2.3.3

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

    linux下redmine安装笔记

    在Linux环境下安装Redmine是一个涉及多个步骤的过程,其中包括设置MySQL数据库、安装Ruby环境及相关插件、获取Redmine源码并配置、初始化数据库以及启动服务器。以下是对这些步骤的详细说明: 1. **安装MySQL数据库...

    Ruby+for+Rails

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

    企业级LINUX应用服务器配置案例

    6. **服务部署**:以企业级LINUX应用服务器配置案例为例,例如,redmine项目管理软件的安装涉及以下步骤: - 安装必要依赖,如Ruby、Rails框架、数据库(如MySQL或PostgreSQL)。 - 下载并解压redmine安装包,根据...

    redmine在linux上的安装步骤

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

    bitnami linux redmine 安装

    综上所述,Bitnami Linux Redmine 安装涉及的主要知识点有 Redmine 的基本功能、Ruby on Rails 开发、数据库管理、Web 服务器配置以及自动化部署工具的使用。通过提供的 `bak.sh` 脚本,我们可以学习到如何维护和...

    mongel for linux安装

    在Linux环境下安装MongoDB是很多开发者和系统管理员的日常任务。本篇将详细介绍如何在Linux系统上安装MongoDB,以解决Redmine服务在使用Webrick方式登录时响应速度慢的问题。 首先,我们需要了解为什么Redmine登录...

    rails3 和 thinking_sphinx安装

    总结一下,Rails3 和 Thinking_Sphinx 的集成涉及安装 Sphinx、配置 Thinking_Sphinx、定义索引、构建索引、启动搜索守护进程以及在应用中使用搜索方法。通过这种方式,你可以为你的 Rails 应用程序引入强大的全文...

    搭建Ruby on Rails开发环境

    安装完成后,你可以使用`gem install rails`命令安装Rails,或者在本地有Rails gem文件的情况下,通过`gem install`命令进行安装。 无论在哪个操作系统上,确保所有的依赖库都已安装是至关重要的。在Linux环境下,...

    linux 安装 redmine脚本

    在Linux环境中安装Redmine是一个涉及多个步骤的过程,其中包括配置环境、安装依赖库、解压Redmine源码以及设置数据库连接等。以下是一个详尽的基于Linux的Redmine安装过程,这个过程通常会用到shell脚本,如`redmine...

    mac及linux下搭建ruby+rails环境

    在已安装的Ruby环境下,使用gem(Ruby的包管理器)来安装Rails: ```bash gem install rails ``` 安装完成后,你可以通过`rails -v`命令检查Rails的版本,确认安装成功。 对于Linux用户,步骤基本相同,只是在...

    Rails3 使用rake启动后台任务

    要使用 DJ,首先需要安装 gem,然后配置数据库连接,最后创建并运行 worker 进程。 5. **Resque**: 类似于 DJ,Resque 也是一个队列系统,但它使用 Redis 作为后端存储。Resque 支持多线程和分布式工作环境。 6. *...

    linux安装redmine1.2.1.pdf

    在本文中,我们将详细探讨如何在Linux环境下安装Redmine 1.2.1。Redmine是一个开源项目管理软件,基于Ruby on Rails框架构建,适用于跟踪任务、管理版本控制和协调团队工作。 首先,我们需要安装Ruby运行环境。...

Global site tag (gtag.js) - Google Analytics