Linux系统的启动原理

Linux系统的启动原理

RHEL的启动原理
BIOS自检-MBR-启动GRUB-加载内核-systemd的init进程

systemd的初始化进程
加载需要的服务,挂载文件系统/etc/fstab
systemd是linux内核启动的第一个进程,取代了init

systemd 的优点:
启动速度快,提供系统服务的快照,服务自动实时更新

pstree 命令可以查看第一个启动的进程,pid是1
---------------
init 与systemd的比较
init0 systemctl poweroff 关机
init1 systemctl isolate rescue.target 单用户模式
init3 systemctl isolate multi-user.target 多用户模式,字符界面
init5 systemctl isolate.graphical.target 图形化界面
init6 systemctl reboot 重启系统

vim /etc/inittab 系统运行级别说明文件
查看当前默认的运行级别
systemctl get-default
设置默认的运行
systemctl set-default

调用字符界面
systemctl isolate multi-user.target
调用字符界面并设置为默认运行级别
systemctl set-default multi-user.target

切换运行级别
systemctl isolate multi-user.target

grub的引导设置
vim /etc/default/grub
使用grub2-mkconfig 让修改生效
查看grub的配置文件
vim /boot/grub2/grub.cfg

覆盖执行
grub2-mkconfig -o /boot/grub2/grub.cfg

systemd 的主要命令是systemctl
systemctl start 服务名称 启动一个服务
systemctl restart 服务名称 重启一个服务
systemctl stop 服务名称 停止一个服务
systemctl status 服务名称 查看一个服务的状态
systemctl enable 服务名称 设置一个服务开机自动启动
systemctl disable 服务名称 设置一个服务开机自动关闭


init5 切换到图形化界面
-----------------------------
查看atd服务的状态、
systemctl status atd

安装Apache软件包
yum -y install httpd
systemctl enable httpd
ststemctl disable httpd
------------------
查看系统中的服务那些是开机自启动的
systemctl list-unit-files --type service
查看系统中服务占用资源的状态
systemd-cgtop

转载于:https://www.cnblogs.com/GaoNa/p/11135346.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值