Cobbler를 활용한 CentOS 6 및 CentOS 7 배포 구성

자동화 도구 분류

  • 시스템 준비(Os Provisioning)
    PXE
    Cobbler
  • 환경 관리(Os Config & DevOps)
    Chef
    Ansible
    SaltStack
    Puppet
  • 모니터링(Mointor)
    Zabbix
    Prometheus
    Nagios

Cobbler 개요

Cobbler는 Python 기반 운영체제 자동 배포 도구로 PXE를 확장한 솔루션입니다. CLI와 웹 인터페이스를 제공하며 물리 서버와 KVM/Xen 가상 환경을 지원합니다.

주요 구성 요소

  • 배포판(Distro): 커널, initrd 정보 포함
  • 저장소(Repository): Yum 미러 정보
  • 프로필(Profile): Distro, 킥스타트 파일 조합
  • 시스템(System): 배포 대상 머신 설정

작동 흐름

  1. 클라이언트 DHCP에서 IP 획득
  2. next_server에서 커널/initrd 로드
  3. TFTP를 통한 PXE 부팅
  4. Kickstart 파일 기반 설치 수행

설치 및 설정

필수 패키지 설치

# EPEL 저장소 추가
yum install -y epel-release

# 패키지 설치
yum install -y cobbler dhcp httpd xinetd tftp-server syslinux pykickstart rsync

네트워크 설정

# IP 포워딩 활성화
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

기본 설정 검증

systemctl start httpd cobblerd
cobbler check

설정 파일 수정

# /etc/cobbler/settings 수정
next_server: 192.168.1.100
server: 192.168.1.100
manage_dhcp: 1

# 암호 생성
openssl passwd -1 -salt 'secure_salt' 'your_password'

DHCP 템플릿 설정

# /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers             192.168.1.1;
    option domain-name-servers  8.8.8.8;
    range dynamic-bootp        192.168.1.50 192.168.1.150;
    next-server                $next_server;
}

서비스 활성화

systemctl enable httpd cobblerd xinetd
systemctl restart cobblerd
cobbler sync

운영체제 이미지 가져오기

# CentOS 6 마운트 및 가져오기
mount /dev/cdrom /mnt
cobbler import --path=/mnt/ --name=CentOS6-Final --arch=x86_64

# CentOS 7 마운트 및 가져오기
umount /mnt
mount /dev/cdrom /mnt
cobbler import --path=/mnt/ --name=CentOS7-Latest --arch=x86_64

# 배포판 확인
cobbler distro list

킥스타트 설정

CentOS 6 킥스타트 예제

# /var/lib/cobbler/kickstarts/CentOS6-Final.ks
install
url --url=$tree
lang en_US
keyboard us
bootloader --location=mbr
timezone Asia/Seoul
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype ext4 --size 500
part swap --size 2048
part / --fstype ext4 --size 20480
part /data --fstype ext4 --grow --size 1
firewall --disabled
selinux --disabled
reboot
%packages
@base
@core
%end

CentOS 7 네트워크 인터페이스 설정

cobbler profile edit --name=CentOS7-Latest \
--kopts='net.ifnames=0 biosdevname=0'

시스템별 설정

# MAC 주소 기반 고정 IP 설정
cobbler system add --name=web-server01 \
--mac=00:50:56:8A:1B:2C \
--profile=CentOS7-Latest \
--ip-address=192.168.1.101 \
--subnet=255.255.255.0 \
--gateway=192.168.1.1 \
--hostname=websrv01.example.com

# 설정 동기화
cobbler sync

웹 인터페이스 설정

# /etc/cobbler/modules.conf 수정
[authentication]
module = authn_pam

[admins]
admin = "cobbler_admin"

# 시스템 사용자 추가
useradd cobbler_admin
passwd cobbler_admin

# 서비스 재시작
systemctl restart cobblerd httpd

태그: Cobbler CentOS Kickstart PXE 자동화배포

6월 2일 22:12에 게시됨