• Rhel7的基本使用


    1、修改主机名

    [root@localhost ~]# cat /etc/hostname
    localhost.localdomain
    [root@localhost ~]# hostnamectl set-hostname server28.example.com
    [root@localhost ~]# cat /etc/hostname
    server28.example.com
    注:在Rhel7中主机名的信息存储在/etc/hostname中,而不再是/etc/sysconfig/network

    2、启动/关闭/重启/查看服务(systemctl  start/stop/restart/status  services)

    [root@localhost ~]# systemctl start firewalld     启动防火墙
    [root@localhost ~]# systemctl stop firewalld     关闭防火墙
    [root@localhost ~]# systemctl restart firewalld     重启防火墙
    [root@localhost ~]# systemctl status firewalld     查看防火墙状态

    [root@localhost ~]# systemctl list-unit-files     查看系统所有服务的状态

    3、设置服务的自启动

    [root@localhost ~]# systemctl enable sshd     设置sshd开机自动
    [root@localhost ~]# systemctl disable sshd     设置sshd不开机自启

    4、进入紧急/图形/单用户/拯救模式

    [root@localhost ~]# systemctl isolate

    emergency.targer     graphical.target     multi-user.target     rescue.target

    5、关机/重启

    [root@localhost ~]# systemctl halt     关机

    [root@localhost ~]# systemctl reboot     重启

    6、更改时区

    到/usr/share/zoneinfo/下找到对应的时区文件,例如Asia/Shanghai

    对应的拷到/etc/localtime,例如cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

    7、root用户密码忘记后,如何进入单用户更改root用户密码

      启动电脑,按上下键进入启动菜单界面,选择第二个Red Hat Enterprise Linux Server, with Linux 0-rescue-*

      

      按 'e'进入编辑模式

      

      在linux16 /vmlinuz-*这行的末尾添加“ rd.break”,然后按“Ctrl+x”进入单用户模式

      

      当进入用户模式后出现以下窗口,执行以下命令,(确认根目录不是只读挂载,具有可写权限)

      

      执行password更改root用户密码

      

      执行touch /.autorelabel

      

      按两次“Ctral+d”登录系统咯!!!!

    -------end-------

      

      

  • 相关阅读:
    Python属性、方法和类管理系列之----__slots__属性
    Python属性、方法和类管理系列之----属性初探
    解释型语言和编译型语言的不同以及Python如何运行
    Python的字符串操作和Unicode
    Python中异常(Exception)的总结
    leetcode经典动态规划题解题报告
    mybatis源码分析一
    ReentrantLock源码分析
    CopyOnWriteArrayList,CopyOnWriteArraySet源码分析
    CyclicBarrier源码分析
  • 原文地址:https://www.cnblogs.com/xautlmx/p/4002404.html
Copyright © 2020-2023  润新知