Linux: Automatically install virtual machine script

Automated installation of virtual machines

Kickstart Maker Installation
Using kickstart, system administrators can create a file containing answers to all frequently asked questions during installation to automate the installation of Red Hat Enterprise Linux
Kickstart Similar to Jumpstart in Oracle solaris or Unattended for Microsoft Windows Installation
package: system-config-kickstart
Installation: yum system-config-kickstart The following experimental steps
can be performed on the basis of dhcp construction : yum install httpd system-config-kickstart -y ##Install apache and system-config- kickstart


system-config-kickstart ##Display interface selection

Step 1: Set a password and select the last two small boxes

Step 2: Set http (write real machine ip)

Step 3: Select the first one except for the second one

Step 4: Select the first one, click ADD to select the partition

Step 5: Add dynamic network (eth0)

Step 6: Default

Step 7: Turn off the firewall

Everything else is default

After all selected, save in File System /var/www/hrml  


In the web browser: 172.25.254.119/ks.cfg ##Enter the virtual machine ip to see if the above operation is correct

Note: If it does not appear, please check whether the firewall is turned off!

cd / var / www / html /

 vim ks.cfg
write content: %packages
                    @base ##The most basic component of the system
                     lftp ##An installation package
                    %end
The function of writing content: specify the software that needs to be installed during the installation process

ksvalibdator ks.cfg ## Detection prevention

systemctl  start  httpd

systemctl   stop  firewalld

Write content:


Perform the following steps on a real machine:
cd /mnt/
vim vm_create.sh
Write content: #!/bin/bash
                    virt-install \
                    --name $1 \
                    --ram 1024 \
                     --cpus 1 \
                     --disk /var/ lib/libvirt/images/$1.qcow2,size=8,bus=virtio \
                     --network source=br0,model=virtio \
                     --locatio http://172.25.254.19/source7.2 \ (real machine ip)

                     --extra-args "ks=http://172.25.254.119/ks.cfg" & (virtual machine ip)

chmod +x vm_create.sh           

/mnt/vm_create.sh westos



Note: There is no black interface after the script is executed, there is a problem with the script

There is a black interface and there is no automatic installation, there is a problem with the ks.cfg text

Be sure to carry out every step carefully, check whether the firewall is turned off, and whether Apache is turned on

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325476608&siteId=291194637