您的位置:首页 > 运维架构 > Linux

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

2016-07-07 16:56 706 查看
更新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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: