I set up the local environment with Vagrant and VirtualBox because I don't want to use AWS and Heroku etc... (The main reason is money.)
So I write down the article (or note?) to start Ruby on Rails Tutorial.
- OS: macOS High Sierra (version 10.13.6)
- Vagrant: 2.2.0
- VirtualBox: 5.2.18
I used Ubuntu 18.04 as guest Virtual Machine.
And I set the port forwarding from 3000 (host) to 3000 (guest).
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.network "forwarded_port", guest: 3000, host: 3000 config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end end
In my case, the error occurred because of the lack of memory when I install rails on guest VM. So, I changed the size of memory (default is 1024 I guess) as above.
After launching VM,
$ vagrant up $ vagrant ssh
I installed rbenv first.
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile $ source ~/.bash_profile $ rbenv -v rbenv 1.1.1-39-g59785f6
Second, I installed rbenv plugin.
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Then, I checked the version of Ruby and installed
$ rbenv install --list $ rbenv install 2.5.0 $ rbenv rehash $ rbenv global 2.5.0 $ ruby -v ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
By the way, I found some errors in this procedure because essential packages were not installed. So, I did development tools etc.
$ sudo apt update $ sudo apt install build-essential $ sudo apt install libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev nodejs
In Ruby on Rails Tutorial, Rails version is
5.1.6, so I run this command;
$ gem install rails -v 5.1.6
$ rails -v Rails 5.1.6
Seems success to install.
I want to check whether the installation was correct, so run these commands;
$ mkdir environment $ cd environment/ $ rails _5.1.6_ new hello_app $ cd hello_app/ $ rails server
After that, I accessed this URL;
10 Time Management Tips for the Developer Who Wants It All Now
Dennis O'Keeffe -
Breaking into Web Dev – The No Jargon Guide – Article 2 – Making your first Website Live
Why I Stopped Using Redux
Gabriel Abud -
Breaking into Web Dev – The No Jargon Guide – Article 1 – Git & GitHub