The virtual machine VBox installs CentOS6.8, access to the internal and external networks.
1. Purpose
For the needs of learning and research, we often need to install the Linux system and some software on the virtual machine, and require both the external network and the interaction with the host visit.
But many tutorials on the Internet are cumbersome and unclear. This article is to guide the installation and configuration as simple and clear as possible based on successful experience.
Note: Because I have referred to many online tutorials, some of the steps in this article may not be necessary, because there is no time to screen and eliminate them one by one, so please refer to them dialectically.
2. Preparation of Windows After
installing VBox, there should be VirtualBoxHost-Only Network in the network connection. The settings are as follows:
The native environment is in a notebook, and WiFi is used. The settings are as follows:
Three, virtual machine configuration
management à global settings à
The configuration of the newly created virtual machine is as follows:
Other options can be configured according to personal environment.
4. Installation of CentOS6.8 There is
nothing to say in this section. For convenience, I installed the desktop version, which is not needed for actual use.
Ctrl+F full screen switch
Ctrl+C zoom switch
Five, CentOS6.8 configuration
enters the desktop, there are two networks:
Edit System eth1 as shown below
So far, open the Firefox browser that comes with the system and visit Baidu successfully.
eth0 is to access the external network, and eth1 is connected to the host.
Connect the client to 192.168 and 56.103 on the host through SSH, and the access is successful.
note:
cd /etc/sysconfig/network-scripts
vi ifcfg-eth0
vi ifcfg-eth1
Where ONBOOT must = yes
Or set up automatic connection in the desktop version.
service network restart
Restart service
Six, boot into the command line
root user
vi /etc/inittab
Find the following statement:
Default runlevel. The runlevels used byRHS are:
1-Single user mode-Single user mode
#2 – Multiuser, without NFS (The same as 3, if you do not havenetworking) – Multiuser mode, does not support NFS
3-Full multiuser mode-Multiuser mode
4-unused-not used
5-X11-Graphical interface
6 – reboot (Do NOT set initdefault tothis) – reboot
id:5:initdefault:-The default run level is 5, just change this to id:3:initdefault:
In addition, if you want to start the graphical interface in text mode, you can use the following method:
startx
CentOS7 :
systemctl set-default graphical.target #graphic
systemctl set-default multi-user.target #Command line
7. JDK settings
1. When deleting the OpenJDK
installation system, you can choose not to install JDK. If you choose, you should uninstall the installed OpenJDK.
java –version
java version "1.7.0_99"
OpenJDK Runtime Environment (rhel-2.6.5.1.el6-x86_64 u99-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
rpm -qa | grep java
java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
tzdata-java-2016c-1.el6.noarch
Uninstall command:
yum -y remove java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
2. Install JDK7 and 8.
Download the tar.gz package of JDK7 and 8 from the Oracle website and upload it to the server.
As the root user, create the directory /usr/local/java, and cut the two tar.gz to this.
Unzip the two compressed packages:
tar –zxvf jdk-7u80-linux-x64.tar.gz
tar –zxvf jdk-8u131-linux-x64.tar.gz
In this environment, JDK8 is used as the default configuration, and JDK7 is for Tomcat of Dubbo console. For details, please refer to "Dubbo Management Console Installation"
Configure the JDK8 environment:
vi /etc/profile adds:
java env
exportJAVA_HOME=/usr/local/java/jdk1.8.0_131
export JRE_HOME=$JAVA_HOME/jre
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
exportPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
source /etc/profile