Ruby on Rails 52016/07/03 |
Install Ruby on Rails 5 to build Ruby Framework environment.
|
|
[1] | |
[2] | Install some other required packages. |
root@dlp:~# apt-get -y install ruby-dev zlib1g-dev gcc make libxml2 libxslt libxml2-dev libxslt-dev
|
[3] | Install Rails 5. |
root@dlp:~# gem install bundler root@dlp:~# gem install nokogiri -- --use-system-libraries root@dlp:~# gem install rails --no-ri --no-rdoc root@dlp:~# rails -v Rails 5.0.0 |
[4] |
Create a sample application and make sure it works normally.
Install MariaDB Server first, refer to here. |
[5] | Create a sample application. |
root@dlp:~#
apt-get -y install libmariadbd-dev libmariadb-client-lgpl-dev nodejs
root@dlp:~#
root@dlp:~# gem install mysql2 --no-ri --no-rdoc -- --with-mysql-config=/usr/bin/mariadb_config rails new SampleApp -d mysql root@dlp:~# cd SampleApp
root@dlp:~/SampleApp#
vi config/database.yml
default: &default
adapter: mysql2 encoding: utf8 pool: 5 username: root password: password # MariaDB password socket: /var/run/mysqld/mysqld.sock # create test application root@dlp:~/SampleApp# rails db:create Created database 'SampleApp_development' Created database 'SampleApp_test' root@dlp:~/SampleApp# rails generate scaffold testapp name:string title:string body:text root@dlp:~/SampleApp# rails db:migrate root@dlp:~/SampleApp# rails server --binding=0.0.0.0 => Booting Puma => Rails 5.0.0 application starting in development on http://0.0.0.0:3000 => Run `rails server -h` for more startup options Puma starting in single mode... * Version 3.4.0 (ruby 2.3.1-p112), codename: Owl Bowl Brawl * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop |
[6] | Access to the "http://(server's hostname or IP address):3000/" from a client computer. It's OK if following site is displayed normally. |
Access to "http://(server's hostname or IP address):3000/testapps/", then it's possbile to use sample app like follows. |
Sponsored Link |
|