zoukankan      html  css  js  c++  java
  • Centos 7修改防火墙、时间与网络时间同步、解压zip包、修改系统时间

    一、防火墙的开启、关闭、禁用命令

    (1)设置开机启用防火墙:systemctl enable firewalld.service  使用此命令需要重启后才会生效。

    (2)设置开机禁用防火墙:systemctl disable firewalld.service  使用此命令需要重启后才会生效。

    (3)启动防火墙:systemctl start firewalld

    (4)关闭防火墙:systemctl stop firewalld

    (5)检查防火墙状态:systemctl status firewalld 

    二.时间与网络时间同步

    (1)安装ntpdate工具

    [root@slave1 ~]#  yum -y install ntp ntpdate

    安装成功!

    (2)设置系统时间与网络时间同步

    [root@slave1 ~]#  ntpdate 0.asia.pool.ntp.org

    这里主要就是通过时间服务器对系统时间进行同步,所以0.asia.pool.ntp.org并不是固定的,大家可以选择time.nist.gov、time.nuri.net、0.asia.pool.ntp.org、1.asia.pool.ntp.org、2.asia.pool.ntp.org、3.asia.pool.ntp.org中任意一个,只要保证可用就OK。

    执行完毕后使用 # date   查看时间是否同步成功

    (3)将系统时间写入硬件时间

    [root@slave1 ~]# hwclock --systohc

    这里是为了防止系统重启后时间被还原,因此需要写到硬件设备中去.

    三.解压zip包

    (1)安装支持ZIP的工具    yum install -y unzip zip

    (2)解压zip文件   unzip 文件名.zip

    例如:压缩一个zip文件   

     zip 文件名.zip 文件夹名称或文件名称

    四.修改系统时间

    (1)查看当前的系统时间:

    [root@bogon vagrant]# date
    Tue Jun 25 12:12:23 UTC 2019

    (2) 查看当前时区

    [vagrant@bogon ~]$ timedatectl status
          Local time: Tue 2019-06-25 20:29:47 CST
      Universal time: Tue 2019-06-25 12:29:47 UTC
            RTC time: Tue 2019-06-25 12:29:50
           Time zone: Asia/Shanghai (CST, +0800)
         NTP enabled: yes
    NTP synchronized: yes
     RTC in local TZ: yes
          DST active: n/a

    Warning: The system is configured to read the RTC time in the local time zone.
             This mode can not be fully supported. It will create various problems
             with time zone changes and daylight saving time adjustments. The RTC
             time is never updated, it relies on external facilities to maintain it.
             If at all possible, use RTC in UTC by calling
             'timedatectl set-local-rtc 0'.
     

    (3)修改时间

     [root@bogon vagrant]# date -s "2019-06-25 20:13:00"
    Tue Jun 25 20:13:00 UTC 2019

    (4)修改时区为上海

     [root@bogon vagrant]# timedatectl set-timezone Asia/Shanghai

    (5) 查看硬件时间

    [root@bogon vagrant]# hwclock --show
    Tue 25 Jun 2019 08:13:56 PM CST  -0.891529 seconds

    (6) 同步系统时间和硬件时间

    [root@bogon vagrant]# hwclock --hctosys

    (7) 本地时间写入硬件时间

    [root@bogon vagrant]# timedatectl set-local-rtc 1
    [root@bogon vagrant]# date
    Tue Jun 25 20:14:35 CST 2019

    (8)重启系统 [root@bogon vagrant]# reboot 

       
  • 相关阅读:
    Android睡眠唤醒机制--Kernel态
    android-铃声的设置与播放
    Android RingtoneManager 铃声管理
    RingtoneManager-获得系统当前的铃声
    Android RingtoneManager铃声管理
    android中常见声音操作方式(Ringtone,SoundPool,MediaPlayer)小结
    android 闹钟提醒并且在锁屏下弹出Dialog对话框并播放铃声和震动
    CSS中常见的BUG调试
    row_number() OVER (PARTITION BY COL1 ORDER BY COL2)
    android平台中,EventBus研究学习
  • 原文地址:https://www.cnblogs.com/zxqtest2020/p/13692628.html
Copyright © 2011-2022 走看看