Virtual Machine Installation Method
Now I'm going to use redhat7.3 mirroring to do the demo.
real-Machine Linux system
operating system:red Hat Enterprise Linux Server 7.2 (Maipo) 1. Graphics installation
Executing under Super User
Virt-manager # # #打开虚拟机管理器
Click on the top left corner icon
Select the first option ISO or CDROM and then click Forward Figure Mark
Click on the browse icon, browse local Select the mirrored path you have downloaded, click Forward
Point foward to the next step, the parameters in the procedure can be changed according to the ego
Click Finish to install
Use the UP and down keys to select the first install
language can be based on self choice in English, click Continue
Click on the software icon to choose the installation software, the default is to minimize the installation, and then click Done
Click on the icon to partition settings, select the self to partition, to partition settings
set the size of the/boot,wap,/
Click Start Installation
Setting the root password
set up a common user and password
Click Reboot and you're done.
you may find that the installation of the graphical interface is too cumbersome, the following to introduce a key script installation method 2.kickstart Script Installation Method
Kickstart
With kickstart, a system administrator can create a file that contains answers to all frequently asked questions during installation to automatically install Red Hat Enterprise Linux Kickstart similar to Jumpstart or Mic in Oracle Solaris Rosoft Unattended installation of Windows
It is difficult to write kickstart scripts manually, and we use our system to make them with our own package tools. But there will be bugs, and the selection package needs to be added manually. Environment Deployment
Download Kickstart and httpd services from the real machine root
with your own Yum source, can refer to blog:http://blog.csdn.net/dream_ya/article/details/79130384
Yum Install System-config-kickstart httpd-y # # #用yum安装
use RPM to see if the software was installed successfully, as shown below
Systemctl start httpd # # #开启服务
chkconfig httpd on # # #开机自动开启服务
systemctl stop Firewalld ### Close firewall
systemctl mask firewalld # # #冻结防火墙
Kickstart make Ks.cfg script
the real machine root
System-config-kickstart # # #启动kickstart
Basic Configuration Settings
Lnstallation Method Setting
Boot Loader Options settings
Partition Information Settings
Click Add for partition settings,/boot,swap,/
Set as shown.
Network Configuration Settings
Set as shown.
Save the file under/var/www/html/in the upper left corner
Change ks.cfg configuration
Vim/var/www/html/ks.cfg # # #编辑ks. CFG
at the end you can add what you want to install
%packages # # #安装包起始位
@base # # #组 (package)
lftp # # #lftp服务%end # # #安装包结束位
%post # # #安装完成执行的命令 rm-rf/etc/yum.repos.d/* # # #删除目录下文件%end # # # # #结束
Check if syntax is wrong
Ksvalidator/var/www/html/ks.cfg # # #没有报错, grammar is true
Script Creation
vim/server/scripts/vm_auto_create.sh # # #编辑脚本
Enter edit mode
#!/bin/bash # # #用bash解析
virt-install \ # # #安装虚拟机
--location http://172.25.254.56/rhel7.3 \ ### SOURCE location
--extra-args "Ks=http://172.25.254.56/ks.cfg" \ # # #应答的文件路径
--ram 1024 \ # # #内存大小
--cpus 1 \ # # #cpu个数
--file-size 8 \ # # #磁盘大小
--file/var/lib/libvirt/images/$1.qcow2,bus=virtio \ # # #安装位置
--network source=br0,model=virtio \ # # #网卡设置
--name $ & # #虚拟机名字
Run the script
chmod 755-r /server/scripts/
sh/server/scripts/vm_auto_create.sh Test # # #执行脚本
Kickstart make Ks.cfg script ...