同步时间
# 安装软件
centos7: yum -y install ntpdate
centos8: yum install -y chrony
# 向阿里云服务器同步时间
centos7: ntpdate time1.aliyun.com
centos8: chronyd -q 'server ntp.ntsc.ac.cn iburst'
# 删除本地时间并设置时区为上海
centos7:
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
centos8:
vim /etc/chrony.conf
注释掉第三行原有的时间服务器地址,设置为阿里云的时间服务地址
阿里云提供了7个NTP时间服务器也就是Internet时间同步服务器地址
ntp1.aliyun.com
#重启时间服务
systemctl restart chronyd.service
#设置时间同步服务开机启动
systemctl enable chronyd.service
# 查看时间
date -R || date
命令补全
# 安装bash-completion
yum -y install bash-completion bash-completion-extras
# 使用bash-completion
source /etc/profile.d/bash_completion.sh
关闭swap分区
# 临时关闭:
swapoff -a
#永久关闭:
vi /etc/fstab
# 将文件中的/dev/mapper/centos-swap这行代码注释掉
#/dev/mapper/centos-swap swap swap defaults 0 0
# 确认swap已经关闭:若swap行都显示 0 则表示关闭成功
free -m