Linux 系统初始化
查看系统版本: cat /etc/redhat-release
系统版本 CentOS Linux release 7.9.2009 (Core)
升级软件包 yum -y upgrade
安装epel yum install -y epel-release
yum install -y vim net-tools wget gcc gcc-c++
卸载软件: yum remove 软件名
编译软件卸载 make uninstall 软件名
查看ip ip addr
查看dns: cat /etc/resolv.conf
修改网卡配置 /etc/sysconfig/network-scripts/ifcfg-xxx
开启网络 ONBOOT=yes
静态ip
BOOTPROTO=static
添加:
IPADDR=192.168.1.151
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DNS2=8.8.8.8
重启网络 systemctl restart network
使用 iptables 管理防火墙
禁用centos7默认防火墙
systemctl stop firewalld.service
systemctl mask firewalld.service
systemctl disable firewalld.service
安装 iptables
yum install -y iptables-services
systemctl start iptables
systemctl enable iptables
IPTABLES 修改
vim /etc/sysconfig/iptables
根据服务器实际情况增加端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5672 -j ACCEPT
service iptables restart