服务器 centos7 最少安装后常用命令

更新yum
yum update
安装httpd
yum install httpd -y
可能会用到的:
启动服务(等同于service httpd start)
systemctl start httpd.service
停止服务(等同于service httpd stop)
systemctl stop httpd.service
重启服务(等同于service httpd restart)
systemctl restart httpd.service
查看服务是否运行(等同于service httpd status)
systemctl status httpd.service
开机自启动服务(等同于chkconfig httpd on)
systemctl enable httpd.service
开机时禁用服务(等同于chkconfig httpd on)
systemctl disable httpd.service
查看服务是否开机启动 (等同于chkconfig --list)
systemctl list-units --type=service

1、关闭firewall:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

2、安装iptables防火墙

yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
#add:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


systemctl restart iptables.service #最后重启防火墙使配置生效

systemctl enable iptables.service #设置防火墙开机启动



yum install net-tools  #安装netstat

你可能感兴趣的:(linux)