Launch an EC2 instance with Amazon Linux. The current version when I wrote this was:
Basic 64-bit Amazon Linux AMI
You'll need to make sure port 3000 is open in the firewall, as well. Make sure you know what "security group" your instance is running with, then in the EC2 Management Console, click on "security groups", select the "inbound" tab, type "3000" in the "port range" field, click "add rule", then click "apply rule changes". Now you will be able to see your rails site when you get it running. The firewall changes can be done before or after you launch your instance and take place almost instantly.
installing rails in EC2 under Amazon Linux
Install system-wide development tools:
sudo yum install -y git gcc make gcc-c++
install RVM
- directions here: http://beginrescueend.com/rvm/install/
- make sure to reload your bash profile or log out/log in in order to make rvm work
- source ~/.bash_profile
rvm pkg install zlib
rvm pkg install openssl
rvm install 1.9.3 --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$HOME/.rvm/usr
rvm use 1.9.3 --default
gem install rails
sudo yum install -y sqlite-devel
gem install sqlite3and now you're ready to run rails (for development)
rails new joe
cd joe
edit Gemfile with your favorite editor (may need to sudo yum install <editor>) and add
gem 'execjs'
gem 'therubyracer'
anywhere in the file.
edit Gemfile with your favorite editor (may need to sudo yum install <editor>) and add
gem 'execjs'
gem 'therubyracer'
anywhere in the file.
bundle install
rails server
This is for using ssh and git with your certificates.. better description coming later.
In
~/.ssh/config, add:Host gh
Hostname github.com
User git
IdentityFile ~/.ssh/somekey
Now you can do
git clone ssh://gh/username/repo.git.