CNETOS6.4無人值守安裝

一、配置IP

vi /etc/sysconfig/network-scripts/ifcfg-eth0

wKioL1WfJsrjudj4AADI7fxvvzw533.jpg

Service network restart

二、CentOS 5/RHEL 5下搭建本地YUM源

1.掛載光盤

Mkdir /mnt/cdrom

Mount /dev/cdrom /mnt/cdrom

2.將安裝盤裏面的文件全部COPY

Mkdir /var/www/html/cdrom

\cp r /mnt/cdrom/* /var/www/html/cdrom

3.進入YUM的配置文件目錄

Cd /etc/yum.repos.d

mv CentOS-Base.repoCentOS-Base.repo.bak

viCentOS-Media.repo

 

 

# CentOS-Media.repo

#

#  This repo can beused with mounted DVD media, verify the mount poi

nt for

#  CentOS-6.  You can use this repo and yum to installitems directly

 off the

#  DVD ISO that werelease.

#

# To use this repo, put in your DVD and use it with theother repos t

oo:

#  yum--enablerepo=c6-media [command]

#

# or for ONLY the media repo, do this:

#

#  yum--disablerepo=\* --enablerepo=c6-media [command]

 

[c6-media]

name=CentOS-$releasever - Media

baseurl=file:///var/www/html/cdrom

       file:///media/CentOS/

       file:///media/cdrom/

       file:///media/cdrecorder/

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

 

測試yum是否配置成功

yum list

 

清除yum緩存

Yum clean all

 

重新建立緩存

yum makecache

 

 

大概在配置文件的第15行,會看到如下內容:

[c5-media]

name=CentOS-$releasever- Media 下載源名

baseurl=file:///media/CentOS/下載源路徑

file:///media/cdrom/

file:///media/cdrecorder/

gpgcheck=1 安裝此下載源中的軟件包時是否檢查RPM軟件包的數字簽名

enabled=0 是否啓用此下載源,0爲禁止、1爲啓用。

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

~

~

把上面的內容修改成如下:

[c5-media]

name=localyum

baseurl=file:///var/www/html/cdrom 2步中用以存放光盤內容的本地源目錄

#gpgcheck=0

#enabled=1

#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

 

最後保存退出!!!!!

 

yum clean all (清除緩存)

yum make cache (建立新緩存)

 

Yum y install httpd

Yum y install dhcp

Yum y install tftp-server

yum –y groupinstall "X Window System"

yum –y groupinstallDesktop

yum –y install system-config-kickstart

 

 

所有包都安裝完畢

現在配置服務

 

三、配置TFTP服務器

vi/etc/xinetd.d/tftp

 

# default: off

# description: The tftp server serves files usingthe trivial file tr

ansfer \

#      protocol.  The tftp protocol isoften used to boot diskless \

#      workstations, download configuration files to network-aware p

rinters, \

#       andto start the installation process for some operating syst

ems.

service tftp

{

       socket_type             = dgram

       protocol                = udp

        wait                    = no

       user                    = root

       server                  =/usr/sbin/in.tftpd

       server_args             = -s/var/lib/tftpboot

        disable                 = no

       per_source              = 11

       cps                     = 100 2

       flags                   = IPv4

}

disable 設置爲no

 

重啓服務

service xinetd restart /etc/init.d/xinetd restart

 

四、配置支持PXE的啓動程序

 

1 複製pxelinux.0 文件至/var/lib/tftpboot/文件夾中

# cp /usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

說明:syslinux是一個功能強大的引導加載程序,而且兼容各種介質。更加確切地說:SYSLINUX是一個小型的Linux操作系統,

它的目的是簡化首次安裝Linux的時間,並建立修護或其它特殊用途的啓動盤。

2 複製iso 鏡像中的/p_w_picpath/pxeboot/initrd.imgvmlinux /var/lib/tftpboot/文件夾中

# cp /var/www/html/cdrom/p_w_picpaths/pxeboot/{initrd.img,vmlinuz}/var/lib/tftpboot/

3 複製iso 鏡像中的/isolinux/*.msg/var/lib/tftpboot/文件夾中

# cp /var/www/html/cdrom/isolinux/*.msg/var/lib/tftpboot/

4 /var/lib/tftpboot/中新建一個pxelinux.cfg目錄

# mkdir /var/lib/tftpboot/pxelinux.cfg

5 iso 鏡像中的/isolinux 目錄中的isolinux.cfg複製到pxelinux.cfg目錄中,同時更改文件名稱爲default

# cp/var/www/html/cdrom/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

6 修改default文件

# vi/var/lib/tftpboot/pxelinux.cfg/default

 

default ks

prompt 1

timeout 6

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

  kernel vmlinuz

  append initrd=initrd.img

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  appendks=http://192.168.1.254/ks.cfg initrd=initrd.img

label local

  localboot 1

label memtest86

  kernel memtest

  append -

 

五、配置DHCP

1複製配置模板文件到DHCP的配置目錄中

# cp -f/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

2修改/etc/dhcp/dhcpd.conf 配置文件,內容如下:

ddns-update-styleinterim;

ignoreclient-updates;

filename"pxelinux.0";

next-server192.168.1.254;

subnet 192.168.1.0netmask 255.255.255.0 {

        option routers                  192.168.1.254;

        option subnet-mask              255.255.255.0;

        range dynamic-bootp 192.168.1.100192.168.1.200;

        default-lease-time 21600;

        max-lease-time 43200;

}

3啓動DHCP服務

# /etc/init.d/dhcpd start

 

六、生成ks.cfg

進入xwindows

system-config-kickstart

 

wKioL1WfJvjRI0xDAAHTQeQsKUc958.jpg

wKiom1WfJSbRdtNeAAEtCDFZ7aY432.jpg

wKioL1WfJviic4vVAAGdv5g9bJY377.jpg

wKiom1WfJSbzXq3qAAFNPYfsvSo353.jpg

wKioL1WfJvmQo3ufAADwBRbB2nk890.jpg

wKiom1WfJSfyjoCLAAHk368xsOg090.jpg


將ks.cfg保存到/var/www/html/目錄下

 

 

 

測試

wKiom1WfJTew6_McAADsqqdnvPo051.jpg

關閉iptablesF

 

Vi /etc/syslinux/config

# This filecontrols the state of SELinux on the system.

# SELINUX= cantake one of these three values:

#     enforcing - SELinux security policy isenforced.

#     permissive - SELinux prints warningsinstead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= cantake one of these two values:

#     targeted - Targeted processes areprotected,

#     mls - Multi Level Security protection.

SELINUXTYPE=disabled

 

重啓REBOOT


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章