1.Ruby的安装
sudo apt-get install openssl
sudo apt-get install libssl-dev
注:RedHat、centos才是openssl-devel (yum -y install openssl-devel gcc)
sudoapt-getinstall gcc
wget https://ruby.taobao.org/mirrors/ruby/2.1/ruby-2.1.7.tar.gz
tar -xzvf ruby-2.1.7.tar.gz
cd ruby-2.1.7
./configure--prefix=/usr/local/ruby2.1.7
make && make install
echo 'export PATH=/usr/local/ruby2.1.7/bin:$PATH' >> /etc/profile
source /etc/profile
2.RubyGems工具安装
wget http://rubygems.global.ssl.fastly.net/rubygems/rubygems-2.6.2.tgz
tar -xzvf rubygems-2.6.2.tgz
cd rubygems-2.6.2
ruby setup.rb
3.替换gem源,又是由于网络环境的问题,访问官方源非常慢
(在第5步安装缺少组件:json、sinatra...可以切回源试试)
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
gem sources -l
4.Grokbug的安装
mkdir /usr/local/grokbug
cd /usr/local/grokbug
wget https://codeload.github.com/nickethier/grokdebug/zip/master
unzip master
mv grokdebug-master/* .
rm -rf grokdebug-master/
5.Ruby组件安装(以下组件都对版本有相应的要求)
查看缺少的组件:ruby config.ru
就会提示组件及对应的版本:
gem installbundler
gem installcabin -v=0.5.0
gem installhaml -v=3.1.7
gem installjls-grok -v=0.10.10
gem installjson -v=1.7.5
gem installkgio -v=2.8.0
gem installrack -v=1.4.1
gem installrack-protection -v=1.2.0
gem installraindrops -v=0.11.0
gem installshotgun -v=0.9
gem installtilt -v=1.3.3
gem installsinatra -v=1.3.3
gem installunicorn -v=4.6.3
6.启动服务
nohup bundle exec unicorn -p 8080 -c ./unicorn &
8080就是访问的端口,可以自定义
7.替换Google的jquery源
cd views
sed -i 's#//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js#//lib.sinaapp.com/js/jquery/1.8.1/jquery.min.js#g' index.haml
sed -i 's#//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js#//lib.sinaapp.com/js/jquery-ui/1.9.2/jquery-ui.min.js#g' index.haml
sed -i 's#//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js#//lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js#g' patterns.haml
sed -i 's#//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/ui-lightness/jquery-ui.css#//lib.sinaapp.com/js/jquery-ui/1.9.0/themes/ui-lightness/jquery-ui.css#g' layout.haml
sed -i 's#//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js#//lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js#g' discover.haml