본문 바로가기

LINUX

PXE Server Kickstart 구성 및 script

반응형

PXE Server 설치 및 구성(CentOS 6 or 7)

 

 

PXE Server 설치 및 구성(CentOS 6 or 7)

PXE Server는 네트워크를 통해 하나의 서버에서 다수의 클라이언트로 배포, 패치 등을 set up 할 수 있는 서버입니다. 보통 인프라 쪽에서 자주 사용하는 기능입니다. OS를 install 하거나 패치를 배포

maru1000.tistory.com

 

 

이어지는 내용입니다

 

Kickstart 폴더를 하나 만듭니다

 

mkdir -p /var/www/html/ks

 

cd /var/www/html/ks

 

TEST로 Kickstart 파일을 만듭니다

 

vi TEST.cfg

 

 

#platform=AMD64
#version=TEST
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.0.55/redhat74"
# Root password
rootpw --iscrypted $1$2F.n4v2j$JuSFoYunv5zNc.wufC3Kk.
# System authorization information
auth --useshadow --passalgo=sha512
# Use text install
#graphical
text
firstboot --disable
# System keyboard
#keyboard us
keyboard --vckeymap=kr --xlayouts='kr'
# System language
lang ko_KR.UTF-8
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# System timezone
timezone Asia/Seoul
# Network information
network --activate --bootproto=dhcp --device=link --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap --fstype=swap --size=4096
part /boot/efi --fstype=efi --size=200
part / --fstype=ext4 --size=51200
part /data --fstype=ext4 --grow --size=1

%packages
@^developer-workstation-environment
@backup-client
@base
@compat-libraries
@core
@debugging
@desktop-debugging
@development
@dial-up
@directory-client
@dns-server
@emacs
@file-server
@fonts
@ftp-server
@gnome-apps
@gnome-desktop
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-applications
@internet-browser
@java-platform
@kde-desktop
@large-systems
@legacy-x
@mainframe-access
@multimedia
@network-file-system-client
@performance
@perl-runtime
@perl-web
@php
@print-client
@ruby-runtime
@virtualization-client
@virtualization-hypervisor
@virtualization-tools
@web-server
@x11
chrony
%end

%addon com_redhat_kdump --disable --reserve-mb='auto'

%end

%post
mkdir /root/.ssh
wget http://192.168.0.55/ssh/authorized_keys -P /root/.ssh
wget http://192.168.0.55/ssh/id_rsa -P /root/.ssh
wget http://192.168.0.55/ssh/id_rsa.pub -P /root/.ssh
chmod 600 /root/.ssh/*
wget http://192.168.0.55/script/TEST_Script.sh
chmod 755 /TEST_Script.sh
./TEST_Script.sh
rm -f ./TEST_Script.sh
rm -rf /root/.ssh
%end
reboot

 

 

 

ISO 파일을 복사합니다.(바로 redhat74 폴더에 풀어도 됩니다)

 

mkdir -p /var/www/html/redhat74

 

cd /mnt

cp ./* /var/www/html/redhat74

 

 

23.3. 킥스타트 구문 참조 Red Hat Enterprise Linux 7

 

킥스타트는 여기까지고 아래는 스크립트입니다.

 

 

vi /var/www/html/script/TEST_script.sh

 

 

#!/bin/bash

mkdir /user
mkdir /data

useradd -d /user/TEST test
echo 'test' | passwd --stdin test

#FTP root Account Limit Disable
perl -p -i -e '$.==2 and print "#"' /etc/vsftpd/ftpusers
perl -p -i -e '$.==7 and print "#"' /etc/vsftpd/user_list

#Automatic Login Account is TEST
perl -p -i -e '$.==4 and print "AutomaticLoginEnable=true\n"' /etc/gdm/custom.conf
perl -p -i -e '$.==5 and print "AutomaticLogin=test\n"' /etc/gdm/custom.conf

#Modify file name securetty file
mv /etc/securetty /etc/Securetty

#Eclipse,JDK Install
mkdir /telnet

wget -P /telnet http://192.168.0.55/app/telnet-server-0.17-64.el7.x86_64.rpm
wget -P /telnet http://192.168.0.55/app/telnet-0.17-64.el7.x86_64.rpm

chmod 755 /telnet/*

cd dream
rpm -ivh telnet-server-0.17-64.el7.x86_64.rpm
rpm -ivh telnet-0.17-64.el7.x86_64.rpm

 

echo "xset s off" >> /etc/profile
echo "xset -dpms" >> /etc/profile

echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf

#Service Disable and Enable

for c in $(systemctl list-unit-files | grep enabled | /bin/awk '{print $1}')
       do systemctl disable $c
       done
#      do chkconfig --level 2345 $c off
#      done

on_service="NetworkManager autofs blk-availability crond haldaemon irqbalance jexec lvm2-monitor messagebus netfs network nfslock openct rhsmcertd rpcbind rpcgssd rsyslog sshd sysstat udev-post vsftpd xinetd telnet"
for c in $on_service
       do systemctl enable $c
       done

sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-p1p4
sed -i 's/BOOTPROTO="dhcp"/BOOTPROTO=static/g' /etc/sysconfig/network-scripts/ifcfg-p1p4

echo "IPADDR=192.168.250.1" >> /etc/sysconfig/network-scripts/ifcfg-p1p4
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-p1p4

systemctl enable gdm


 Kickstart 실행중에 계정이나 기타 기본 설정들을 스크립트로 실행되게 만들었습니다.

 

이것을 응용하여 OS 설치 후 제대로 설치가 되었는지 Check report도 만들 수 있습니다.

 

 

반응형

'LINUX' 카테고리의 다른 글

하모니카 OS 설치  (2) 2021.11.11
CentOS 라우팅 테이블(Routing Table) && 마운트(Mount)  (0) 2021.10.30
PXE Server 설치 및 구성(CentOS 6 or 7)  (0) 2021.10.05