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,S或single都可以 3 在kernel所在行,鍵入b命令 |
3、實現kickstart檔案製作與光碟映象製作
l 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 |
安裝介面型別,text為tui,預設為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> |
|
指令碼段 |
l 定製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/
|