• 系统的初始化


    5. 关闭系统及重启系统(详见linux系统管理P342)
    1) 掌握常用的可以关闭系统的命令:
    shutdown -h now 
    halt
    poweroff
    init 0


    2) 掌握常用的可以重启系统的命令:
    shutdown -r now
    reboot
    init 6
    Ctrl+Alt+Delete键


    6. 掌握单用户模式修改用户的密码

    #进单用户模式
    按任意键----e---->选择第二行 kernel ---->按e, 再按空格 >输入1----再输入b

    #查看运行级别
    runlevel 
    1 $

    #修改密码
    passwd root

    #再重新启动

    reboot


    7. 掌握救援模式

    1、插入光驱ISO
    2、开机快速按F2---设光驱启动
    3、重启服务器

    4、用户光盘启动系统,并选择rescue installed system

    5、启动后会让设置一些列相关设置:

    语言设置:

    键盘设置:

     

    是否启用网卡,可以启用,我选不启用:

    一说说明,点continue:

    提示将要将之前的系统挂载到/mnt/sysimage,点ok进行下一步:

    已经将之前的系统挂 载到/mnt/sysimage,点ok:

    选择shell start shell,点ok即可进入到linux救援模式:

     

    修改grub.conf,将之前的grub保护密码删除或注销

     

    重启系统使用单用户模式重新设置root密码:

    再此仍然可以将密码重新设置。

    8. 课后作业(用时70分钟)
    1) 以root用户登录系统


    2) 修改grub配置文件,默认以第1个操作系统启动,将默认的读秒修改为10秒

    [root@study ~]# vi /etc/grub.conf

    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You have a /boot partition. This means that
    # all kernel and initrd paths are relative to /boot/, eg.
    # root (hd0,0)
    # kernel /vmlinuz-version ro root=/dev/sda3
    # initrd /initrd-[generic-]version.img
    #boot=/dev/sda
    default=0
    timeout=10
    splashimage=(hd0,0)/grub/splash.xpm.gz
    #boot=/dev/sda
    default=0
    timeout=5 #系统进入系统的时间
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    password --encrypted $6$bwpMzA6qyot6Fem4$F1bD/iZa2rHHQKnnicET4kTKvYbSYZLBdu4gG1N6oHJtLPgxbJsACtPR3wqetr.4zBDRfPKESWGFgv8sNsf5i1
    title CentOS 6 (2.6.32-504.el6.x86_64)
    root (hd0,0)

    "/etc/grub.conf" 18L, 930C written

    3) 设置grub菜单密文密码“123”

    [root@study ~]# grub-md5-crypt
    Password: 
    Retype password: 
    $1$D/gW2/$aFrbVkK8itwGxpg3UEqwg1

    [root@study ~]# vi /etc/grub.conf

    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You have a /boot partition. This means that
    # all kernel and initrd paths are relative to /boot/, eg.
    # root (hd0,0)
    # kernel /vmlinuz-version ro root=/dev/sda3
    # initrd /initrd-[generic-]version.img
    #boot=/dev/sda
    default=0
    timeout=5 #系统进入系统的时间
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    password --$1$D/gW2/$aFrbVkK8itwGxpg3UEqwg1    #设置密码
    password --encrypted $6$bwpMzA6qyot6Fem4$F1bD/iZa2rHHQKnnicET4kTKvYbSYZLBdu4gG1N6oHJtLPgxbJsACtPR3wqetr.4zBDRfPKESWGFgv8sNsf5i1
    title CentOS 6 (2.6.32-504.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=db12d77f-2b16-4a49-b848-3200e873fecd rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-504.el6.x86_64.img

    4) 修改系统的默认运行级别为3

    [root@study ~]# vi /etc/inittab

     # inittab is only used by upstart for the default runlevel.

    #
    # ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
    #
    # System initialization is started by /etc/init/rcS.conf
    #
    # Individual runlevels are started by /etc/init/rc.conf
    #
    # Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
    #
    # Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
    # with configuration in /etc/sysconfig/init.
    #
    # For information on how to write upstart event handlers, or how
    # upstart works, see init(5), init(8), and initctl(8).
    #
    # Default runlevel. The runlevels used are:
    # 0 - halt (Do NOT set initdefault to this)
    # 1 - Single user mode
    # 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
    # 3 - Full multiuser mode
    # 4 - unused
    # 5 - X11
    # 6 - reboot (Do NOT set initdefault to this)
    #
    id:3:initdefault:   #红色部分修改成:3
    ~


    5) 使用与运行级别有关的命令重启系统

    reboot or init 6 


    6) 使用单用户模式修改用户的密码为“123”


    7) 使用救援模式删除grub菜单密码 

  • 相关阅读:
    Python中Linux开发的常识
    Python GUI编程(Tkinter)
    linux文本编辑器教学
    WordCloud安装
    怎么安装wordcloud
    java内功 ---- jvm虚拟机原理总结,侧重于GC
    spring源码分析(二)Aop
    spring源码分析(一)IoC、DI
    java内部类技术提炼
    java自定义注解实现前后台参数校验
  • 原文地址:https://www.cnblogs.com/shizhengwen/p/6066350.html
Copyright © 2020-2023  润新知