1.kickstart概述:
使用kickstart,系统管理员可以创建一个包含安装期间所有常见问题的答案的文件,以自动安装Red Hat Enterprise Linux。Kickstart类似于Oracle solaris 中的Jumpstart或Microsoft Windows的无人值守安装。
2.Kickstart制作工具安装:
软件包:system-config-kickstart
安装:yum install system-config-kickstart
###############################################自动安装虚拟机实验##################################################
[root@localhost ~]# yum install httpd ## 安装共享服务httpd
Loaded plugins: langpacks
rhel_dvd | 4.1 kB 00:00
software | 2.9 kB 00:00
Package httpd-2.4.6-17.el7.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]# yum install system-config-kickstart.noarch -y ## 安装kickstart软件
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package system-config-kickstart.noarch 0:2.9.2-4.el7 will be installed
--> Processing Dependency: system-config-keyboard >= 1.3.1 for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-date for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-language for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Running transaction check
---> Package system-config-date.noarch 0:1.10.6-2.el7 will be installed
--> Processing Dependency: system-config-date-docs for package: system-config-date-1.10.6-2.el7.noarch
---> Package system-config-keyboard.noarch 0:1.4.0-4.el7 will be installed
--> Processing Dependency: system-config-keyboard-base = 1.4.0-4.el7 for package: system-config-keyboard-1.4.0-4.el7.noarch
---> Package system-config-language.noarch 0:1.4.0-6.el7 will be installed
--> Running transaction check
---> Package system-config-date-docs.noarch 0:1.0.11-4.el7 will be installed
---> Package system-config-keyboard-base.noarch 0:1.4.0-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
system-config-kickstart noarch 2.9.2-4.el7 rhel_dvd 351 k
Installing for dependencies:
system-config-date noarch 1.10.6-2.el7 rhel_dvd 619 k
system-config-date-docs noarch 1.0.11-4.el7 rhel_dvd 527 k
system-config-keyboard noarch 1.4.0-4.el7 rhel_dvd 33 k
system-config-keyboard-base noarch 1.4.0-4.el7 rhel_dvd 103 k
system-config-language noarch 1.4.0-6.el7 rhel_dvd 132 k
Transaction Summary
================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 1.7 M
Installed size: 6.4 M
Downloading packages:
(1/6): system-config-date-1.10.6-2.el7.noarch.rpm | 619 kB 00:00
(2/6): system-config-keyboard-1.4.0-4.el7.noarch.rpm | 33 kB 00:00
(3/6): system-config-keyboard-base-1.4.0-4.el7.noarch.rpm | 103 kB 00:00
(4/6): system-config-date-docs-1.0.11-4.el7.noarch.rpm | 527 kB 00:00
(5/6): system-config-kickstart-2.9.2-4.el7.noarch.rpm | 351 kB 00:00
(6/6): system-config-language-1.4.0-6.el7.noarch.rpm | 132 kB 00:00
--------------------------------------------------------------------------------
Total 5.8 MB/s | 1.7 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : system-config-date-1.10.6-2.el7.noarch 1/6
Installing : system-config-date-docs-1.0.11-4.el7.noarch 2/6
Installing : system-config-language-1.4.0-6.el7.noarch 3/6
Installing : system-config-keyboard-base-1.4.0-4.el7.noarch 4/6
Installing : system-config-keyboard-1.4.0-4.el7.noarch 5/6
Installing : system-config-kickstart-2.9.2-4.el7.noarch 6/6
Verifying : system-config-date-docs-1.0.11-4.el7.noarch 1/6
Verifying : system-config-keyboard-1.4.0-4.el7.noarch 2/6
Verifying : system-config-date-1.10.6-2.el7.noarch 3/6
Verifying : system-config-kickstart-2.9.2-4.el7.noarch 4/6
Verifying : system-config-keyboard-base-1.4.0-4.el7.noarch 5/6
Verifying : system-config-language-1.4.0-6.el7.noarch 6/6
Installed:
system-config-kickstart.noarch 0:2.9.2-4.el7
Dependency Installed:
system-config-date.noarch 0:1.10.6-2.el7
system-config-date-docs.noarch 0:1.0.11-4.el7
system-config-keyboard.noarch 0:1.4.0-4.el7
system-config-keyboard-base.noarch 0:1.4.0-4.el7
system-config-language.noarch 0:1.4.0-6.el7
Complete! ## 安装成功
Loaded plugins: langpacks
[root@localhost ~]# systemctl start httpd ## 打开共享服务
[root@localhost ~]# systemctl stop firewalld ## 关闭火墙
[root@localhost html]# ls ## 查看ks.cfg有没有
ks.cfg software
[root@localhost html]# vim ks.cfg ## 编辑配置文件
%%%%编辑内容:『编辑到最后』
%packages
@base
lftp
%end
[root@localhost html]# ksvalidator ks.cfg ## 检测有没有语法错误
然后在真机里:
[kiosk@foundation20 mnt]$ su - ## 切换到超级用户
Password:
Last login: Sat Apr 28 15:33:23 CST 2018 on pts/1
ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1524900803
[root@foundation20 ~]# cd /mnt ## 移动路径
[root@foundation20 mnt]# vim vm_create.sh ## 编辑文件,文件名自定义要加.sh
%%%%%编辑内容:
#!/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 \
--location http://172.25.254.10/source7.2 \
--extra-args "ks=http://172.25.254.120/ks.cfg" &
[root@foundation20 mnt]# chmod +x /mnt/vm_create.sh ## 给权限
[root@foundation20 mnt]# /mnt/vm_create.sh zgd ## 调用命令,给一个虚拟机名称
[root@foundation20 mnt]#
Starting install...
Retrieving file vmlinuz... | 9.8 MB 00:00 !!!
Retrieving file initrd.img... | 76 MB 00:00 !!!
Creating domain... | 0 B 00:00
(virt-viewer:8392): GSpice-WARNING **: PulseAudio context failed Connection refused
(virt-viewer:8392): GSpice-WARNING **: pa_context_connect() failed: Connection refused
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
a
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
%%此时虚拟机会自动建立%%
使用kickstart,系统管理员可以创建一个包含安装期间所有常见问题的答案的文件,以自动安装Red Hat Enterprise Linux。Kickstart类似于Oracle solaris 中的Jumpstart或Microsoft Windows的无人值守安装。
2.Kickstart制作工具安装:
软件包:system-config-kickstart
安装:yum install system-config-kickstart
###############################################自动安装虚拟机实验##################################################
[root@localhost ~]# yum install httpd ## 安装共享服务httpd
Loaded plugins: langpacks
rhel_dvd | 4.1 kB 00:00
software | 2.9 kB 00:00
Package httpd-2.4.6-17.el7.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]# yum install system-config-kickstart.noarch -y ## 安装kickstart软件
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package system-config-kickstart.noarch 0:2.9.2-4.el7 will be installed
--> Processing Dependency: system-config-keyboard >= 1.3.1 for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-date for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-language for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Running transaction check
---> Package system-config-date.noarch 0:1.10.6-2.el7 will be installed
--> Processing Dependency: system-config-date-docs for package: system-config-date-1.10.6-2.el7.noarch
---> Package system-config-keyboard.noarch 0:1.4.0-4.el7 will be installed
--> Processing Dependency: system-config-keyboard-base = 1.4.0-4.el7 for package: system-config-keyboard-1.4.0-4.el7.noarch
---> Package system-config-language.noarch 0:1.4.0-6.el7 will be installed
--> Running transaction check
---> Package system-config-date-docs.noarch 0:1.0.11-4.el7 will be installed
---> Package system-config-keyboard-base.noarch 0:1.4.0-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
system-config-kickstart noarch 2.9.2-4.el7 rhel_dvd 351 k
Installing for dependencies:
system-config-date noarch 1.10.6-2.el7 rhel_dvd 619 k
system-config-date-docs noarch 1.0.11-4.el7 rhel_dvd 527 k
system-config-keyboard noarch 1.4.0-4.el7 rhel_dvd 33 k
system-config-keyboard-base noarch 1.4.0-4.el7 rhel_dvd 103 k
system-config-language noarch 1.4.0-6.el7 rhel_dvd 132 k
Transaction Summary
================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 1.7 M
Installed size: 6.4 M
Downloading packages:
(1/6): system-config-date-1.10.6-2.el7.noarch.rpm | 619 kB 00:00
(2/6): system-config-keyboard-1.4.0-4.el7.noarch.rpm | 33 kB 00:00
(3/6): system-config-keyboard-base-1.4.0-4.el7.noarch.rpm | 103 kB 00:00
(4/6): system-config-date-docs-1.0.11-4.el7.noarch.rpm | 527 kB 00:00
(5/6): system-config-kickstart-2.9.2-4.el7.noarch.rpm | 351 kB 00:00
(6/6): system-config-language-1.4.0-6.el7.noarch.rpm | 132 kB 00:00
--------------------------------------------------------------------------------
Total 5.8 MB/s | 1.7 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : system-config-date-1.10.6-2.el7.noarch 1/6
Installing : system-config-date-docs-1.0.11-4.el7.noarch 2/6
Installing : system-config-language-1.4.0-6.el7.noarch 3/6
Installing : system-config-keyboard-base-1.4.0-4.el7.noarch 4/6
Installing : system-config-keyboard-1.4.0-4.el7.noarch 5/6
Installing : system-config-kickstart-2.9.2-4.el7.noarch 6/6
Verifying : system-config-date-docs-1.0.11-4.el7.noarch 1/6
Verifying : system-config-keyboard-1.4.0-4.el7.noarch 2/6
Verifying : system-config-date-1.10.6-2.el7.noarch 3/6
Verifying : system-config-kickstart-2.9.2-4.el7.noarch 4/6
Verifying : system-config-keyboard-base-1.4.0-4.el7.noarch 5/6
Verifying : system-config-language-1.4.0-6.el7.noarch 6/6
Installed:
system-config-kickstart.noarch 0:2.9.2-4.el7
Dependency Installed:
system-config-date.noarch 0:1.10.6-2.el7
system-config-date-docs.noarch 0:1.0.11-4.el7
system-config-keyboard.noarch 0:1.4.0-4.el7
system-config-keyboard-base.noarch 0:1.4.0-4.el7
system-config-language.noarch 0:1.4.0-6.el7
Complete! ## 安装成功
[root@localhost ~]# system-config-kickstart ##打开虚拟机安装选择界面进行选项
/usr/share/system-config-kickstart/kickstartGui.py:104: GtkWarning: GtkSpinButton: setting an adjustment with non-zero page size is deprecated
Loaded plugins: langpacks
[root@localhost ~]# systemctl start httpd ## 打开共享服务
[root@localhost ~]# systemctl stop firewalld ## 关闭火墙
然后在真机的firefox里输入:http://172.25.254.120/ks.cfg ##查看【firefox显示】
[root@localhost html]# ls ## 查看ks.cfg有没有
ks.cfg software
[root@localhost html]# vim ks.cfg ## 编辑配置文件
%%%%编辑内容:『编辑到最后』
%packages
@base
lftp
%end
[root@localhost html]# ksvalidator ks.cfg ## 检测有没有语法错误
然后在真机里:
[kiosk@foundation20 mnt]$ su - ## 切换到超级用户
Password:
Last login: Sat Apr 28 15:33:23 CST 2018 on pts/1
ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1524900803
[root@foundation20 ~]# cd /mnt ## 移动路径
[root@foundation20 mnt]# vim vm_create.sh ## 编辑文件,文件名自定义要加.sh
%%%%%编辑内容:
#!/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 \
--location http://172.25.254.10/source7.2 \
--extra-args "ks=http://172.25.254.120/ks.cfg" &
[root@foundation20 mnt]# chmod +x /mnt/vm_create.sh ## 给权限
[root@foundation20 mnt]# /mnt/vm_create.sh zgd ## 调用命令,给一个虚拟机名称
[root@foundation20 mnt]#
Starting install...
Retrieving file vmlinuz... | 9.8 MB 00:00 !!!
Retrieving file initrd.img... | 76 MB 00:00 !!!
Creating domain... | 0 B 00:00
(virt-viewer:8392): GSpice-WARNING **: PulseAudio context failed Connection refused
(virt-viewer:8392): GSpice-WARNING **: pa_context_connect() failed: Connection refused
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
a
(virt-viewer:8392): GSpice-WARNING **: Error calling 'org.gnome.SessionManager.Inhibit': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
%%此时虚拟机会自动建立%%