Post by ZF on May 4, 2015 5:03:43 GMT -5
On a clean ubuntu
custodio@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
sudo apt-get dist-upgrade
cd
wget ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
tar -xzvf ruby-2.2.2.tar.gz
cd ruby-2.2.2/
./configure
make
sudo make install
ruby -v
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails -v 4.2.1
//Installing mysql
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
//Installing postgresql
sudo sh -c "echo 'deb apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.3 libpq-dev
//NOTE: it is advisable to create the same ubuntu username for the db user
sudo -u postgres createuser <username> -s
sudo -u postgres psql
postgres=# \password <username>
//If using postgresql
rails new newproject -d postgresql
cd newproject
Edit config/database.yml file
Add the following line demarcated by ">>"
...
...
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
>> username: xxxxx
>> password: xxxxxx
development:
<<: *default
...
...
//If using mysql, add the password to the line "password: "
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
//If using mysql
rails new myapp -d mysql
rake db:create
rails server
//To troubleshoot postgresql
postgres-# psql \l
postgres-# psql \du
SOURCE: gorails.com/setup/ubuntu/14.04
custodio@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
sudo apt-get dist-upgrade
cd
wget ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
tar -xzvf ruby-2.2.2.tar.gz
cd ruby-2.2.2/
./configure
make
sudo make install
ruby -v
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails -v 4.2.1
//Installing mysql
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
//Installing postgresql
sudo sh -c "echo 'deb apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.3 libpq-dev
//NOTE: it is advisable to create the same ubuntu username for the db user
sudo -u postgres createuser <username> -s
sudo -u postgres psql
postgres=# \password <username>
//If using postgresql
rails new newproject -d postgresql
cd newproject
Edit config/database.yml file
Add the following line demarcated by ">>"
...
...
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
>> username: xxxxx
>> password: xxxxxx
development:
<<: *default
...
...
//If using mysql, add the password to the line "password: "
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
//If using mysql
rails new myapp -d mysql
rake db:create
rails server
//To troubleshoot postgresql
postgres-# psql \l
postgres-# psql \du
SOURCE: gorails.com/setup/ubuntu/14.04