网站首页 安全运维 CentOS 7 常用方法
CentOS 7 常用方法
编辑时间:2019-12-31 22:03 作者:nllihui6390 浏览量:1772
1、 centos6的网卡重启方法:

service network restart

centos7的网卡重启方法:

systemctl restart network


2、systemctl相关

启动一个服务:systemctl start nginx.service
关闭一个服务:systemctl stop postfix.service
重启一个服务:systemctl restart nginx.service
显示一个服务的状态:systemctl status postfix.service
在开机时启用一个服务:systemctl enable nginx.service
在开机时禁用一个服务:systemctl disable nginx.service
查看服务是否开机启动:systemctl is-enabled nginx.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed


3、DNS配置文件:cat /etc/resolv.conf

设置主机和IP绑定信息:cat /etc/hosts
设置主机名:cat /etc/hostname


4、修改文件夹权限

chmod -R 777 + 文件夹名


5、关闭防火墙并设置开机不启动

查看防火墙状态:systemctl status firewalld.service
关闭:systemctl stop firewalld
开启:systemctl start firewalld
开机自动关闭:systemctl disable firewalld
开机自动启动:systemctl enable firewalld
查看开机是否启动:chkconfig --list|grep network(RHLE6)

6、临时和永久关闭Selinux

临时关闭:

[root@localhost etc]#getenforce
Enforcing
[root@localhost etc]#setenforce 0 
setenforce:SELinux is disabled

永久关闭:

vim /etc/selinux/config
# 将SELINUX=enforce改成SELINUX=disabled
# 保存,重启



查看系统端口

netstat  -anp  |grep   端口号


查看进程

ps -aux | grep nginx 



3. kill 命令用于终止进程
例如: kill -9 [PID]
-9 表示强迫进程立即停止
通常用 ps 查看进程 PID ,用 kill 命令终止进程


关闭全部进程

killall  nginx

来说两句吧
乖,登录后才可以留言!
最新评论