########第八讲#######
****1.同步日志时间
clock -s 硬件时间覆盖软件时间
clock -w 软件时间覆盖硬件时间
同步之前先关闭服务端防火墙
vim /etc/chronyc.conf
同步方式:服务端:
图片
服务端allow设置为网段,172.25.24.0/24代表三位网段
172.25.0.0/16代表两位网段
local stratum 10 表示级别
客户端:
设置为问谁要,故设置为指向IP
配置完成后,均需从新启动该服务chronyd.service
使用命令,chronycsources -v 查看时间同步
***2.系统时间修改
2.1查看系统时间
timedatectl status
2.2更改时区
查看时区命令timedatectl list-timezones
设置更改时区timedatectl set-timezone Asia/Shanghai
2.3设置是否读取硬件时间
timedatect set-local-rtc (1为使用当地时间,0为读取硬件时间)
2.4设置系统时间
timedatectl set-time “2017-1-13 11:11:11”(也可以只添加时间不添加年月日)
#####3.日志分析工具
journalctl **查看所有日志文件
journalctl -n 数字 **查看最新的(数字)条日志
journalctl -p err **查看报错的日志
journalctl -f **监控日志
journalctl -o verbose **查询具体参数的使用方法
默认情况下,之保存开机后的日志。若想要永久保存日志,须以下操作:
mkdir /var/log/journal
chmod g+s /var/log/journal
chown root:systemd-journal
killall -1 systemd-journald
ls /var/log/journal/946
#####4.yum命令
yum install softname **安装软件
remove softname **卸载软件
list installd **列出已经安装的软件名
list all **列出所有软件名称
list available **列出可以用yum安装的软件名称
clean all **清空yum缓存
search softwareinfo **根据软件信息搜索软件名字
whatprovides filename **在yum源中查找包含filename文件的软件包
update **更新软件
history **查看系统软件改变历史
reinstall softwarename **重新安装
info softwarename **查看软件信息
groups list **查看软件组信息
groups info softwaregroup **查看软件组内包含的软件
groups install softwaregroup **安装组件
groups remove softwaregroup **卸载组件
#####5.软件仓库的搭建
5.1设置本地源指向
root权限下:建立目录/rhel7.2
将镜像文件挂到该目录中
60 mount /home/kiosk/Desktop/rhel-server-7.2-x86_64-dvd.iso /rhel7.2 **镜像挂到目录下
cd /rhel7.2
ls
cd Packages/
ls
cd /etc/yum.repos.d
ls
mv rhel-dvd.repo /mnt/
ls
mv rht-extras.repo /mnt/
ls
vim rhel7.2.repo
[root@foundation24 yum.repos.d]#cat /etc/yum.repos.d/rhel7.2.repo
[RHEL7.2] **随便写
name=rhel7.2 source **名字可以随便起
baseurl=file:///rhel7.2 **file是本地访问的意思
gpgcheck=0 **是否允许第三方应用安装0是,1不允许
yum install dhcp
5.2建立共享目录
在这一步骤前,需关闭防火墙以及安装http服务
mkdir /var/www/html/rhel7.2
umount /rhel7.2
mount rhel-server-7.2-x86_64-dvd.iso/var/www/html/rhel7.2
检测是否分享成功:
http:本机IP//rhel7.2 进去就会看到镜像文件里面的内容
5.3开机自动挂载
在使用中会发现,每次重启后必须得重新挂载很麻烦,所以我们可以设置开机自动挂载
vim /etc/rc.d/rc.local
mount rhel-server-7.2-x86_64-dvd.iso/var/www/html/rhel7.2
chmod +x /etc/rc.d/rc.local
5.4客户端的设置
vim /etc/yum.repos.d/rhel7.2