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
测试安装是否成功
type rvm | head -n1
应输出
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%'; 配置文件所在路径: 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%'; 时区设置
sudo tzselect
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)