Install Ruby
Cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo ' Export path= ' $HOME/.rbenv/bin: $PATH "' >> ~/.BASHRC
Echo ' eval ' $ (rbenv init-) "' >> ~/.BASHRC
EXEC $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo ' Export path= ' $HOME/.rbenv/plugins/ruby-build/bin: $PATH "' >> ~/.BASHRC
EXEC $SHELL
Rbenv Install 2.3.1
Rbenv Global 2.3.1
Ruby-v
Installing Bundler
gem install bundler
Installing Nodejs
node -vcurl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
Installing Rails
4.2.6
rbenv rehash
The version number can be prompted by the tab prompt for the latest version number
First Web site
Using the SQLite3 test:
#### If you want to use SQLite (not recommended)
rails new myapp
#### If you want to use MySQL
rails new myapp -d mysql
#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql
# Move into the application directory
cd myapp
# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified
# Create the database
rake db:create
rails server
Open http://localhost:3000 to see the cover page.
The first crud feature
Rails Generate scaffold person first_name:string last_name:string phone_number:string Address:text
Rake Db:migrate
Rake Db:migrate rails_env=production
Now open Http://localhost:3000/people There is a staff management crud page.
JRuby running the Rails installation Java
Uninstall OPENJDK First:
Yum-y Remove java*
Installing Oracle JDK
sudo rpm-i jdk-8u112-linux-x64.rpm
Installing JRuby
Rbenv Install--list
Rbenv Global jruby-9.1.5.0
Jruby–v
Modify Gemfile
Remove Auto-generated:
Gem ' Activerecord-jdbcsqlite3-adapter '
Add at the end:
Platform:jruby do
Gem ' Activerecord-jdbc-adapter ', git: ' Https://github.com/jruby/activerecord-jdbc-adapter.git ', branch: ' Rails-5 '
Gem ' Activerecord-jdbcsqlite3-adapter ', git: "Https://github.com/jruby/activerecord-jdbc-adapter.git", Branch: ' Rails-5 '
Gem ' Listen '
End
Run
Bundle Install
Jruby–s Rails Server
Install JRuby under Linux