(1) A machine is configured as follows
MKDIR/APP/BOOTISO-PV cd/app/bootiso cp-r/mnt/centos6/isolinux/./mkdir KS CP/ Root/anaconda-ks.cfg ks/ks6-desktop.cfg cp/root/anaconda-ks.cfg ks/ks6-mini.cfg vim ks/ks6-desktop.cfg #Kickstart file automatically generated by Anaconda. #version =devel Install URL--url=http://192.168.43.60/centos/6 in the B machine-built HTTP service, the end does not add/, Use public address reboot text #cdrom lang en_US. UTF-8 keyboard US network--onboot Yes--device eth0--bootproto DHCP--noipv6 ROOTPW--iscrypted $6$jmtvasduunqaera9$eynjvcngtgkgknbr8pq1mrqgz43gx.raa./lhutuwa1rmfh0azthj5yqxu4lj/ Zzhmzt4oe73a5onl7yjihh.1 firewall--disabled authconfig--enableshadow--passalgo=sha512 SELinux--disabled timezone--UTC Asia/shanghai bootloader--locatION=MBR--driveorder=sda--append= "Crashkernel=auto rhgb quiet" #The following is the partition information Requested #Note that any partitions you deleted is not expressed #here so unless you clear all par Titions first, this was #not guaranteed to work #clearpart--linux--DRIVES=SDA Clearp Art--all--initlabel zerombr part/boot--fstype=ext4--size=1024 part/--f STYPE=EXT4--size=50000 part/app--fstype=ext4--size=20000 part swap--size=2048 #volgroup vg_localhost--pesize=4096 pv.008002 #logvol/home--FSTYPE=EXT4--name=lv_home--vgname=vg_localho St--grow--size=100 #logvol/--fstype=ext4--name=lv_root--vgname=vg_localhost--grow--size=1024--maxsize= 51200 #logvol swap--name=lv_swap--vgname=vg_localhost--grow--size=2336--maxsize=2336 #repo--na Me= "CentOS"--baseurl=cDrom:sr0--cost=100%packages @base @core @debugging @basic-desktop @desktop-debugging @desktop-platform @directory-client @fonts @gen Eral-desktop @graphical-admin-tools @input-methods @internet-applications @net Work-file-system-client @print-client @remote-desktop-clients @server-platform @server-policy @workstation-policy%end ksvalidator ks/ks6-desktop.cfg The syntax of the test answer file Vim ks/ks6-mini.cfg #platform =x86, AMD64, or Intel em64t #version =devel #Firewall configuration Firewall--disabled #Install OS instead of upgrade Install #Use network installation URL--URL=HTTP://192.168.43.60/CENTOS/6 in machine b HTTP service, no/At the end, use public address #Root password ROOTPW--iscrypted $1$pjz2w0ap$nfqbrmmdre1/yo4ddglbi0 #System Authorization Information auth--useshadow--passalgo=sha512 #Use text mode install Text Firstboot--disable #System keyboard keyboard US #System language lang en_us #SELinux configuration SELinux--disabled #Installation Logging level logging--level=info #Rebo OT after installation reboot #System timezone timezone Asia/shanghai #Network information Network--bootproto=dhcp--device=eth0--onboot=on #System bootloader Configuration bootloader--location=mbr #Clear the Master Boot Recor D ZerOMBR #Partition Clearing information clearpart--all--initlabel #Disk p Artitioning Information part/--fstype= "EXT4"--size=10240 part/boot--fstype= "ext 4 "--size=500 part swap--fstype=" swap "--size=1024%post mkdir/root/.ssh/ Cat >/root/.ssh/authorized_keys <<eof ssh-rsa AAAAB3NZAC1YC2EAAAABIWAAAQEARUUSGJQ6UYN45LD0TRIFN qyzy5izr6eskjk0dv25eplc7tdhqkh/98waton3l0zym+v9iwxlg2hcaldm0drervu7yp6q0no9yyu+ dgsastvndrnji5b3qrhplvbosbltvqdc9et7txmcp7zmcuh1yqcpsrnf/dulaeijymtivhg68x0wgpgtpcgsz1ujxs6ho/v8i+3bpnz+w+ kmmi9ajcczog9mv7+zshaq6hdlmakbosabycdxczj4q5eutpjap0nk6nksvi6tpu+o7gld1ujf4quxngmcp79erp+ txcveujga3jp0tdgyxvu4fdw8rppnfxvejd+kt00yxlmzew== [email protected] EOF chmod 600/root/.ssh/au Thorized_keys cat >/etc/yum.repos.d/base.repo <<eof [Hello] Name=base_cenTOS6 baseurl=https://mirrors.aliyun.com/centos/6/os/x86_64/gpgcheck=0 EOF Use Radd Wang Echo 123789|passwd--stdin Wang &>/dev/null%end%packages @ Core @server-policy @workstation-policy vim-enhanced lrzsz%end Ksvalidator ks/ks6-mini.cfg Detection answer file syntax vim isolinux/isolinux.cfg set Start menu item Defaul T VESAMENU.C32 #prompt 1 timeout display boot.msg menu BAC Kground splash.jpg Menu Title Welcome to CentOS 6.9! Menu Color Border 0 #ffffffff #00000000 menu Color sel 7 #ffffffff #ff000000 Menu Color titl E 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color Unsel 0 #ffffffff #00000000 Menu Color Hotsel 0 #ff000000 #ffffffFF Menu Color Hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 Label Desktop menu label ^install or upgrade an ^desktop system kernel Vmli Nuz Append initrd=initrd.img ks=hd:sdb1:/ks/ks6-desktop.cfg label mini Menu label Install ^mini system kernel vmlinuz append initrd=initrd.img ks=hd:sdb1 :/ks/ks6-mini.cfg label local menu default Menu label Boot from ^loca L Drive Localboot 0xFFFF package the directory into an ISO bootable file: Mkisofs-r-j-t-V--no-emul-boot- -boot-load-size 4--boot-info-table-v "CentOS 6.9 x86_64 Boot"-B isolinux/isolinux.bin-c isolinux/boot.cat-o/root/boo T.iso/app/bootiso/sz/root/boot.sio transfer files to the desktop on the new virtual machine, point the path of the disc image file to the ISO file on the desktop, set the network mode weight Press ESC to enter disc selection mode, then selectSystem can be installed automatically.
(2) B Machine Setup System warehouse
cd /var/www/html/ cd centos mkdir 6 在设置中将centos6的光盘挂载上来 echo "- - -" > /sys/class/scsi_host/host0/scan 扫描出光盘 mount /dev/sr1 6/ 挂载光盘,设置系统仓库 mount 查看是否挂载成功
(3) Using virtual hard disk to simulate the production of USB boot disk
先在虚拟机设置中添加一块硬盘 vim /app/bootiso/isolinux/isolinux.cfg ks=hd:sdb1:/ks/ks6-desktop.cfg 此处需要修改将cdrom改为hd:sdb1(硬盘) mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "CentOS 6.9 x86_64 boot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/boot.iso /app/bootiso/ isohybrid /root/boot.iso 给iso文件的前512字节添加信息 dd if=/root/boot.iso of=/dev/sdb 给新加的硬盘复制信息 sync 将复制的数据进行同步 shutdown -h now 关机 找到新的硬盘,复制到桌面 在新建的虚拟机中,添加一块已存在的硬盘,在桌面找到 重启机器,按ESC键,进入setup ENTER模式,将启动项调整顺序,新硬盘放到旧硬盘之前 保存退出,即可进入系统选择界面,进行系统自动化安装;
(4) Pure CD-ROM semi-automatic installation system
mkdir /app cp -rv /mnt/centos6/ /app/centos6 find /app/centos6/ -name TRANS.TBL -exec rm {} \; 删除TRANS.TBL文件,需要重新生
Into
rm-rf/app/centos6/repodata/* cp/mnt/centos6/repodata/43d8fd068164b0f042845474d6a22262798b9f0d1f49ad1bf9f 95b953089777d-c6-x86_64-comps.xml/app/centos6/repodata/keep the file of this record warehouse file cd/app/centos6/createrepo-g repo Data/43d8fd068164b0f042845474d6a22262798b9f0d1f49ad1bf9f95b953089777d-c6-x86_64-comps.xml./Regenerate warehouse meta data mount/root /boot.iso.bak/mnt/-O loop to mount the previous ISO file for the KS file mkdir ksdir cp/mnt/ks/* ksdir/vim Isolinux/isoli Nux.cfg default VESAMENU.C32 #prompt 1 timeout display boot.msg Menu background splash.jpg menu title Welcome to CentOS 6.9! Menu Color Border 0 #ffffffff #00000000 menu Color sel 7 #ffffffff #ff000000 Menu color title 0 #fff FFFFF #00000000 Menu Color tabmsg 0 #ffffffff #00000000 menu color Unsel 0 #ffffffff #00000000 Menu Color Hotsel 0 #ff000000 #ffffffff MenuColor Hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label desktop Menu label ^install or upgrade an ^desktop system kernel Vmlinuz append INITRD=INITRD . IMG Ks=cdrom:/ksdir/ks6-desktop.cfg label mini Menu label Install ^mini system K Ernel vmlinuz append initrd=initrd.img ks=cdrom:/ksdir/ks6-mini.cfg label local m ENU default Menu label Boot from ^local Drive localboot 0xffff mkisofs-r-j-t-V-- No-emul-boot--boot-load-size 4--boot-info-table-v "CentOS 6.9 x86_64 Boot"-B isolinux/isolinux.bin-c isolinux/boot.ca T-o/root/centos6ks.iso/app/centos6/
The ISO file containing the KS answer file initiated by the CD to implement the ISO file and the remote system image warehouse operation and maintenance Automation installation system