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

2018.11.12-2018.11.18_Linux启动流程anaconda 

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

2018.11.12-2018.11.18_Linux启动流程anaconda_02 

~]#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/

2018.11.12-2018.11.18_kickstart制作_03