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.
The flow was as follows.
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
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.
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
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!
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