配置服务器的主机名称
[root@localhost ~]# hostnamectl set-hostname test.cn
关闭防火墙、SELinux以及NetworkManager
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
setenforce: SELinux is disabled
[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl disable NetworkManager
安全增强型Linux(Security-Enhanced Linux)简称SELinux,它是一个Linux内核模块,也是Linux的一个安全子系统。
SELinux有三种工作模式,分别是:
1、enforcing:强制模式。违反SELinux规则的行为将被阻止并记录到日志中。
2、permissive:宽容模式。违反SELinux规则的行为只会记录到日志中,一般为调试用。
3、disabled:关闭SELinux。
配置yum源
Linux提供了软件包的集中管理机制,该机制将软件以包的形式存储在仓库中,方便用户搜索、安装和管理软件包。yum之所以可以从服务器下载相应的软件包进行安装,是因为配置了相应的软件源。软件源也称为软件仓库,其本质为预先保存了软件包下载地址的文件,这些文件存储在/etc/yum.repos.d目录下。
由于其默认使用官方仓库,访问速度较慢,更换为国内的yum源可以加快软件的下载速度。目前国内比较知名的yum源有:阿里云、腾讯云、网易163、清华大学、京东......
以腾讯云为例配置yum源:腾讯软件源
找到centos 可点击查看相关版本源配置列表
在配置yum源之前先备份系统旧配置文件
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
下载腾讯的yum源,获取相应版本的CentOS-Base.repo到/etc/yum.repos.d/目录下
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
更新缓存
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
ntpdate时间同步(全球可用的NTP服务器列表与解析服务 - ntp.org.cn & ntpdate.net)
不同服务器之间的时间同步,为了避免主机时间因为长期运作下所导致的时间偏差,进行事件同步的工作是非常必要的。Linux系统下,一般使用ntp(Network Time Protocol)服务器来同步不同机器的时间。
[root@localhost ~]# ntpdate 202.112.29.82 #选择任意节点作为时间服务器
[root@localhost ~]# systemctl start ntpd #开启ntpd服务
[root@localhost ~]# systemctl enable ntpd #添加到开机启动项
查看网络时间同步状态
检查NTP状态