CentOS 7.1全自動安裝光碟片製作詳解

來源:互聯網
上載者:User

標籤:linux 自動化安裝 kickstart 光碟片自動化

        安裝系統的話,常用方式就是通過隨身碟,光碟片,kickstart網路自動化安裝,網路自動化安裝固然好,但是有時候在現場做項目的話根本就沒有kickstart環境,甚至連基本的網路建設都沒有弄好,此時該如何安裝系統呢,通過u盤或者光碟片,手動安裝的話需要很多選項要自己填寫,那麼我們能不能把自動化的ks環境做到系統鏡像裡面去呢,答案是很定的,接下來我們就來介紹CentOS 7.1全自動安裝光碟片製作


第一步我們掛載原始光碟片鏡像,假如掛載點是/mnt/cdrom,然後做如下操作


cp -ar /mnt/cdrom/* /tmp/martin/

cp -ar /mnt/cdrom/.treeinfo /tmp/martin/

cp -ar /mnt/cdrom/.discinfo /tmp/martin/

createrepo -g/tmp/martin/repodata/*-comps.xml /tmp/martin/


[[email protected] isolinux]# pwd

/tmp/martin/isolinux

[[email protected] isolinux]# ls

boot.cat grub.conf   isolinux.bin  ks_a.cfg ks_raid_ab.cfg memtest     TRANS.TBL    vesamenu.c32

boot.msg initrd.img  isolinux.cfg  ks_b.cfg ks_raid_bc.cfg  splash.png  upgrade.img vmlinuz


在該目錄下面建立四個ks檔案,其實只要一個即可,這裡做成四個是為了硬碟不同的資料分割配置而做的,

這裡我們只介紹一個ks_raid_ab.cfg的配置,其實就是一份定義了軟raid的分區

# platform=x86, AMD64, or Intel EM64T


# Use text mode install

#text

# Use graphical install

graphical


# Install OS instead of upgrade

install


# Use CDROM media

cdrom


# Use NFS installation media

#nfs --server=172.16.15.10 --dir=/centosinstall


# Use HTTP installation media


#url --url ftp://172.16.15.10/Public/iso/7.1-x64/


# Use FTP installation media

#url --url ftp://<username>:<password>@<server>/<dir>

#url --url ftp://172.16.15.10/


# System language

lang en_US.UTF-8

# System keyboard

keyboard us


# Network information


network --bootproto=dhcp  --hostname martin --onboot=on


#Root password

rootpw  123456


#firewall --enabled --ssh  

firewall --disable  


# System authorization information

authconfig --useshadow  --enablemd5 


# SELinux configuration

selinux --disabled


# System timezone

timezone Asia/Shanghai


# System bootloader configuration

bootloader --location=mbr


# Partition clearing information

#clearpart --all --initlabel --drives=sda

#part /boot --fstype="ext4" --size=300 --ondisk=sda

#part pv.01 --size=4096 --grow --ondisk=sda

#volgroup VolGroup00 --pesize=32768 pv.01

#logvol / --fstype="ext4" --name=LogVol00 --vgname=VolGroup00  --size=1024 --grow  

#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512


# Partition clearing information

clearpart --all --initlabel 

# Soft RAID1 partitioning information

part swap --fstype="swap" --ondisk=sda --size=4096

part raid.01 --fstype="raid" --grow --ondisk=sda --size=1

part swap --fstype="swap" --ondisk=sdb --size=4096

part raid.02 --fstype="raid" --grow --ondisk=sdb --size=1

raid / --device=md0 --fstype="ext4" --level=1 raid.01 raid.02




# Reboot after installation

reboot


# Do not configure the X Window System; if to configure it, uncomment following line

skipx

# X Window System configuration information

#xconfig  --defaultdesktop=GNOME --depth=32 --resolution=1024x768



%packages

@ additional-devel

@ base

@ core

@ debugging

@ gnome-desktop

@ development

@ mariadb

@ emacs

@ web-server

@ network-file-system-client

@ java-platform

@ platform-devel

@ php


expect

iptraf-ng

libaio-devel

libpcap-devel

lksctp-tools

lrzsz

nasm

net-snmp-utils

php-mysql

php-pear

php-soap

system-config-kickstart


# Add these system perfomance enhanced tools

vsftpd

logwatch

postfix

nmap-ncat

nmap

ftp

telnet

lsscsi

# Update the sysstat version from 9.0.4 to 10.1.6

sysstat

%end


[[email protected] isolinux]# vim isolinux.cfg  修改該檔案,增加如下內容

label ks_a

 menu label ^Custom ks_a CentOS 7 --This is sinlgle_a

 kernel vmlinuz

 append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_a.cfg


label ks_b

 menu label ^Custom ks_b CentOS 7 --This is sinlgle_b

 kernel vmlinuz

 append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_b.cfg



label ks_ab

 menu label ^Custom ks_ab CentOS 7 --This is raid_ab

 kernel vmlinuz

 append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_raid_ab.cfg


label ks_bc

 menu label ^Custom ks_bc CentOS 7 --This is raid_bc

 kernel vmlinuz

 append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_raid_bc.cfg


此時我們將該目錄/tmp/martin/   重建鏡像即可,centos7.1原始鏡像有7個多G,我們可以對其做裁剪,方法我們下次介紹




本文出自 “martin” 部落格,謝絕轉載!

CentOS 7.1全自動安裝光碟片製作詳解

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.