Before use is Vagrant+virtualbox build environment, because is Windows system error, can't open environment, so still honestly changed the virtual machine hey ....
Version: VirtualBox 5.1.34
Xshell
Mirror CENTOS7
Configuring virtual Machines
1. First add the mirror to the VirtualBox
2. When installing, note time Zone select Shanghai, start network mode, set user
3. Post-Login configuration
Network Configuration Open command: vi/etc/sysconfig/network-scripts/ifcfg-ENP0S3 Network configuration is as follows: Onboot// Open Network
bootproto= "Static"
Static IP configuration:ipaddr=192.168.1.150NETMASK=255.255.255.0DNS1=192.168.1.1GATEWAY= 192.168.1.1 Restart Network Service: systemctl restart Networks. Service View network: IP addr Firewall Development port: Firewall-cmd--zone= public--add-port=22/tcp--Permanent Restart firewall : systemctl restart Firewalld. Service
Whether to set the domain name server vi/etc/resolv.conf
Add the following two lines:
NameServer 8.8.8.8
NameServer 8.8.4.4
One-click Installation LNMP Environment
Official website: https://lnmp.org/install.html
Set up a shared directory
VirtualBox's enhanced plug-in implements the ability to share folders
1. Check that CentOS is connected to the network
Because of the need to install the relevant software, you need to check the network connection condition first.
Ping www.baidu.com
- If you can ping it, it means that the network connection is OK
- If the ping does not pass
dhclient eth0: assigning IP to Eth0
/etc/sysconfig/network-scripts/ifcfg-eth0, change onboot= "No" to onboot= "yes": This setting allows the IP to be automatically obtained for each reboot
2. Prepare the installation Environment (version issue, more basic programs are not installed)
Yum Update: Updating existing updatable files on the system
Yum Install GCC: Installing the GNU Compiler Suite
Yum Install Kernel-devel: Installing the Kernel-devel tool
Reboot: Rebooting the system
3. Install the Vboxguestadditions.iso image and mount it
Open the CentOS system and enter the system with root access
After the system starts normally, click Device-->cd/dvd Device--select iOS file, the file is located under the VirtualBox installation folder
Attach the CD to the mount. Mount/dev/cdrom/home/wwwroot
Enter CDROM and run the relevant program. Cd/cdrom; Sh./vboxlinuxadditions.run (wait for the program to be installed, the VirtualBox enhancement software is installed in the system)
4. Configure Shared Folders
Local Host create shared folder D:\share
Click on the running virtual machine device--shared folder settings--machine files, add shared Folders--check the created folder, fill in the name, select Permanent Assignment-click OK
Create a shared folder in the virtual machine. Mkdir/share
The folder is mounted from the virtual machine. Mount-t vboxsf www (this refers to the host folder name)/home/wwwroot (this refers to the terminal mount name)
Error on Mount:/sbin/mount.vboxsf:mounting failed with the Error:no such device
Workaround:
Yum Clean All
Yum Update
Yum Install kernel
Yum Install Kernel-devel
Yum Install Kernel-headers
Yum Install GCC
Yum Install make
Reboot
Cd/opt/vboxguestadditions-*/init
./vboxadd Setup
Reboot
Perform the mount again, successfully.
Reference:
Https://www.imooc.com/notepad/181e54
22503321
Http://f.dataguru.cn/thread-456235-1-3.html
58073520
WIN10 VirtualBox Virtual Machine build LNMP environment