Ruby on Rails 42016/01/26 |
Install Ruby on Rails 4 to build Ruby Framework environment.
|
|
[1] | |
[2] | Install some other required packages. |
root@dlp:~# apt-get -y install ruby2.3-dev zlib1g-dev
|
[3] | Install Rails 4. |
root@dlp:~# gem install bundler root@dlp:~# gem install rails --no-ri --no-rdoc root@dlp:~# rails -v Rails 4.2.5.1 |
[4] |
Create a sample application and make sure it works normally.
Install and start MariaDB Server, refer to here. |
[5] | Create a sample application. |
root@dlp:~#
apt-get -y install libmariadbd-dev nodejs
root@dlp:~#
root@dlp:~# gem install mysql2 --no-ri --no-rdoc -- --with-mysql-config=/usr/bin/mysql_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 root password socket: /var/run/mysqld/mysqld.sock # create a sample app root@dlp:~/SampleApp# rake db:create:all root@dlp:~/SampleApp# rails generate scaffold testapp name:string title:string body:text root@dlp:~/SampleApp# rake db:migrate root@dlp:~/SampleApp# rails server --binding=10.0.0.30 => Booting WEBrick => Rails 4.2.5.1 application starting in development on http://10.0.0.30:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server [2016-01-27 19:03:00] INFO WEBrick 1.3.1 [2016-01-27 19:03:00] INFO ruby 2.3.0 (2015-12-25) [x86_64-linux-gnu] [2016-01-27 19:03:00] INFO WEBrick::HTTPServer#start: pid=32673 port=3000 |
[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. |