Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

(AWS) Setup PostgreSQL & Rails on AWS

Kaiyu edited this page Feb 13, 2017 · 2 revisions

If you want to set up a rails application on an amazon´s EC2 Instance, this might be something for you. Please note, that this instruction only covers the installation of rails and all its dependencies. If you want to use rails for production, you should also install an apache.

  1. If not already done, go to Amazon's EC2 Dashboard and launch a new Ubuntu Instance.

  2. After that, you get a permission file *.pem. Save that on your disc and restrict the permissions to 600:

    chmod 600 ~/myinstance.pem
    
  3. . Connect to the server via ssh

    ssh [email protected] -i ~/myinstance.pem
    

    Replace the -x-x-x-x with your real instance name and ~/myinstance.pem with the path to your .pem-file

All following steps take place on your ubuntu machine.

  1. First of all, update the package manager

    sudo apt-get update
    
  2. Install ruby

    sudo apt-get install ruby-full build-essential
    
  3. Install rubygems

    sudo apt-get install rubygems
    
  4. Install rails

    sudo gem install rails
    Install sqlite and the ruby gem
    sudo apt-get install libsqlite3-dev
    sudo gem install sqlite3-ruby
    
  5. Install nodejs

    sudo apt-get install nodejs npm
    
  6. Create a rails test application

    mkdir home/ubuntu/www
    cd home/ubuntu/www
    rails new testapp
    
  7. Start the rails server

    rails server
    

    Please note, that you should not use this server in production. This just a test, to see if rails runs on your EC2 instance.

  8. Finally, set up the security group in your AWS console, so that port 3000 is activated. In your AWS console click on 'NETWORK & SECURITY > Security Groups'. Choose the security group of your instance. In settings click on 'Inbound' and create a new rule:

    TCP
    3000
    0.0.0.0/0
    

Don´t forget to press 'Apply Rule Changes' when done!

  1. Go to [email protected]:3000. There you should see the rails default screen!