1、指定在每天凌晨4:00将该时间点之前的系统日志信息(/var/log/messages )备份到目录下/backup,备份后日志文件名显示格式logfileYY-MM-DD-HH-MM
[root@localhost ~]# mkdir /backup
[root@localhost ~]# crontab -e
no crontab for root - using an empty one
'''
00 04 * * * cp -a /var/log/cron /var/log/messages/cron'date + (%Y-%M-%D %H:%M).log
~
~
~
~
~
~
~
~
~
2、配置ssh免密登陆:客户端主机通过redhat用户基于秘钥验证方式进行远程连接服务器的root用户。
客户端
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ZBQJ7JlhZDXPbKbnisOwuaCnuF/UwUrNMsA414EM5Wk root@localhost.localdomain
The key's randomart image is:
+---[RSA 3072]----+
|.*oo.++o=o |
|o.=o.=+..= |
| oE +o=+o * |
[root@localhost ~]# ll /root/.ssh
总用量 8
-rw-------. 1 root root 2610 11月 21 20:39 id_rsa
-rw-r--r--. 1 root root 580 11月 21 20:39 id_rsa.pub
[root@localhost ~]# ssh-copy-id 192.168.53.212
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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: ERROR: ssh: connect to host 192.168.53.212 port 22: Connection refused
3、搭建一个web网站,网站显示hello world内容
[root@localhost ~]# ll /etc/yum.repos.d/
总用量 4
-rw-r--r--. 1 root root 358 11月 21 20:39 redhat.repo
[root@localhost ~]# vim /etc/yum.repos.d/aliyun.repo
[root@localhost ~]# yum install httpd -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
aliyun-base 3.2 MB/s | 7.9 MB 00:02
aliyun-app 5.2 MB/s | 18 MB 00:03
上次元数据过期检查:0:00:01 前,执行于 2023年11月21日 星期二 20时48分17秒。
依赖关系解决。