One, the installation of the virtual machine CentOS7 system
1. Click to create a new virtual machine
2. Select Custom (Advanced) (C), click Next
3. Click Next
4. Click Browse, find the CD image of CentOS7 system, click Next
5. Select the location of the disk to be installed and click Next
6. Select the number of processors and the number of cores of each processor, choose according to the actual situation, and click Next
7. Select the memory of the virtual machine, choose according to the actual situation, and click Next
8. Click Next directly for network type, I/O controller type and disk type, create a disk, choose to create a new virtual disk, and click Next
9. Set the maximum disk size and click Next
10. Specify the location of the disk file and click Next
11. Click Finish to start the next step
12. After entering, select the first one and press enter to enter
13. Select the language Chinese→Simplified Chinese, click continue
14. Change the software selection and installation location. In the software selection, select the GNOME desktop and tick all the boxes on the right, because these functions are needed for subsequent Linux operations; the installation location selects I want to configure the partition, and click Finish
15. Click Start to start the installation
16. After setting the ROOT password and creating a user, start the installation. After installation, click the lower right corner to restart
Two, initial configuration
Host rename
hostnamectl set-hostname server1
bash
Configure the IP address of the virtual network card, click the virtual network editor in the upper left corner of the editor, as shown in Figure 1, select VMnet8, click Change Settings, as shown in Figure 2, set an IP address and subnet mask, click Apply and close as shown in Figure 3. Disable and enable VM8 virtual network card during connection
Note that if Xshell cannot connect to the virtual machine and other configurations are correct, you can try to restart the virtual network card
- Set IP address
vi /etc/sysconfig/network-scripts/ifcfg-ens33
#按i进入插入模式
BOOTPROTO=static
IPADDR=20.0.0.10
NETMASK=255.255.255.0
GATEWAY=20.0.0.2
DNS=20.0.0.2
ONBOOT=yes
按Esc退出插入模式
:wq #对配置进行保存
Restart the network card systemctl restart network
Commands to view the network card address: ifconfig and ip addr
Internet: vi /etc/resolv.conf
nameserver 20.0.0.2
Ping www.baidu.com to see if it can be pinged. After pinging, press Ctrl+c to stop the process
2. Turn off the firewall temporarily
systemctl stop firewalld
Permanently turn off the firewall
systemctl disable firewalld
Temporary core protection
setenforce 0
Permanent core protection
vi /etc/selinux/config
SELINUX=disabled
3. Mounting the CD:
The reason for mounting is that the CD is a read-only file, and the programs inside cannot be run directly. Therefore, we need to mount the CD to a locally created folder.
You can read the contents of the local folder, which is equivalent to reading the contents of the CD.
Temporary mount:
mount /dev/cdrom (the path where the CD is located) /mnt (mount point-usually a folder created in advance locally)
df -Th (Verify whether the disc is mounted successfully)
Permanently mount:
vi /etc/fstab
/dev/cdrom /mnt iso9660 defaults 0 0
4, yum source
cd /etc/yum.repos.d/ yum目录
mkdir backup 新建目录,名字为backup
mv C* backup 把所有的yum源文件全部剪切到backup下做备份,防止误删除
cp backup/CentOS-BXXX.repo
local.repo 考备模板,模板名称叫local.repo
vi local.repo 编辑模板
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=file:///mnt ######本地源############
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enable=1
Save the snapshot, the installation and initial configuration of CentOS is complete.