Linux环境基本设置

安装好Linux系统后,通常要做一些基本设置,比如网络,防火墙等。

1.修改ip地址,执行如下命令:
vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes         #开机使用
BOOTPROTO=static   #ip地址设置为静态
IPADDR=192.168.92.82   #Linux服务器ip地址
GATEWAY=192.168.92.1   #网关地址
NETMASK=255.255.255.0  #子网掩码
DNS=192.168.92.1       #DNS服务器地址

保存vi修改小技巧:
shift + Duoble Z click == wq!
重启网络服务
service network restart

2.修改主机名为mini1
vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=mini1

需要重启机器。

3.修改ip地址和主机名的映射关系
vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.92.81 mini

4.关闭iptables并设置其开机启动/不启动

service iptables stop
chkconfig iptables on
chkconfig iptables off

你可能感兴趣的:(Linux环境基本设置)