Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chunlea/3498280 to your computer and use it in GitHub Desktop.
Save chunlea/3498280 to your computer and use it in GitHub Desktop.
在Ubuntu 64位上部署Rails开发环境
echo "export LC_ALL=C" >> /root/.bashrc
source /root/.bashrc
# 这个是我的VPS上系统的原因
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
# 官方的要求
vim /etc/apt/sources.list
# 偷偷安装了VIM,不为别的,好像比VI好用
# 在Sources文件后面加入如下两行:
# deb http://nginx.org/packages/ubuntu/ precise nginx
# deb-src http://nginx.org/packages/ubuntu/ precise nginx
# 具体可以参考:http://nginx.org/en/download.html
apt-get update
apt-get install nginx
# Nginx 就已经可以工作了,不信,service nginx status 看看
apt-get install postgresql libpq-dev
# 安装完成后参照RailsCast的#335 Deploying to a VPS配置
root@chunlea:~# sudo -u postgres psql
could not change directory to "/root"
psql (9.1.5)
Type "help" for help.
postgres=# \password # 修改psql用户的密码
postgres=# CREATE USER **** with password '******'; #不要忘了分号!
postgres-# CREATE DATABASE slyutest_production owner ****;
postgres=# \q
# 然后安装nodejs
apt-get -y install nodejs
# 用Multi-User模式安装
curl -L https://get.rvm.io | bash -s stable
# 要想用户使用rvm,需要将用户加入rvm组
usermod -G root,rvm root
# exit退出,然后重新登陆。RVM可用
rvm requirements
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
# 不废话,大家都知道 >##< 这句就是废话!
# [!废柴!这行作废] rvm install ree # 选择REE,测试测试,据传降低内存
# [!废柴!这行作废] rvm use ree --default
# http://www.engineyard.com/blog/2012/ruby-1-8-7-and-ree-end-of-life/ # 不过倒是好消息,毕竟统一比分裂好,Android。
# 而且,key: value # only available in 1.9.2
# ||
# :key => value # available in 1.8.7 and 1.9.2
# 偏偏devise用的是1.9的写法重新安装ruby 1.9.3
rvm install 1.9.3
rvm use 1.9.3 --default # Bye REE
gem install rails --no-rdoc --no-ri
echo gem: --no-rdoc --no-ri >> ~/.gemrc # 一劳永逸,毕竟是开发环境
# rails 安装完成
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment