1. 修改主机名
[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# vi /etc/hostname //将文件中的“localhost.localdomain”修改为“Server”,需重启后方可生效
localhost.localdomain -> Server
2. 关闭selinux
[root@localhost ~]# vi /etc/selinux/config // 将文件中的“SELINUX=enforcing”修改成“SELINUX=disabled”,需重启后方可生效
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
3. 关闭防火墙并禁止开机自启动
[root@localhost ~]# systemctl stop firewalld.service //停止防火墙服务
[root@localhost ~]# systemctl disable firewalld.service //禁止防火墙服务开机自启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
4. 更新系统软件
[root@localhost ~]# yum -y update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.18.0-5.el7 will be updated
---> Package NetworkManager.x86_64 1:1.18.0-5.el7_7.1 will be an update
---> Package NetworkManager-adsl.x86_64 1:1.18.0-5.el7 will be updated
---> Package NetworkManager-adsl.x86_64 1:1.18.0-5.el7_7.1 will be an update
---> Package NetworkManager-glib.x86_64 1:1.18.0-5.el7 will be updated
---> Package NetworkManager-glib.x86_64 1:1.18.0-5.el7_7.1 will be an update
(中间省略……)
sos.noarch 0:3.7-6.el7.centos
systemd.x86_64 0:219-67.el7_7.1
systemd-libs.x86_64 0:219-67.el7_7.1
systemd-python.x86_64 0:219-67.el7_7.1
systemd-sysv.x86_64 0:219-67.el7_7.1
tuned.noarch 0:2.11.0-5.el7_7.1
Complete!
5. 重启
[root@localhost ~]# reboot
6. 验证主机名
[root@Server ~]# hostname
Server
7.验证防火墙状态
[root@Server ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
8. 验证selinux状态
[root@Server ~]# getenforce
Disabled
作者:复苏的兵马俑
链接:https://www.jianshu.com/p/016e6ba954cb
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。