CentOS 7 最小化安装后的注意事项(二)
2018-05-15 本文已影响49人
Mr_Barry

二、安装ssh服务
安装在虚拟机下的Centos7想要在局域网中使用,则必须安装ssh服务。
1.查看是否安装了ssh服务:
[root@localhost /]# rpm -qa|grep -E "openssh"
显示结果如下,则表示已经安装,否则需要安装缺失的软件。
[图片上传失败...(image-6f45c4-1526340872923)]2.安装缺失的软件:
[root@localhost /]# yum install openssh*
3.启动ssh服务:
[root@localhost /]# service sshd start
4.开启防火墙的22端口:
[root@localhost /]# firewall-cmd --zone=public --add-port=22/tcp --permanent
[root@localhost /]# service firewalld restart
5.安装完成ssh服务后不一定可以直接连接,还需要对虚拟机网络进行配置:
a.进入网络配置文件
[root@localhost /]# cd /etc/sysconfig/network-scripts

b.使用vim编辑器配置ifcfg-ens33
文件
[root@localhost /etc/sysconfig/network-scripts]# vim ifcfg-ens33

c.由于在虚拟机里安装centos,要要给其他局域网用户使用,所以选择桥接模式

d.然后执行systemctl restart network
,重启网络服务

6.使用局域网内的终端进行ssh连接:

参考:Linux中国
博客:Barry’Blog