标签:
安装redis
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz $ tar xzf redis-3.0.2.tar.gz $ cd redis-3.0.2 $ make
总结如下(非常重要)
1. 装ruby,不装没戏,使用源代码编译安装
2. 装gem,不装没戏,下载源代码,然后使用ruby安装
3. 使用gem装redis类库,否则起不来
4. 配置环境变量,让ruby命令能够在$PATH路径中访问 $PATH = $PATH:/usr/local/ruby/bin
(/home/zhaoyongchuan/.bash_profile)
5. 依次启动服务器
./bin/redis-server ./8601/redis.conf ...
centos配置ruby开发环境
1. 安装ruby
1.1 yum安装,版本旧
#yum install ruby ruby-devel ruby-ri ruby-rdoc ruby-irb ruby-shadow
1.2 删除
#yum remove ruby ruby-devel -y
1.3 源码安装
#wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz #tar zxvf ruby-2.1.1.tar.gz #cd ruby-2.1.1cd #./configure --prefix=/usr/local/ruby --with-opessl-dir=/root/soft/openssl-1.0.0l #make && make install #echo "export PATH=/usr/local/ruby/bin:$PATH >> /root/.bash_profile" #source /root/.bash_profile #ruby --version ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
2.安装gem并更新gem源
2.1 如果存在更新为最新的RubyGems,gem
#gem update --system
如果版本过旧,
#gem install rubygems-update #update_rubygems
2.2 源码安装
#wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.tgz #tar zxvf rubygems-2.2.2.tgz #cd rubygems-2.2.2 #ruby setup.rb #gem --version
2.3 更换gem源为淘宝
#gem sources --remove https://rubygems.org/ #gem sources -a https://ruby.taobao.org/ #gem sources -l *** CURRENT SOURCES ***
gem install redis(重要)
非root用户须在用户目录下找到.bash_profile文件,配置ruby变量PATH=$PATH:/usr/local/ruby/bin
https://ruby.taobao.org/
如果是用Bundle(Rails 项目)
#source ‘https://ruby.taobao.org/‘ #gem ‘rails‘, ‘4.1.0‘
附:gem sources -a https://ruby.taobao.org/报错
ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
需要指定openssl目录(源码)。
3. 测试安装Mongodb driver for ruby
# gem install bson # gem install bson_ext # gem install mongo # gem list --local ... bson (2.2.2, 1.10.0) bson_ext (1.10.0) ... mongo (1.10.0) # irb irb(main):001:0> require ‘mongo‘ => true
标签:
原文地址:http://my.oschina.net/shyloveliyi/blog/497450