1.在server主机中配置yum仓库,并安装gcc编译器
- 下载rhel-server-7.0-x86_64-dvd.iso
- 挂载镜像文件到共享目录
- mount rhel-server-7.0-x86_64-dvd.iso /mnt
- 配置本机yun源指向
- rm -rf /etc/yum.repos.d/*
- vim /etc/yum.repos.d/yum.repo
[rhel7.0]
name=rhel7.0
baseurl=file:///mnt
gpgcheck=0 #
- 安装软件
- yum clean all
- yum install gcc -y
安装gcc编译器成功
2. 在server主机中把/etc目录打包压缩到/mnt中,名字为etc.tar.gz
- tar cf /mnt/etc.tar.gz /etc
3.复制server主机中的etc.tar.gz到desktop主机的/mnt中
在server主机中
- scp /mnt/etc.tar.gz root@172.25.254.205:/mnt/
172.25.254.205是desktop的ip
4.同步server主机中的/etc中的所有文件到desktop主机中的/mnt中,包含链接文件
在server主机中:
- rsync -rl /etc/ root@172.25.254.205:/mnt/
5.配置desktop主机和server主机的日志服务
要求如下:
- desktop主机中的日志全部定向到/var/log/westos文件中
在日志发送方desktop主机中:
- vim /etc/rsyslog.conf
加入下妈妈这行代码
*.* /var/log/westos
2. 时时同步desktop主机中的所有日志到server中
在日志发送方desktop主机中:
- vim /etc/rsyslog.conf
加入下妈妈这行代码
*.* @172.25.254.205
6.在server主机中用timedatectl命令设定系统时区为上海,时间为11:11:11
timedatectl set-timezone Asia/Shanghai
timedatectl set-time 11:11:11
7.配置server主机的chronyd服务,使server主机中的时间可以被desktop主机同步
在server主机中
- vim /etc/chrony.conf
下图是修改之前的内容
- 修改22行和29行,如下图
- systemctl restart chronyd.service 重启服务
8.同步server主机中的时间到desktop主机中
在desktop主机中:
- vim /etc/chrony.conf
- 加入一行代码server 172.25.254.105 iburst 表示夲机立即同步server这台主机的时间,如下图
- systemctl restart chronyd.service 重启服务
9.配置系统中的systemd-journal程序,使journal命令可以查看到关机前的日志
- mkdir /var/log/journal 创建日志文件
- chgrp systemd-journal /var/log/journal 改变所有组
- chmod g+s /var/log/journal 加sgid
- ps aux | grep systemd-journal 查看进程
- killall -1 systemd-journal 重启
- ls /var/log/journal 列出验证