In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use VirtualBox and Vagrant to build a Linux environment". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First, make sure that the CPU of the computer enables CPU virtualization
1. Computer CPU is generally virtualized by default, as shown in the following figure:
2. If it is not virtualized, you need to enter the BISO interface to open CPU Virtualization
Download VirturalBox and complete the installation
The installation step is the next step by default.
Download Vagrant and complete the installation, and restart the computer
Run in cmd: vagrant
Check whether Vagrant is installed successfully, and the prompt command indicates that the installation is successful.
Modify the global download location of VirtualBox
Administration / Global Settin
Avoid downloading virtual machines on the default C disk, of course, here for better file management.
6. Generate Vagrantfile file vagrant init centos7 https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/CentOS-7.box
The resulting Vagrantfile file will replace the default link to download the virtual machine with the image above, greatly improving the download speed.
Download and install and run the virtual machine
Open the cmd window in the same directory as the Vargantfile file and run the following command:
Vargant up
Running result:
The location of the downloaded virtual machine is the directory set in step 5.
Open VirtualBox and you can see a running Linux environment.
Enter vagrant ssh in cmd to connect to the virtual machine
The installation is successful at this point. Come on!
9. Set the IP address
After the installation of Vagrant, network address translation-port forwarding is adopted by default, and there is no fixed IP. The port of the virtual machine must be mapped to the port on the Windows, and then accessed through the IP of windows. So the later development needs to configure a lot of mapped ports, which is not convenient, so it is necessary to configure the fixed virtual machine IP for external access.
Port forwarding operation diagram:
To fix the virtual machine IP, simply modify the Vagrantfile:
The first three paragraphs of IP here need to check that the IP address of VirtualBox in Windows is the same as it, and the last part is random.
The ipconfig command allows you to view:
Restart after modification. You can check whether it takes effect through PING.
This is the end of "how to use VirtualBox and Vagrant to build a Linux environment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.