第二次作业

一,ntp的时间同步

使用2台Redhat 9 虚拟机

服务器端 IP192.168.124.131   主机名 [root@Server~]

客户端 IP 192.168.124.130   主机名  [root@localhost ~]

  前置操作首先保证时区一致

 

1.安装软件包

 检查是否安装

未安装时:

先挂载 [root@server root2]# mount /dev/sr0 /mnt
再安装 [root@server root2]# yum install chrony -y

 2.服务器和客户端的配置

服务器
[root@server~]# vim /etc/chrony.conf  对其配置文件进行编辑
修改如下内容
#pool 2.rhel.pool.ntp.org iburst  服务器端不需要向上层同步时间
allow 192.168.124.0/24    允许客户端向本服务器同步时间
local stratum 10  定义本地主机时间服务器在第10层级    15以内保证偏差在1-50ms 
[root@server ~]# systemctl  restart chronyd  重启软件以加载配置
客户端
[root@localhost ~]# vim /etc/chrony.conf
 
修改如下内容
pool 192.168.124.131  iburst  从该服务器处同步时间
 
[root@localhost ~]# systemctl restart chronyd  重启chronyd 服务

3.测试

[root@sever ~]# date 111110102022.20
Fri Nov 11 10:10:20 CST 2022     
[root@sever ~]# systemctl restart chronyd
 
[root@localhost ~]# date
sun Apr 16 07:24:00 CST 2023 

 

二、配置ssh免密登陆,能够客户端主机通过普通用户和服务端主机基于公钥验证方式进行远程连接

1.保证opensshrsync两个服务的安装

使用命令

 2.客户端生成密钥 

三.发送到指定目录 

[shasha@node1 root]$ 
[shasha@node1 root]$ ssh-copy-id root@192.168.124.131
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/redhat/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.38.128's password: 
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'root@192.168.124.130'"
and check to make sure that only the key(s) you wanted were added.

四.客户端测试

 
[t1@node1 root]$ ssh root@192.168.124.131
Activate the web console with: systemctl enable --now cockpit.socket
 
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sun Apr 18 19:58:18 2023 from 192.168.124.131

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值