sudo apt-get install gcc
sudo apt-get install build-essential
sudo apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic
sudo apt-get install zlib1g-dev libssl-dev libreadline5-dev libxml2-dev
sudo apt-get install libcurl4-openssl-dev libssl-dev zlib1g-dev libreadline5-dev
sudo apt-get install curl git-core
sudo apt-get install bison build-essential zlib1g zlib1g-dev libssl-dev libreadline5-dev libxml2-dev subversion autoconf
mlzboy@mlzboy:~$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
109 986 109 986 0 0 957 0 0:00:01 0:00:01 --:--:-- 4268
Initialized empty Git repository in /home/mlzboy/.rvm/src/rvm/.git/
remote: Counting objects: 16240, done.
remote: Compressing objects: 100% (4166/4166), done.
remote: Total 16240 (delta 10951), reused 15861 (delta 10649)
Receiving objects: 100% (16240/16240), 2.91 MiB | 197 KiB/s, done.
Resolving deltas: 100% (10951/10951), done.
RVM: Shell scripts enabling management of multiple ruby environments.
RTFM: http://rvm.beginrescueend.com/
HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
Installing RVM to /home/mlzboy/.rvm/
Correct permissions for base binaries in /home/mlzboy/.rvm/bin...
Copying manpages into place.
Notes for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.1 LTS" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 3.2 is required
curl is required
git is required (>= 1.7 recommended)
patch is required (for ree and some ruby-head's).
If you wish to install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),
then you must install and use rvm 1.8.7 first.
If you wish to have the 'pretty colors' again,
set 'export rvm_pretty_print_flag=1' in ~/.rvmrc.
dependencies:
# For RVM
rvm: bash curl git
# For JRuby (if you wish to use it) you will need:
jruby: aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
# For Ruby (MRI & ree) you should install the following OS dependencies:
ruby: aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf
# In addition to ruby: dependencies,
ruby-head: subversion
# For IronRuby (if you wish to use it) you will need:
ironruby: aptitude install curl mono-2.0-devel
You must now complete the install by loading RVM in new shells.
1) Place the folowing line at the end of your shell's loading files
(.bashrc or .bash_profile for bash and .zshrc for zsh),
after all PATH/variable settings:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
You only need to add this line the first time you install rvm.
2) Ensure that there is no 'return' from inside the ~/.bashrc file,
otherwise rvm may be prevented from working properly.
This means that if you see something like:
'[ -z "$PS1" ] && return'
then you change this line to:
if [[ -n "$PS1" ]] ; then
# ... original content that was below the '&& return' line ...
fi # <= be sure to close the if at the end of the .bashrc.
# This is a good place to source rvm v v v
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
EOF - This marks the end of the .bashrc file
Be absolutely *sure* to REMOVE the '&& return'.
If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
Placing all non-interactive (non login) items in the .bashrc,
including the 'source' line above and any environment settings.
3) CLOSE THIS SHELL and open a new one in order to use rvm.
WARNING: you have a 'return' statement in your ~/.bashrc
This could cause some features of RVM to not work.
This means that if you see something like:
'[ -z "$PS1" ] && return'
then you change this line to:
if [[ -n "$PS1" ]] ; then
# ... original content that was below the '&& return' line ...
fi # <= be sure to close the if at the end of the .bashrc.
# This is a good place to source rvm v v v
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
EOF - This marks the end of the .bashrc file
Even if you are using zsh you should still adjust the ~/.bashrc
If you have any questions about this please visit
#rvm on irc.freenode.net.
Installation of RVM to /home/mlzboy/.rvm/ is complete.
mlzboy,
Thank you very much for using RVM! I sincerely hope that RVM helps to
make your work both easier and more enjoyable.
If you have any questions, issues and/or ideas for improvement please
join#rvm on irc.freenode.net and let me know, note you must register
(http://bit.ly/5mGjlm) and identify (/msg nickserv <nick> <pass>) to
talk, this prevents spambots from ruining our day.
My irc nickname is 'wayneeseguin' and I hang out in #rvm typically
~09:00-17:00EDT and again from ~21:00EDT-~23:00EDT
If I do not respond right away, please hang around after asking your
question, I will respond as soon as I am back. It is best to talk in
#rvm itself as then other users can help out should I be offline.
Be sure to get head often as rvm development happens fast,
you can do this by running 'rvm get head' followed by 'rvm reload'
or opening a new shell
w⦿‿⦿t
~ Wayne
mlzboy@mlzboy:~$
$ rvm notes
测试安装是否成功
应输出
- rvm is a function
rvm list
rvm use ree --default
rvm install 1.9.2
1.9.2 > dict={}
=> {}
1.9.2 > dict["z"]=1
=> 1
1.9.2 > dict["a"]=2
ree 1.8.7和1.9.2执行上述两段代码的效果是不一样的,我的程序依赖于这项功能,所以不能使用ree,期待它升到1.9吧,不过得很长时间估计
rvm install 1.9.2
不需要sudo
关于gems
每个ruby解释器默认有一个名字为global的gemset,可以创建自己的gemset,通过rvm 1.8.7@gemset的方法来切换不同的gemset
gems之间可以进行同步,支持export/import/copy等操作
这个需要花费30分钟在我这里,放到海外估计会很快,在本地虚拟机编译更耗时
在安装的时候 如果时间过长 或是出错可到~/.rvm/log下查看具体的日志
mlzboy@mlzboy:~$ rvm list
rvm rubies
=> ree-1.8.7-2010.02 [ i386 ]
ruby-1.9.2-p0 [ i386 ]
mlzboy@mlzboy:~$ rvm 1.9.2 --default
mlzboy@mlzboy:~$
安装nginx
sudo apt-get install libpcre3-dev
sudo
apt-get
install
libpcre3 libpcre3-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install openssl libssl-dev
sudo apt-get install build-essential libpcre3-dev libssl-dev libxslt-dev libgd2-xpm-dev libgeoip-dev zlib1g-dev
sudo apt-get install libpcre3 && \
sudo apt-get install zlib1g && \
sudo apt-get install libpcre3-dev && \
sudo apt-get install zlib1g-dev && \
sudo apt-get install libssl && \
sudo apt-get install libssl-dev
gem install -V passenger
rvmsudo passenger-install-nginx-module
选择自己编译安装
nginx安装路径/usr/local/nginx
外加参数
--with-http_flv_module --with-http_gzip_static_module
另外: 如果不想使用 passenger 自带脚本编译 nginx, 也可以手工编译 nginx 时加入 –add-module=’/home/jerry//opt/passenger/ext/nginx 参数, 来启用 passenger 模块.
Nginx with Passenger support was successfully installed.
The Nginx configuration file (/usr/local/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Passenger
to function correctly.
This installer has already modified the configuration file for you! The
following configuration snippet was inserted:
http {
...
passenger_root /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1;
passenger_ruby /home/mlzboy/.rvm/wrappers/ruby-1.9.2-p0/ruby;
...
}
After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.
Press ENTER to continue.
mysql安装
sudo apt-get install mysql-server-5.1
mysql配置记录
重启mysql服务
sudo service mysql restart
命令行
mysql -u root -p
命令行下查看utf8相关
show variables like 'character%';
show variables like '%time_zone%'
配置文件所在路径:
sudo vi /etc/mysql/my.cnf
配置文件的更改以下两段
[client]
default-character-set=utf8
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
default-character-set=utf8
init_connect='SET NAMES utf8'
default-time-zone = '+8:00'
mysql> show variables like '%time_zone%';
时区设置
mlzboy@mlzboy:~$ sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
mlzboy@mlzboy:~$ sudo ntpdate cn.pool.ntp.org
10 Dec 14:04:43 ntpdate[1789]: step time server 114.80.81.1 offset 45.904550 sec
mlzboy@mlzboy:~$
mlzboy@mlzboy:~$ date
Fri Dec 10 14:04:45 CST 2010
mysql -u root -p
select now();
rvm gemset create b2c2
rvm 1.9.2@b2c2 --default
gem install rails#有bundler这里其实不需要了
sudo apt-get install imagemagick
paperclip插件需要这个库预先装,一般情况下已经装了
安装rails3的mysql2 gem需要sudo apt-get install libmysql-ruby libmysqlclient-dev
安装sqlite3-rubygem需要下面这个库的支持
这时候应该只需安装sqlite3-ruby,由于缺少sqlite3.h,因此我们需要先安装 ubuntu下的libsqlite3-dev包
- sudo apt-get install libsqlite3-dev
进入b2c2进行
gem install bundler
bundle install#其实由于使用了bundle install 不需要单独再安装gem install rails
目前还在开发环境的部署,转到生产,可能还有一些局部要调整的地方
rake db:drop:all#清除掉各种环境下的数据库
rake db:create
mysql -uroot -p
show databases;
rake db:schema:load
rvm wrapper 1.9.2@b2c2 passenger
解压缩每日备份的mysql
gunzip 2010-12-10.gz
使用rails console 进去后能看到具体的当前的版本
mlzboy@mlzboy:~/b2c2$ rails c
Loading development environment (Rails 3.0.1)
<s
分享到:
相关推荐
rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails ...
【Ruby on Rails 部署方案浅析】 Ruby on Rails(简称Rails)是一个流行的Web开发框架,但在部署过程中,由于Rails自身的非线程安全特性和Ruby语言较差的线程性能,部署策略需精心设计。本篇文章将探讨十余种常见的...
总的来说,了解Mongrel对于理解Rails的历史和早期的部署实践非常重要,但现代开发环境中,选择更加活跃和优化的服务器软件更为常见。对于初学者来说,掌握如何安装和配置这些服务器,以及理解它们的工作原理,是提升...
标题 "rails 部署 nginx" 涉及到的是在Web开发中使用Ruby on Rails框架结合Nginx服务器进行应用部署的相关知识。Nginx以其高性能、稳定性以及...理解这些知识点对于任何想要进行Rails应用部署的人来说都是至关重要的。
### Ruby on Rails 安装与部署知识要点 #### 一、前言 在进行 Ruby on Rails 的安装与部署过程中,我们需要关注几个核心方面:系统版本兼容性、软件依赖包的选择与安装、Ruby 语言环境的配置以及 Rails 应用的具体...
安装Rails本身非常简单,只需在终端输入 `gem install rails`,这将会下载并安装最新版本的Rails。 4. **验证Rails安装**: 安装完成后,你可以通过运行 `rails -v` 来检查Rails是否已正确安装,并查看其版本号。...
该命令会从Ruby的包管理库中查找并安装指定版本的Rails。安装完成后,同样通过`rails -v`来检查是否安装成功。 **知识点3:Mongrel安装** Mongrel是Rails官方推荐的轻量级Web服务器之一。下载Mongrel 1.1.4版本,...
2.进入rails目录使用gem命令安装(这一步必须要上一步已经安装成功)。如果安装不成功使用ruby,如下: ruby -S gem install rails-2.2.2.gem 3.复制libmySQL.dll到ruby的安装目录的bin文件夹下,然后使用gem安装...
moonshine, 简单的Rails 部署和配置管理 15分钟部署 Rails 2,3或者应用 MoonshineMoonshine的Rails 部署和配置管理正确完成。通过利用 Capistrano 和 puppet,Moonshine允许你在 15分钟内拥有一个工作应用服务器,...
### Ruby on Rails 手动安装知识点详解 #### 核心概念与背景 **Ruby on Rails**,简称**Rails**,是一种使用**Ruby**语言编写的开源全栈Web应用框架,遵循MVC(Model-View-Controller)架构模式,强调代码效率与...
本教程将详细介绍Rails的安装过程,这对于初学者来说尤其重要,因为正确安装Rails是学习和开发RoR应用的基础。 首先,你需要确保已经安装了Ruby。Ruby是一种面向对象的编程语言,是Rails的基础。你可以访问ruby-...
Rails 4.2.0 是一个非常重要的版本,在Ruby on Rails框架的历史中占据了显著位置。这个版本引入了许多新特性、改进和性能优化,为开发者提供了更高效和灵活的开发环境。Ruby 4.2.0是这个框架所依赖的编程语言的一个...
在开始部署Rails 3开发环境之前,我们需要确保系统上已经安装了一些基本的软件包和工具。这一步骤对于后续的Ruby和Rails安装至关重要。 ##### 1. 安装Node.js Node.js在某些Rails应用中是必需的,尤其是在使用某些...
书中介绍了Ruby on Rails安装的最佳实践,以及如何通过Git、编辑器和Linux命令行等前置技能的学习,为后续的Rails开发打下基础。Git作为版本控制系统,对于团队协作开发项目尤为重要,学习它的使用方法能够帮助...
这是一个关键的开发环境设置步骤,对于使用Rails进行Web开发的程序员来说至关重要。Ruby on Rails是一个流行的开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,而MySQL则是一种广泛使用的开源关系型...
例如,对于PostgreSQL,需要先安装数据库软件及其开发库: ```bash sudo apt-get install -y postgresql postgresql-contrib libpq-dev ``` 然后创建一个数据库用户和数据库,并在Rails的`config/database.yml...
Ruby on Rails:部署Rails应用至Heroku.docx
RubyGem是Ruby的包管理器,用于安装和管理Ruby库,包括Rails。通常,当你安装Ruby时,RubyGem也会被一同安装。你可以通过在命令行输入`gem --version`来检查是否已安装。如果没有,可以通过Ruby安装程序或者单独下载...
《Rails 101 入门电子书》是一本非常适合初学者直接入门的书籍,它由xdite编写并出版于2014年6月10日。本书主要针对的是希望学习Ruby on Rails框架的读者,特别是那些想要从零开始掌握这项技术的新手。 #### 二、...