kickstart一鍵自動安裝Linux系統

來源:互聯網
上載者:User

kickstart,無人值守,自動安裝系統。本文介紹kickstart的用法。

 

#安裝系統的資訊——可以參考[root@larrywen pdf]# vim ~/anaconda-ks.cfg

第一步 安裝kickstart

[root@larrywen /]#yum installsystem-config-kickstart -y#退出,再以X Window的形式登入[root@serv01 opt]# exitlogoutConnection to 192.168.1.11 closed.[root@larrywen Desktop]# ssh 192.168.1.11-X[root@larrywen Desktop]#system-config-kickstart

第二步 產生ks.cfg檔案

 

第一項,基本配置。預設語言選擇English(USA),鍵盤選擇U.S.English,時區選擇Africa/Chongqing,虛擬機器下不建議勾選"Use UTC clock",設定root密碼,如果我們不選擇加密root密碼,產生的檔案中密碼就以明文顯示,進階配置中把目標架構選擇x86,
AMD64, or Intel EM64T,然後把"Rebootsystem after installation"。



第二項,安裝方法。安裝方法選擇“Perfome new installation(新安裝)",安裝源選擇NFS,NFS 伺服器:192.168.1.11,NFS 目錄:/iso      

 


第三項,Boot Loader 選項。安裝類型選擇:安裝新的boot loader,GRUB 忽略不寫,這個是啟動GRUB時使用的密碼,如果沒設定GRUB密碼,進入單一使用者模式是可以的,但是設定了GRUB密碼後,進入單一使用者模式必須輸入GRUB密碼。安裝選項把"Install boot loader
on Master Boot Record(MBR)"勾選該上,核心參數忽略。

 


第四項,Partition Information(分區資訊)。Master Boot Record:Clear Master Boot Record(清除MBR)。Partitions:Remove allexisting partitions(移除所有存在的分區)。Disk label:Do
not initialize the disk lable(不初始化卷標)。布局:測試用:我這樣分區:/boot(200M) swap(1024M) /(其他的空間分配給根分區)。

         
      


第五項,Network Configuration(網路設定)。我們配置一個eth0,自動擷取IP。      



第六項,Authentication(驗證)。保持預設即可。



第七項,Firewall Configuration(防火牆配置)。我們啟用SELinux,啟用防火牆,信任的服務把SSH勾選上。



第八項,Display Configuration(顯示配置)。在圖形化環境安裝後,我們第一次啟動時把配置的圖形化介面禁用掉。



第九項,Package Selection(包的選擇)。在語言套件中把“Chinese Support(中文支援”勾選上。



第十項,Pre-Installation Script(安裝前指令碼)。這是在安裝前執行的指令碼,此處忽略。



第十一項,Post-Installation(安裝後指令碼)。這是安裝後執行的指令碼,此處我們添加兩條命令,以做測試。



useradd oracle;echo "testoracle" | passwd--stdin oracle;

#查看配置的檔案[root@serv01 opt]# cat ks.cfg#platform=x86, AMD64, or Intel EM64T##version=DEVEL## Firewall configuration#firewall --enabled --ssh## Install OS instead of upgrade#install## Use NFS installation media#nfs --server=192.168.1.11 --dir=/iso## Root password#rootpw --plaintext uplooking## System authorization information#auth --useshadow  --passalgo=sha512## Use graphical install#graphical#firstboot --disable## System keyboard#keyboard us## System language#lang en_US## SELinux configuration#selinux --enforcing## Installation logging level#logging --level=info## Reboot after installation#reboot## System timezone#timezone Asia/Chongqing## Network information#network --bootproto=dhcp --device=eth0 --onboot=on## System bootloader configuration#bootloader --location=mbr## Clear the Master Boot Record#zerombr## Partition clearing information#clearpart --all ## Disk partitioning information#part /boot --fstype="ext4"--size=200#part swap --fstype="swap"--size=1024#part / --fstype="ext4" --grow--size=1##%post#useradd oracle;#echo "uplooking" | passwd--stdin oracle;#%end##%packages#@chinese-support##%end#

第三步 配置nfs

[root@serv01 opt]# vim /etc/exports[root@serv01 opt]# cat /etc/exports/iso *(ro)/opt *(ro) #安裝nfs相關的RPM包[root@serv01 opt]# yum install nfs* -y Installed: nfs-utils.x86_64 1:1.2.3-7.el6          nfs-utils-lib.x86_64 0:1.1.5-3.el6           nfs4-acl-tools.x86_64 0:0.3.3-5.el6         Complete!#啟動rpcbind服務[root@serv01 opt]# /etc/init.d/rpcbindstartStarting rpcbind:                                         [  OK  ]#啟動nfs服務[root@serv01 opt]# /etc/init.d/nfs startStarting NFS services:                                     [  OK  ]Starting NFS daemon:                                       [  OK  ]Starting NFS mountd:                                       [  OK  ]Starting RPC idmapd:                                       [  OK  ] #以上兩步可以通過service nfsstart解決

第四步 關閉防火牆和SELINUX

[root@serv01 opt]# /etc/init.d/iptablesstop[root@serv01 opt]# setenforce 0

第五步 建立虛擬機器

選擇安裝鏡像作為引導,然後按ESC鍵,輸入linux ks=nfs:192.168.1.11:/opt/ks.cfg:等待自動安裝系統吧。


5.1鏡像選擇

 


5.2DHCP配置

 


5.3Linux kickstart安裝介面

 

5.4測試oracle使用者安裝成功

 

注意

1.Vmware中所使用網卡需要選擇DHCP,因為我們通過kickstart安裝的系統使用的是DHCP。

2.我們需要在配置虛擬機器時需要選擇ISO鏡像作為引導,然後進入安裝介面後按ESC,輸入nfs相關的命令進行安裝。

3.儲存後的設定檔不要儲存到root目錄下,因為是以普通使用者讀取的。

4.如果出現錯誤,要麼是拼字錯誤,要麼是NFS服務未正確配置或者沒啟動,要麼是防火牆沒關,要麼是網路不通。

  我的郵箱:wgbno27@163.com  新浪微博:@Wentasy27           公眾平台:JustOracle(號:justoracle)  資料庫技術交流群:336882565(加群時驗證 From CSDN XXX)  Oracle交流討論群組:https://groups.google.com/d/forum/justoracle  By Larry Wen
 
@Wentasy 博文僅供參考,歡迎大家來訪。如有錯誤之處,希望批評指正。原創博文如需轉載請註明出處,謝謝 [CSDN部落格]
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.