第十二周

1、简述linux操作系统启动流程

  1. 加载BIOS的硬件信息,获取第一个启动设备
  2. 读取第一个启动设备MBR的引导加载程序(grub)的启动信息
  3. 加载核心操作系统的核心信息,核心开始解压缩,并尝试驱动所有的硬件设备
  4. 核心执行init程序,并获取默认的运行信息
  5. init程序执行/etc/rc.d/rc.sysinit文件,重新挂载根文件系统
  6. 启动核心的外挂模块
  7. init执行运行的各个批处理文件(scripts)
  8. init执行/etc/rc.d/rc.local
  9. 执行/bin/login程序,等待用户登录
  10. 登录之后开始以Shell控制主机

2、制作一个只运行shell的linux系统

3、总结systemctl管理命令及system unit文件格式

systemctl管理命令

启动:systemctl start name.service

停止:systemctl stop name.service

重启:systemctl restart name.service

查看状态:systemctl status name.service

禁止自动和手动启动:systemctl mask name.service

取消禁止 systemctl unmask name.service

查看某服务当前激活与否的状态:systemctl is-active name.service

查看所有已经激活的服务:systemctl list-units --type|-t service

查看所有服务:systemctl list-units --type service --all|-a

设定某服务开机自启,systemctl enable name.service

设定某服务开机禁止启动:systemctl disable name.service

查看所有服务的开机自启状态 :systemctl list-unit-files --type service

查看服务是否开机自启:systemctl is-enabled name.service

列出失败的服务:systemctl --failed --type=service

开机并立即启动或停止 :systemctl enable --now postfix ,systemctl disable --now postfix

查看服务的依赖关系: systemctl list-dependencies name.service

杀掉进程:systemctl kill unitname

unit文件格式

  • service unit: 文件扩展名为.service, 用于定义系统服务
  • Socket unit: .socket, 定义进程间通信用的socket文件,也可在系统启动时,延迟启动服务,实现按需启动
  • Target unit: 文件扩展名为.target,用于模拟实现运行级别
  • Device unit: .device, 用于定义内核识别的设备
  • Mount unit: .mount, 定义文件系统挂载点
  • Snapshot unit: .snapshot, 管理系统快照
  • Swap unit: .swap, 用于标识swap设备
  • Automount unit: .automount,文件系统的自动挂载点
  • Path unit: .path,用于定义文件系统中的一个文件或目录使用,常用于当文件系统变化时,延迟激活服务,如:sp

4、破解centos7 密码

  1. 重启 blue 系统,按 e 键打断启动过程
  2. 修改 linux 行(ro 改 rw,末尾添加 rd.break)然后按 ctrl+x 启动
  3. switch_root:/# chroot /sysroot/ //切换到根系统
  4. sh-4.2# echo redhat | passwd --stdin root //修改 root 口令为指定的字串
  5. sh-4.2# touch /.autorelabel //标记下一次启动重做 SELinux 标记
  6. sh-4.2# exit //退出恢复模式
  7. switch_root:/# reboot //重启系统
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、配置chrony服务,实现服务器时间自动同步 主机环境: 两台Centos-7主机 服务器:192.168.1...
    小罗很忙阅读 76评论 0 0
  • 1、配置chrony服务,实现服务器时间自动同步 (1)、准备工作: 服务器端: 192.168.17.142 系...
    Gustav_man阅读 143评论 0 0
  • 一、配置chrony服务,实现服务器时间自动同步 1.准备工作 2.安装和启动 3.修改配置文件(192.168....
    刘关心阅读 168评论 0 0
  • ▲就业班和全程班的小伙伴看这里:(学习老王视频的作业第23-24节) 1、配置chrony服务,实现服务器时间自动...
    一心1977阅读 193评论 0 0
  • 1、搭建vsftpd,并实现虚拟用户 我们登录FTP有三种方式,匿名登录、本地用户登录和虚拟用户登录。 匿名登录:...
    xinxin2019阅读 245评论 0 0