Ruby on Rails environment construction using VirtualBox, Vagrant, cyberduck

Introduction

I bought a new Macbook pro and built an environment to start programming in earnest, so I will write an article as a memorandum for the next time. Since it is a beginner, there may be some mistakes (I would be very grateful if you could point out). Please read it with that in mind.

Overall flow

The flow was as follows.

  1. Build a virtual environment with VirtualBox and Vagrant Install rbenv in the virtual environment built in 2.1 and install ruby ​​and rails
  2. Connect to virtual environment using cyberduck and enable file editing with vscode

Version of the tool used

For reference, I will list the specifications of the machine I used and the version of the tool.

** Machine spec ** macOS Cataline 10.15.7 MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) Processor: 2 GHz quad core Intel Core i5 Memory: 16 GB 3733 MHz LPDDR4X

** Various tools ** VirtualBox: 6.1.16 Vagrant: 2.2.14 cyberduck: 7.7.2

Introduction of VirtualBox and Vagrant

I did it with reference to https://www.sejuku.net/blog/39936. It was exactly the same up to the point of introducing centos7 to Vagrant.

Introduction of rbenv, ruby, rails

Next, I introduced rbenv. At first, I used to refer to the method of installing xcode and homebrew and then installing ruby ​​under homebrew management, but when I installed the xcode command line tool, I got an error and did not know the solution. Since it was clogged, I switched to the method of directly introducing rbenv. The sites that I referred to during the first method are listed below.

** How to use homebrew ** https://qiita.com/TAByasu/items/47c6cfbeeafad39eda07

For the method using rbenv, I used the continuation of the above site that was referred to in the introduction of Vagrant as it is. With this, I was able to go to the point of introducing Rails without any problems. However, in the work area on the virtual environment (home/vagrant/app/score_app in my case), the following command

home/vagrant/app/score_app


bin/rails s

I was unable to connect to the local server using. This was resolved in the following way.

After exiting the virtual environment, in the folder where the virtual machine is installed (in my case/user/user name/MyVagrant/centos7), the following command

/user/user_name/MyVagrant/centos7


vi Vagrantfile

And edit the Vagrantfile. I have set the IP address. For the contents, refer to the solutions ① and ② made by the following sites.

https://qiita.com/Ago0727/items/325df5e39e3406fa16d2

I couldn't connect with only ①, but I was able to connect with ②. However, as described in ①, when using Vagrant, it seems that you can not connect unless you set the following as an option when connecting.

user/user_name/MyVagrant/centos7


bin/rails s -b 0.0.0.0

Connection to cyberduck

I was able to basically refer to the following site here as well.

https://qiita.com/Lassieena/items/603fe89df26b59ca06f7

However, you should be careful to set the SSH private key and set the transmission method to SFTP. Finally, specify the vscode installed in the external editor from the environment setting tab of cyberduck (displayed at the top of the screen on mac). that's all!

Finally

There are various ways to build an environment, and it was quite a hurdle for beginners to do it in an appropriate way (I'm worried that this is complete). This time I failed about twice before I arrived at this method, and I did not know what to do and discarded the entire virtual environment twice, so if I can not help it, I may recreate it from the virtual environment again. Maybe. Also, I think that there are many places where I can not understand the details of the command etc., but I understand what folder I am in and where each package should be installed (or is it). I felt that it was important to build it. You can find out about discarding the virtual environment by searching with the vagrant command etc., so if you want to use it, you may want to check it.

Recommended Posts

Ruby on Rails environment construction using VirtualBox, Vagrant, cyberduck
Ruby on Rails 6.0 environment construction memo
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
[Personal memo] Ruby on Rails environment construction (Windows)
Ruby on Rails development environment construction on M1 Mac
Rails engineer environment construction ruby2.7.1
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
Rails on Docker environment construction procedure
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
[Environment construction] Get the Ruby on Rails 6 development environment within 1 hour
Ruby on Rails --From environment construction to simple application development on WSL2
[Ruby on Rails] Code check using Rubocop-airbnb
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Rails API server environment construction using docker-compose
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Notes on using FCM with Ruby on Rails
[Ruby on Rails] Image slideshow using Skippr
[Introduction] Build a virtual environment of Vagrant + VirtualBox on Window10 [Environment construction]
Steps to build a Ruby on Rails development environment with Vagrant
CentOS8.2 (x86_64) + ruby2.5 + Rails5.2 + MariaDB (10.3.17) environment construction
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
[Error] Switch environment construction to use Ruby on Rails oss (open source)
[Ruby on Rails] Let's build an environment on mac
Rails Docker environment construction
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
Build a Ruby on Rails development environment on AWS Cloud9
virtulbox + vagrant + Docker + nginx + puma + MySQL Rails environment construction
Docker the development environment of Ruby on Rails project
[Ruby on Rails] Common processing between controllers (using concaves)
I installed CentOS 8 on Windows 10 using VirtualBox and Vagrant
[Ruby on Rails] From MySQL construction to database change
Try using the query attribute of Ruby on Rails
Rails6 development environment construction [Mac]
Portfolio creation Ruby on Rails
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on Rails basic learning ①
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
Commentary on partial! --Ruby on Rails
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Offline environment construction Ruby edition
[Super easy] Ruby environment construction
Ruby on rails learning record -2020.10.06
[Rails / MySQL] Mac environment construction
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
Difficulties in building a Ruby on Rails environment (Windows 10) (SQLite3)
Ruby on Rails Email automatic sending function setting (using gmail)
[Ruby on Rails] Easy scroll animation of javascript (using ScrollReveal.js)
[Ruby on Rails] Infinite scrolling using gem kaminari and jscroll
Rails + MySQL environment construction with Docker
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] Read try (: [],: key)