Install CentOS7 under VirtualBox and open the shared path

Install CentOS7 under VirtualBox and open the shared path

Install VirtualBox

I chose VirtualBox because I saw the VirtualBox used by DockerTool, and I wanted to confirm whether it will also install several services in windows like VMWare, making the machine run slowly (VirtualBox is better than VMWare). Download and install VirtualBox 5.1.8, and then install CentOS7-x86-Mini1511. Next, I will record this process so that I can describe it to others in the future.

Create a virtual machine

  • Create a Linux virtual machine:
    • Set path: Because you don't want to put the virtual machine on the C drive, you need to set the default virtual computer location in the VirtualBox global settings. Set this location to another directory, specifically for placing virtual machines. I changed it later, and added it to the first in order to avoid detours.
    • Since there is no CentOS operating system to choose from, just choose Linux2.6/3.x/4.x/(64bit);
    • 1CPU, 1G memory, 8G hard disk, everything defaults;
    • Select NAT for the network, in order to facilitate the update program on the external network without involving the company’s internal network settings;
    • In the hardware settings, use the optical drive to load the CentOS7 CD;
    • Everything is ready, start.
  • Install the operating system and enter the graphical installation interface of CentOS7:
    • Choose China, Chinese;
    • Select the default disk partition (research the data, log, swap area, and system partition in the future).
    • Create root user
    • Create another login user hdp
    • Everything else is by default
      Create a user:
      If you like to use a password of no more than 5 characters like me, you need to click the confirm button twice.
      Export virtual machine: It
      basically takes up more than 1G of disk space after installation all the way. At this time, the function of the virtual machine should be used to export this virtual machine for future use. No need to bother to set these options above, and make each virtual machine consistent.

Install Linux software

Restart the virtual machine, log in with the hdp user, and want to check the ip address, so I typed ifconfig and found that the command was not found. Then you need to install some basic software, export the virtual machine again after installation, for future reuse.

linux setup network

  • View port: CentOS7 does not have the ifconfig command by default, you need to use ip addr to view the port.
  • Find the network card: at least 2 network devices can be seen through the ip addr command, and the one with the word ether is the network card.
  • Turn on auto-start: find [/etc/sysconfig/network-scripts/ifcfg-${network card name}], edit this file with root user authority, you can see TYPE=Ethernet (Ethernet), BOOTPROTO=dhcp (obtained through dhcp ip and other information); change ONBOOT=no to ONBOOT=yes
  • Restart the network: Restart the network card through the command service network restart. Type ping www.baidu.com and find that it can be pinged. Explain that you can go online.

Reference article: https://linux.cn/article-3631-1.html

Install virtualBox toolkit

virtualBox has the following functions:

  1. shared documents
  2. Share clipboard contents
  3. Seamless window-realize smooth mouse movement between virtual machine and host
  4. auto login

Currently, some software needs to be installed, and the shared file function is mainly used, so there is no need to copy each time. Hope to see the files in the specified path in the windows system from the linux system of the virtual machine. For example: jdk-8u111-linux-x64.rpm and so on. Proceed as follows:

  • Mounting: VBoxGuestAdditions.iso under the VirtualBox installation path contains the contents of the toolkit. One way is to click on the "Device"-"Install Enhancements" on the interface, and the other way is to load the ISO file to the virtual machine CD-ROM drive, mount, and execute the ./VBoxLinuxAdditions.run file.
  • The installation failed and the system asked to check the log. After checking the log with the cat command, it was found that the dependencies were missing.
  • Install bzip2, gcc, make, kernel-devel and other dependencies through yum install * .
  • The installation fails, check the log and find that the KERN_DIR environment variable needs to be set. Note that the tail el7 in the source path of centOS7 /usr/src/kernels/3.10.0-327.36.3.e17.x86_64 is not the number seventeen, but the English L.
  • After the installation is successful, check the service through the systemctl command and find that vboxaddition-service.service is red. Restart the server here to return to normal.
  • Use the command mount | grep vboxsf to query whether the vboxsf type device can be mounted, and output share on /media/sf_share type vboxsf
  • Enter the media/sf_share path and find that the shared path has been successfully mounted, and you can see the files in the shared path.

Guess you like

Origin blog.csdn.net/killingbow/article/details/53156818