linux环境搭建前期配置

一、永久修改主机名

1、修改network文件

# vim /etc/sysconfig/network

加入 HOSTNAME=主机名

保存退出

2、修改hosts文件

# vim /etc/hosts

修改主机名和别名

3、修改hostname文件

#vim /etc/hostname

修改为主机名

二、安装iptables防火墙

1、关闭firewall

# systemctl stop firewalld.service 

2、禁止firewall开机启动

# systemctl disable firewalld.service

3、安装iptables

# yum install iptables-services

4、清空原有规则链

#iptables -F

#iptables -X

#iptables -Z

5、保存配置

#service iptables save

6、重启iptables

#service iptables restart

7、设置iptables开机启动

#systemctl enable iptables.service

 (防火墙规则链后期另开一篇配置)

三、更改ssh远程连接端口

1、编辑sshd_config

#vim /etc/ssh/sshd_config

2、找到#Port 22一段,这里是标识默认使用22端口,去掉注释,换行加上 Port 8888

保存退出

3、重启sshd

#service sshd restart

 

原文地址:https://www.cnblogs.com/shizhongyang/p/9510380.html