centos7 常用命令汇总

 

1. 安装开发环境

yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel

或者

yum groupinstall "Development tools"

 

2. hostnamectl 使用

    永久修改主机名并查看

hostnamectl set-hostname master
hostnamectl status

3. 防火墙设置

   开启/关闭防火墙服务

#开启
systemctl start firewalld.service
#关闭
systemctl stop firewalld.service
#关闭
systemctl disable firewalld.service

查看所有打开的端口

firewall-cmd --zone=public --list-ports

打开端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

删除规则

firewall-cmd --zone= public --remove-port=80/tcp --permanent

重新载入

firewall-cmd --reload

查看某一端口

firewall-cmd --zone= public --query-port=80/tcp

指定IP与端口

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="5432" accept"

 

 

 



 

posted @ 2019-10-31 14:25  星辰大海的征途  阅读(85)  评论(0编辑  收藏  举报