一、配置网络
在使用Vmware Workstation10.2测试过程中,发现可能部分物理机100M网卡不能正常识别,换到了1000M网卡上测试能正常识别虚拟网卡
Centos7系统的网卡设备命名有所变化,可参考CentOS 7下网络设备命名,个人感觉既然学习新系统,完全没必要换成传统的识别名方式,要勇于接受新知识~
1.通过编辑文件修改网络配置
vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
HWADDR=00:0c:29:14:34:51
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
USERCTL=no
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
ONBOOT=yes
IPADDR=192.168.117.128
NETMASK=255.255.255.0
GATEWAY=192.168.117.2
DNS1=192.168.117.2
关键配置:
TYPE=Ethernet
BOOTPROTO=static
NAME=eno16777736
ONBOOT=yes
IPADDR=192.168.117.128
NETMASK=255.255.255.0
GATEWAY=192.168.117.2
DNS1=192.168.117.2
cat /etc/resolv.conf
nameserver 192.168.117.2
2.通过文本工具nmtui修改网络配置(RHEL7/CentOS7默认安装,前提需要开启NetworkManager.service才可以使用)
yum -y install NetworkManager-tui
nmtui-edit eno16777736 修改网卡配置
nmtui-connect eno16777736
重启网络
systemctl restart network
systemctl status network
修改主机名:
vim /etc/hostname
centos7.simlinux.com
退出重新登录即可生效
二、关闭不必要的服务
最小化安装的Centos7系统并没有nano、vim、wget、curl、ifconfig、lsof命令,这里首先安装一下:
yum -y install nano vim wget curl net-tools lsof
可以通过netstat和lsof查看系统都运行了哪些服务,将不必要的进行关闭
systemctl stop postfix
systemctl stop avahi-daemon
systemctl disable postfix
systemctl disable avahi-daemon
systemctl list-unit-files 查看正在运行服务的状态报告
systemctl start httpd.service 启动服务
systemctl stop httpd.service 关闭服务
systemctl restart httpd.service 重启服务
systemctl reload httpd.service 重新加载服务
systemctl disable httpd.service 开机不启动
systemctl enable httpd.service 开机启动
systemctl status httpd.service 查看服务运行状态
systemctl show httpd.service 显示服务或任务的属性
systemctl list-dependencies httpd.service 检查服务依赖关系
systemctl is-enabled httpd.service 检查服务是否开机启动及级别
systemctl -H 192.168.117.128 start httpd.service 启动192.168.117.128机器上的httpd服务
转载于:https://my.oschina.net/tc8/blog/338357