linux初始化配置---主机名、关闭防火墙、关闭selinux (centos 7)
一.修改主机名
1.临时修改
[[email protected] network-scripts]# hostname jw07
然后就可以看到我们的主机名被修改了
2.永久修改主机名
[[email protected] /]# hostnamectl set-hostname liutao
重启centos就可以看到更改了
二.如何关闭centos的防火墙
1.临时关闭
[[email protected] ~]# systemctl stop firewalld.service
我们可以通过查看防火墙状态查看是否成功关闭
[[email protected] ~]# firewall-cmd --state
not running
2.永久关闭
[[email protected] ~]# systemctl disable firewalld.service
这句命令理解为开机不启动防火墙,那么开机都不启动了是不是就是永久关闭了呢
三、关闭selinux
1.临时关闭
[[email protected] ~]# setenforce 0
2.永久关闭(修改配置文件)
[[email protected] ~]# vi /etc/selinux/config
最后重启即可
可以通过查看状态查看是否关闭
[[email protected] ~]# sestatus
SELinux status: disabled
注:selinux为Linux系统中一种常见的安全软件,SELinux一共有3种状态,分别是Enforcing,Permissive和Disabled状态。第一种是默认状态,表示强制启用,第二种是宽容的意思,即大部分规则都放行。第三种是禁用,即不设置任何规则。只能通过setenforce命令来设置前面两种状态,而如果想修改为disable状态,需要修改配置文件,同时重启系统。
原文:https://www.cnblogs.com/xiaofeiyuxiaopang/p/12724198.html