Skip to content

Instantly share code, notes, and snippets.

@chengdh
Created August 6, 2012 07:12
Show Gist options
  • Save chengdh/3271840 to your computer and use it in GitHub Desktop.
Save chengdh/3271840 to your computer and use it in GitHub Desktop.
ubuntu + rails3.2 生产环境配置

预置服务器环境

sudo apt-get update
sudo apt-get upgrade

#### note: ran rvm requirements to get package list:
sudo apt-get install curl build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion -y

在服务器上创建用户

sudo adduser lmis   #注意要使用adduser,使用useradd命令创建出的用户是三无用户
#将lmis用户加入到sudo组
sudo usermod -G sudo lmis
#创建到apache配置文件的软链接
cd /etc/apache2/sites-available/
sudo ln -s ~/app/il_yanzhao_rails32/current/config/server/production/apache_host.conf px.yanzhaowuliu.com

安装RVM

  • 使用刚创建的lmis用户登录到服务器 ssh lmis@server

  • 将RVM安装到当前用户,此处注意,在production环境中,安装RVM到当前用户可省去很多麻烦 curl -L https://get.rvm.io | bash -s stable

  • 安装ruby1.9


+ 创建gemset

rvm use 1.9.3 --default rvm gemset create rails32_gemset


+ 创建rvm wrapper

rvm wrapper 1.9.3@rails32_gemset r193 unicorn_rails


### 部署系统到服务器
- ```cap deploy:setup```
- ```cap deploy:check```
- ```cap deploy```
- ```cap deploy:migrate```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment