Linux Course 11th Day Study notes

Source: Internet
Author: User

#########################
###### unit. Automatic Installation System #######
#########################

Command line "Network Install":
Virt-install \
>--name test \
>--ram 1024 \
>--file/var/lib/libvirt/images/test.qcow2 \
>--file-size 8 \
>--location ftp://172.25.254.250/pub/rhel7.2 &

Cannot remember commands, you can use "man virt-install" to find

################### #1. Kickstart Script ####################
Kickstart script is a script file that automatically answers all problems during the installation of the system
This file enables automatic installation of the system
After the system is installed, it will be generated in the root home directory of the system.
The "anaconda-ks.cfg" file is the Kickstart script generated by this system as a template.

[Email protected] desktop]# ls/root/
Anaconda-ks.cfg Downloads Music Templates
Desktop Foundation-config-post.log Pictures Videos
Documents initial-setup-ks.cfg Public
Program scripts that run during the "anaconda-ks.cfg" installation

################### #2. Kickstart Script Creation ####################
It's hard to write kickstart manually.
The System-config-kickstart tool in the system can be made graphically kickstart

Yum Install System-config-kickstart-y # #安装图形ks制作工具
System-config-kickstart # #打开图形ks制作工具
Ksvalidator Ks.cfg # #检测ks语法

Manual editing with Vim after using the "ks.cfg" file generated by the KS tool
Vim Ks.cfg
--------------------------------------------------
%packages
@base
%end
: Wq
--------------------------------------------------
Note: If you do not add the above configuration, the installation will prompt "Software selection (Nothing selected)"
You need to press "R" key (refresh) and press "B" key (begin installation) to start the installation
And the installation is a very small system, only 318 packages installed
Minimum installation should be 499 packages

--------------------------------------------------
# Use text mode install
Text
Firstboot--disable
--------------------------------------------------
"Text" means using a text installation, where the installation process does not open graphics
"Firstboot--disable"
/Baidu "Firstboot":
Firstboot (optional)
Decide whether to start the "set up Agent" when the system is booted for the first time.
If enabled, the Firstboot package must be installed. If not specified, this option is disabled by default.
--enable or--enabled, when the system is booted for the first time, start the setup agent.
--disable or--disabled, the setup agent is not started when the system is booted for the first time.
--reconfig, enable "set Agent" in reconfiguration (reconfiguration) mode at System boot time. This mode enables options other than language, mouse, keyboard, root password, security level, time zone, and default network configuration.

"Ksvalidator ks.cfg"
The syntax for "ks.cfg" is detected, such as:
[Email protected] desktop]# vim ks.cfg
--------------------------------------------------
Delete the last line:
%end
: Wq
--------------------------------------------------
[Email protected] desktop]# Ksvalidator ks.cfg
The following problem occurred on line in the Kickstart file:

Section%packages does not end with%end.

################### #3. Kickstart File Share ####################
Yum Install Httpd-y
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
Systemctl Start httpd
Systemctl Enable httpd
CP ks.cfg/var/www/html

CP ks.cfg/var/www/html/
Note: Be sure to copy with "CP" and not move with "MV"
This is a system mechanism, it will be said later, now do not consider

If you accidentally use the "MV" move, you will find that using HTTP is not accessible
Enter the following command:
Restorecom/var/www/html/-R
You will have access to the

################### #4. Test ks file ####################
[Email protected] ~]# virt-install \
>--name kstest \
>--ram 800 \
>--file/var/lib/libvirt/images/kstest.qcow2 \
>--file-size 8 \
>--location ftp://172.25.254.250/pub/rhel7.2 \
>--extra-args "ks=http://172.25.254.100/ks.cfg" &

################### #附加pxe网络安装服务 ####################
1. Corresponding Software Installation
Yum Install DHCP Tftp-server syslinux httpd-y
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
Vim/etc/xinetd.d/tftp
[disable = yes] =====> [disable = no]
Systemctl Restart xinetd
Systemctl Start httpd
Systemctl Enable httpd

Attention:
rhel7.2 system Installation Tftp-server, do not rely on the installation of "xinetd", so you want to manually install "Yum install Xinetd-y". Good pit

2. Must download and copy files
cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
Copy all the isolinux/* from the installation image to the/var/lib/tftpboot/
Mkdir/var/lib/tftpboot/pxelinux.cfg
Cp/var/lib/tftpboot/isolinux.cfg/var/lib/tftpboot/pexlinux.cfg/default

####################
[Email protected] isolinux]# RPM-QL tftp-server
/etc/xinetd.d/tftp
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/changes
/usr/share/doc/tftp-server-5.2/readme
/usr/share/doc/tftp-server-5.2/readme.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot
[Email protected] isolinux]# RPM-QL syslinux | grep pxelinux.0
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0
[Email protected] isolinux]# cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
####################

Configuration of the 3.DHCPD service
Subnet 172.25.254.0 netmask 255.255.255.0 {
Range 172.25.254.200 172.25.254.220;
Option routers 172.25.254.254;
FileName "pxelinux.0";
Next-server 172.25.254.100;
}

[Email protected] tftpboot]# Vim/var/lib/tftpboot/pxelinux.cfg/default

--------------------------------------------------

 61 label Custom
# #增加选项 "Custom"
 62   menu label ^custom Install
# #选项名称为 "Custom Install "," ^ "indicates the following character Fugauliang
 63   kernel vmlinuz
 64   append initrd=initrd.img repo=http://172.25.50.250/rhel7.2 Quiet
# #quiet表示不看内核信息
 65
 66 label Linux
 67    Menu Label ^install Red Hat Enterprise Linux 7.2
 68   menu Default
# #修改为默认选项
 69& nbsp;  kernel vmlinuz
 70   append initrd=initrd.img repo=http://172.25.50.250/rhel7.2 ks= Http://172.25.50.250/ks.cfg
# #修改信息, specifying installation source and KS script
 71
 72 label Check
 73   Menu Label Test this ^media & install Red Hat Enterprise Linux 7.2
 74 #  menu Default
 75   Kernel vmlinuz
 76   append initrd=initrd.img inst.stage2=hd:label=rhel-7.2\x20server.x86_64 Rd.live.check quiet
--------------------------------------------------

This article from the "Schue Linux Learning Notes" blog, declined reprint!

Linux Course 11th Day Study notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.