2018.11.12-2018.11.18

1、簡述linux操作系統啓動流程

POST->Boot Sequence(BIOS)-> Boot Loader(MBR) -> Kernel(ramdisk) -> rootfs -> switchroot -> /sbin/init/ -> (/etc/inittab,/etc/init/*.conf) -> 設定默認運行級別 -> 系統初始化腳本 ->關閉或啓動對應級別下的服務 - >啓動終端

2.簡述grub啓動引導程序配置及命令行接口詳解

grub的命令行接口

help獲取幫助列表help Key_Word詳細幫助信息 find (hd#,#)find (hd0,0)/vmlinuz-XXXXroot (hd#,#)設定根kernel /path/to/kernel_file設定本次啓動時用到的內核文件;額外還可以添加許多內核支持的cmdline參數initrd /path/to/initramfs_file設定爲選定的內核提供額外文件的ramdiskboot引導啓動選定的內核

 

如何識別設備

(hd#,#)

第幾塊磁盤的第幾個分區

配置文件

/boot/grub/grub.conf

 

default設定默認啓動菜單項;從0開始timeout等待用戶選擇時常splashimage背景菜單圖片xpm.gz格式路徑hiddenmenu是否隱藏菜單title定義菜單項標題 可出現多次root (hd#,#)grub查找stage2及kernel文件所在的設備分區,爲grub的根kernel指明啓動用到的內核initrd內核匹配的ramfs文件password啓用選定的內核或操作系統認證 password [--md5] STRING菜單編輯認證openssl 生成密碼串grub-md5-crypt命令

 

進入單用戶模式

1 編輯grub菜單(選定要編輯的title,而後使用e命令)

2 在選定的kernel後附加 1,s,Ssingle都可以

3 kernel所在行,鍵入b命令

3、實現kickstart文件製作與光盤鏡像製作

anaconda.cfg文件詳解

命令段

指定各種安裝前配置選項,如鍵盤類型等

必備命令可選命令

 

程序包段

指明要安裝的程序包,以及包組,也包括不安裝的程序包

%packages程序包開始符@group_name要安裝的包組-package指定不安裝程序包package要安裝的程序包%end程序包結束符

 

腳本段

%pre安裝前腳本運行環境:運行安裝介質上的微型Linux系統環境%post安裝後腳本運行環境:安裝完成的系統

 

 

命令段的必備命令

authconfig

authconfig --useshadow --enablemd5

認證方式

bootloader

bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"

 

keyboard

設置鍵盤類型

keyboard us

 

lang

語言類型

lang en_US.UTF-8lang zh_CN.UTF-8

 

part

分區佈局

part /boot --fstype=ext4 --size=300part pv.008002 --size=51200補充:分區相關的其他指令clearpart --none --drivers=sda 清空磁盤分區volgroup myvg --pesize=4096 pv.008002logvol /home --fstype=ext4 --name=lv_home --vgname=myvg --size=5120

 

rootpw

管理員密碼

rootpw  --iscrypted $1$P14XL2qo$pIV8yJLp82WuPV9tssEaB/~]#openssl passwd -1 -salt `openssl rand -hex 4`~]#grub-md5-crypt命令

 

timezone

指定時區

timezone --utc America/Los_Angeles

 

 

 

 

 

 

 

可選命令

install OR upgrade

安裝或升級

text

安裝界面類型,texttui,默認爲gui

network

配置網絡接口

network --onboot yes --device eth0 --bootproto dhcp --noipv6

 

firewall

防火牆

firewall --service=ssh 放行ssh服務firewall --disabled系統安裝完成之後禁用防火牆CentOS 6~]#service iptables stop ~]#chkconfig iptables offCentOS 7~]#systemctl stop firewalld.serivce~]#systemctl disable firewalld.service

 

selinux

安全加強的Linux

系統安裝完成之後禁用selinux~]#vim /etc/sysconfig/selinuxSELINUX=enforcing | permissive | disabled #永久有效~]#setenforce=0 #立即生效~]#getenforce

 

halt,poweroff,reboot

安裝完成以後的行爲

url

安裝時使用的repository 但是爲url格式

url --url=http://172.16.0.1/cobbler/ks_mirror/CentOS-6.7-x86_64/

 

repo

指明安裝時使用的repository

repo --name="CentOS"  --baseurl=cdrom:sr1 --cost=100

 

參考官方文檔 <installation Guide>

腳本段

定製kickstart文件

~]#yum install system-config-kickstart

~]#system-config-kickstart &

~]#ksvalidator ks.cfg#檢查語法錯誤

####使用kickstart文件安裝系統####

boot:linux ip=172.16.20.91 netmask=255.255.0.0 ks=http://172.16.0.1/centos6.x86_64.cfg

####自己創建光盤引導鏡像####

~]#wget http://172.16.0.1/centos6.x86_64.cfg

~]#mkdir myboot

~]#cp -r /media/cdrom/isolinux/ ./myboot

~]#cd /ioslinux

~]#chmod +w *

~]#vim isolinux.cfg

~]#cp /root/centos7_x86_64.cfg ks.cfg

 

~]#mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V CentOS 6 x86_64 boot -c isolinux/boot.cat -b isolinux/isolinux.bin -o /root/boot.iso myboot/

 



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