2019/01/27

ubuntu pxe boot install

1. 유틸 설치
apt-get install isc-dhcp-server tftpd-hpa syslinux ntf-kernel-server initramfs-tools

2. dhcp 원격 서버 설정
cat /etc/dhcp/dhcpd.conf
# DHCP server is authoritative for all networks
authoritative;

# extra options
# RFC3442 routes
option rfc3442-classless-static-routes code 121 = array of integer 8;

# MS routes
option ms-classless-static-routes code 249 = array of integer 8;

pid-file-name "/var/run/dhcp-server/dhcpd.pid";

ddns-update-style none;

option domain-name-servers 127.0.0.1;

allow booting;
allow bootp;

default-lease-time 1800;
max-lease-time 7200;
        shared-network eth1 {
    subnet 10.10.10.0 netmask 255.255.255.0 {
            option routers 10.10.10.1;
            option domain-name "nemo.lan";
            option domain-name-servers 10.10.10.1;
                option ntp-servers 10.10.10.1;
                default-lease-time 1800;
                max-lease-time 7200;
            pool {
                   next-server 10.10.10.1;
                   option tftp-server-name "10.10.10.1";
                   filename    "/netboot_setup/pxelinux.0";
                range 10.10.10.2 10.1apt-get install -y samba genisoimage wimtools cabextract0.10.254;
            }
        }
        group {
            option routers 10.10.10.1;
            option domain-name "nemo.lan";
            option domain-name-servers 10.10.10.1;
                option ntp-servers 10.10.10.1;
                default-lease-time 1800;
                max-lease-time 7200;
        }
}

3. tftpd 설정
vi /etc/init/tftpd-hpa.conf
# tftp-hpa - trivial ftp server

description    "tftp-hpa server"
author        "Chuck Short <zulcss@ubuntu.com>"

start on runlevel [2345]
stop on runlevel [!2345]

console output
expect fork
respawn

env PIDFILE="/var/run/tftpd-hpa.pid"
env DEFAULTS="/etc/default/tftpd-hpa"

script

    if [ -f ${DEFAULTS} ]; then
        . ${DEFAULTS}
    fi

    if [ ! -d "${TFTP_DIRECTORY}" ]; then
        echo "${TFTP_DIRECTORY} missing, aborting."
        exit 1
    fi

    exec /usr/sbin/in.tftpd --listen  --user ${TFTP_USERNAME} --address ${TFTP_ADDRESS} ${TFTP_OPTIONS} ${TFTP_DIRECTORY}
end script
root@ss:/var/

vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

4. 웹 서버 및 inetd 설정
apt-get install apache2 inetutils-inetd

cat /etc/inetd.conf
# /etc/inetd.conf:  see inetd(8) for further informations.
#
# Internet superserver configuration database
#
#
# Lines starting with "#:LABEL:" or "#<off>#" should not
# be changed unless you know what you are doing!
#
# If you want to disable an entry so it isn't touched during
# package updates just comment it out with a single '#' character.
#
# Packages should modify this file by using update-inetd(8)
#
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
#
#:INTERNAL: Internal services
#discard        stream    tcp    nowait    root    internal
#discard        dgram    udp    wait    root    internal
#daytime        stream    tcp    nowait    root    internal
#time        stream    tcp    nowait    root    internal

#:STANDARD: These are standard services.

#:BSD: Shell, login, exec and talk are BSD protocols.

#:MAIL: Mail, news and uucp services.
#<off># smtp    stream    tcp    nowait    root    /usr/sbin/sendmail sendmail -Am -bs
#<off># submission    stream    tcp    nowait    root    /usr/sbin/sendmail sendmail -Am -bs
#<off># smtps    stream    tcp    nowait    root    /usr/sbin/sendmail sendmail -Am -bs

#:INFO: Info services

#:BOOT: TFTP service is provided primarily for booting.  Most sites
#       run this only on machines acting as "boot servers."

#:RPC: RPC based services

#:HAM-RADIO: amateur-radio services

#:OTHER: Other services
#<off># sane-port    stream    tcp    nowait    saned:saned    /usr/sbin/saned saned

#kerberos-adm    stream    tcp    nowait    root    /usr/sbin/tcpd /usr/lib/heimdal-servers/kadmind
#krb_prop    stream    tcp    nowait    root    /usr/sbin/tcpd /usr/sbin/hpropd
9571           stream  tcp     nowait  nobody /usr/sbin/tcpd /usr/sbin/ldminfod

5. 우분투 서버 iso 파일 다운로드 후 마운트
mount -o loop iso_download_file /mnt
cp -a /mnt/install/netboot/* /var/lib/tftpboot/
mkdir /var/www/html/ubuntu
cp -a /mnt/* /var/www/html/ubuntu/

vi /var/lib/tftpboot/pxelinux.cfg/default
label linux
 kernel ubuntu-installer/amd64/linux
 append ks=http://172.16.1.97/ks.cfg vga=normal initrd=ubuntu-installer/amd64/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw --

06 서비스 재 시작
/etc/init.d/apache2 restart
/etc/init.d/tftpd-hpa restart
/etc/init.d/isc-dhcp-server restart

댓글 없음:

댓글 쓰기