The hardware needs to be configured, including CPU, memory, NIC, disk, mirror, etc. These in the previous study we can automatically create through the script. After configuring the hardware, start the installation, there are many options we need to manually select, so we can also create automatic answer script. This allows us to implement a virtual machine configuration installation via an instruction that is fully automated and unattended.
1. Build a good yum source;
2. Install kickstart;
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/fe1422b34f051b178bcab28fed31c2d3.png-wh_500x0-wm_3 -wmp_4-s_3195500505.png "style=" Float:none; "title=" screenshot from 2017-10-31 20-13-48.png "alt=" Fe1422b34f051b178bcab28fed31c2d3.png-wh_ "/>
Start System-config-kickstart
3. Install the DHCPD. Because to achieve the full automatic control, so to be shared through the network, and can be installed together with many computers!
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/904057c23f1c3ef2e4726bd9985c2831.png-wh_500x0-wm_3 -wmp_4-s_1735231231.png "style=" Float:none; "title=" screenshot from 2017-11-01 01-02-09.png "alt=" 904057c23f1c3ef2e4726bd9985c2831.png-wh_ "/>
4. After installation, you need to modify the DHCP configuration file to start the DHCP service.
cp/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example/etc/dhcp/dhcpd.conf---Copy the DHCP service configuration file example to its configuration file, and then modify it
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/350a5dcd2d23ca951c2680050e245d5e.png-wh_500x0-wm_3 -wmp_4-s_3188463202.png "title=" screenshot from 2017-10-31 22-34-59.png "alt=" 350a5dcd2d23ca951c2680050e245d5e.png-wh_ "/>
5. Create a script file for the virtual machine
Start making automated installation scripts when you're ready for the above work
Perform the following actions to open the graphical interface for making kickstart, and automatically generate the corresponding script file by selecting it
System-config-kickstart
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/2cf6ecdebf8e87638742f4e997d3a7ee.png-wh_500x0-wm_3 -wmp_4-s_2017174690.png "style=" Float:none; "title=" screenshot from 2017-10-31 20-14-40.png "alt=" 2cf6ecdebf8e87638742f4e997d3a7ee.png-wh_ "/>
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/7c430fb01528de10da4017a240db15d8.png-wh_500x0-wm_3 -wmp_4-s_1602752607.png "style=" Float:none; "title=" screenshot from 2017-10-31 20-16-55.png "alt=" 7c430fb01528de10da4017a240db15d8.png-wh_ "/>
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/319416634a2bfa6e0c48fc3641c1156e.png-wh_500x0-wm_3 -wmp_4-s_1234866235.png "style=" Float:none; "title=" screenshot from 2017-10-31 20-17-52.png "alt=" 319416634a2bfa6e0c48fc3641c1156e.png-wh_ "/>
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/dc52547501264c9ee8867cb948be4502.png-wh_500x0-wm_3 -wmp_4-s_283225286.png "title=" screenshot from 2017-10-31 20-18-25.png "alt=" Dc52547501264c9ee8867cb948be4502.png-wh_ "/>
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/b8e2891bf5cf563c868787e464e1fce4.png-wh_500x0-wm_3 -wmp_4-s_4022739198.png "style=" Float:none; "title=" screenshot from 2017-10-31 20-18-44.png "alt=" B8e2891bf5cf563c868787e464e1fce4.png-wh_ "/>
after generating the ks.cfg file, put him in the shared directory and add permission, put the cloth to/var/www/html out!
And this file can be added at the back with some of what you want.
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/b47df6b232b4ec43a1c92686e1399d12.png-wh_500x0-wm_3 -wmp_4-s_1258412877.png "title=" screenshot from 2017-10-31 20-24-37.png "alt=" B47df6b232b4ec43a1c92686e1399d12.png-wh_ "/>
Add permissions to Files
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/1819da4eafe2c758d8ddd43e881c3206.png-wh_500x0-wm_3 -wmp_4-s_2104794454.png "style=" Float:none; "title=" screenshot from 2017-11-01 02-10-48.png "alt=" 1819da4eafe2c758d8ddd43e881c3206.png-wh_ "/>
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/6351db882a55ab4573fb4f4cd6c69a1e.png-wh_500x0-wm_3 -wmp_4-s_2329887501.png "style=" Float:none; "title=" screenshot from 2017-11-01 02-19-05.png "alt=" 6351db882a55ab4573fb4f4cd6c69a1e.png-wh_ "/>
Through the network URL can be found
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/4a2854c0e46b6afa7959b458440d8c47.png-wh_500x0-wm_3 -wmp_4-s_1540838085.png "title=" screenshot from 2017-11-01 02-21-56.png "alt=" 4a2854c0e46b6afa7959b458440d8c47.png-wh_ "/>
Last write script file to execute install virtual machine
#! /bin/bash
Virt-install \
--name \
--ram 1024 \
--file/var/lib/libvirt/images/$1.qcow2,bus=virtio \
--network source=br0,model=virtio \
--location http://172.25.254.50/rhel7.2 \ (image file)
--extra-args "Ks=http://172.25.254.50/ks.cfg" \ (configured script file)
--vcpus 1 &
Execute, OK.
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/3182c8f65717af259ccf1a3c804573e7.png-wh_500x0-wm_3 -wmp_4-s_2464435008.png "title=" screenshot from 2017-11-01 02-31-17.png "alt=" 3182c8f65717af259ccf1a3c804573e7.png-wh_ "/>
This article is from the "13345576" blog, please be sure to keep this source http://13355576.blog.51cto.com/13345576/1978270
Automatic installation of virtual machines with script files under Linux