コブラー自動インストールシステム(Centos7.X)

周囲:

[ root@kickstart ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708(Core)[root@kickstart ~]# uname -r
3.10.0- 693. el7.x86_64
[ root@kickstart ~]# getenforce
Disabled
[ root@kickstart ~]# systemctl status  firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
 Loaded:loaded(/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
 Active:inactive(dead)
  Docs: man:firewalld(1)[root@kickstart ~]# hostname -I
10.0.0.201172.16.1.201

序文#

Cobblerのインストールは比較的簡単で、PXE +キックスタートネットワークのインストールと比較して、主にWebページの操作が少しずつ簡単です。

PXE +キックスタートネットワークインストールシステムプロセスの原則を理解していない場合は、私が書いたものを確認することをお勧めします[<PXE+kickstart网络安装CentOS7.4系统及过程中各种报错> ](http://www.cnblogs.com/lyq863987322/p/8249867.html)<-突く

コブラーのインストール#

1、 コブラーと関連ソフトウェアをダウンロードする##

[ root@Cobbler ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd

2、 構成を確認して変更します##

注:確認するには、CentOS7でhttpdサービスとcobblerサービスを開始する必要があります

[ root@Cobbler ~]# systemctl start cobblerd.service httpd.service
[ root@Cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix:1: The 'server' field in/etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.2: For PXE to be functional, the 'next_server' field in/etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.3: change 'disable' to 'no'in/etc/xinetd.d/tftp
4: Some network boot-loaders are missing from/var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or,if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files inthis directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.5: enable and start rsyncd.service with systemctl
6: debmirror package is not installed, it will be required to manage debian deployments and repositories
7: The default password used by the sample templates for newly installed machines(default_password_crypted in/etc/cobbler/settings) is still set to 'cobbler' and should be changed,try:"openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate newone8: fencing tools were not found, and are required to use the(optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

これらのチェック項目に従って、関連するチェック項目に変更を加えます###

sed -i 's/server: 127.0.0.1/server: 172.16.1.202/'/etc/cobbler/settings
sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.202/'/etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/'/etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/'/etc/cobbler/settings
sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'oldboy' '123456'`\"#"/etc/cobbler/settings
sed -i 's#yes#no#'/etc/xinetd.d/tftp

systemctl start rsyncd
systemctl enable rsyncd
systemctl enable tftp.socket
systemctl start tftp.socket 
systemctl restart cobblerd.service

dhcpテンプレート構成ファイルを変更します###

sed -i.ori 's#192.168.1#172.16.1#g;22d;23d'/etc/cobbler/dhcp.template

すべての構成を同期します###

注:同期されていない場合、エラーが報告されます

[ root@Cobbler ~]# cobbler sync
task started:2017-11-15_101915_sync
task started(id=Sync, time=Wed Nov 1510:19:152017)
running pre-sync triggers
cleaning trees
removing:/var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0->/var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 ->/var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot ->/var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk ->/var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi ->/var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from/var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

コブラー使用操作#

ブロガーは仮想マシン操作を使用します

https://10.0.0.202/cobbler_WebブラウザアクセスURL
デフォルトのアカウントパスワードはcobblerです

ミラーのインポート(DVDのインポート)##

注:最初に、仮想マシンは次の操作を保証する必要があります

ミラーの位置に応じて、###をマウントします

image.png

ミラーの場所にmntが書き込まれているため、ミラーはmntの下にマウントする必要があります
[ root@Cobbler pxelinux.cfg]# mount /dev/cdrom /mnt/[root@Cobbler pxelinux.cfg]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        98G  5.8G   93G   6% /
devtmpfs        902M     0  902M   0%/dev
tmpfs           912M     0  912M   0%/dev/shm
tmpfs           912M  8.7M  903M   1%/run
tmpfs           912M     0  912M   0%/sys/fs/cgroup
/dev/sda1      1014M  135M  880M  14%/boot
tmpfs           183M     0  183M   0%/run/user/0/dev/sr0        4.3G  4.3G     0100%/mnt
プロセスをチェックして、インポートしているかどうかを確認します
[ root@Cobbler ~]# ps -ef|grep rsync
root    159231009:49?00:00:00/usr/bin/rsync --daemon --no-detach
root    17237159731510:53?00:00:03 rsync -a /mnt//var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress
root    1723817237010:53?00:00:00 rsync -a /mnt//var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress
root    17239172381110:53?00:00:02 rsync -a /mnt//var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress

ksファイル構成##

コマンドセクション###

インストールの開始時に、%preに

パケットグループセグメント###

%packagesで始まり、%endで終わります

スクリプトセクション###

%postで開始し、%endで終了します。システムのインストール後に実行される関連するLinuxコマンドとスクリプト

%preで始まり、%endで終わります。システムがインストールされる前に実行される関連するLinuxコマンドとスクリプト

キックスタートファイル構文チェック##

文法チェックソフトウェアをダウンロードする###

yum install pykickstart -y

コマンド###を確認してください

[ root@CentOS7 tftpboot]# ksvalidator /var/www/html/ks_config/CentOS-7-ks.cfg 
注:この検証ツールには制限があることに注意してください。キックスタートファイルは非常に複雑になる可能性があります。ksvalidatorは、構文が正しく、ファイルに廃止されたオプションが含まれていないことを保証します。
ただし、インストールが成功することを保証することはできません。キックスタートファイルの検証は試行されません%pre、%投稿して%パッケージセクション。

ルート暗号化パスワードの生成##

パスワード:123456

[ root@CentOS7 ~]# python -c 'import crypt; print(crypt.crypt("123456"))'
$6$02PfimLMqN53z6Io$ov2Xbjm7ZC36X2tFvqnI0HymvqMY0vI/UOCxze0L/zMX722PkDJOz/JTWwVHaksawGf/bfR0k3GCpubodKTdV0

CentOS7ksファイルの追加##

CentOS7ksファイルコンテンツ###

# Cobbler for Kickstart Configurator for CentOS 7 by yao zhang
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# Network information
$SNIPPET('network_config')
# network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw  --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 1024
part swap --size 1024
part /--fstype xfs --size 1--grow
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot

%pre
$SNIPPET('log_ks_pre')$SNIPPET('kickstart_start')$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')%end

%packages
@^ minimal
@ compat-libraries
@ core
@ debugging
@ development
bash-completion
chrony
dos2unix
kexec-tools
lrzsz
nmap
sysstat
telnet
tree
vim
wget
%end

%post
systemctl disable postfix.service
%end

ksファイルの内容についての詳細な説明は私によって書かれています[<PXE+kickstart网络安装CentOS7.4系统及过程中各种报错> ](http://www.cnblogs.com/lyq863987322/p/8249867.html)で説明

ミラー変数の属性を変更する##

カスタムインストールシステム##

Recommended Posts

コブラー自動インストールシステム(Centos7.X)
コブラー自動インストールシステム(Centos7.X)
Ubuntuシステムのインストール
ubuntu-サーバーシステムのインストール
CentOS8.xシステム構成レコード
CentOS7.xシステム構成レコード
Ubuntuデュアルシステムのインストール
CentOS7.Xシステムのインストールと最適化
CentOS7.xシステムルートディレクトリパーティションの拡張