Skip to content

Instantly share code, notes, and snippets.

@xufuou
Last active November 8, 2017 11:05
Show Gist options
  • Save xufuou/f98bd196a5ec7bc4287ac5f4fc7d08f9 to your computer and use it in GitHub Desktop.
Save xufuou/f98bd196a5ec7bc4287ac5f4fc7d08f9 to your computer and use it in GitHub Desktop.
Playing with Ruby on Rails
https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres
#install rvm with rails
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -L https://get.rvm.io | bash -s stable --rails
source ~/.rvm/scripts/rvm
#installing postgres
[Ubuntu 16.04 Install](https://www.postgresql.org/download/linux/ubuntu/)
Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository
deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
sudo apt-get update
apt-get install postgresql-9.6
sudo apt install libpq-dev
gem install pg
#setting up postgres
set password for postgres user
sudo passwd postgres
su - postgres psql
create role secretsanta with createdb login password 'password;
create database secretsanta_development owner secretsanta;
#check if the role was created properly
\du
\q (exit)
# check if db was created properly
psql -h localhost -U secretsanta
\l
\dt
#Creating the Rails App (necessary if you are not starting from scratch skip this step)
rails new secretsanta --database=postgresql
development:
adapter: postgresql
encoding: unicode
database: secretsanta_development
host: localhost
username: secretsanta
password: password
# Other requirements
sudo apt-get install nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment