美文网首页
虚拟机中安装CentOS7

虚拟机中安装CentOS7

作者: 技术永无止境 | 来源:发表于2020-09-07 18:37 被阅读0次
  • 选择红框中的选项(如果需要GUI选下面一个)


    image.png
  • 开启以太网卡,后面方便设置虚拟机联网


    image.png
  • 安装阿里yum源
#备份源:
cd /etc/yum.repos.d
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#下载源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#更新缓存
yum makecache
#清除所有yum缓存
yum clean all
#查看所有的yum源
yum repolist all
#查看可用的yum源
yum repolist enabled
  • ifconfig发现ens33没有分配ip,虚拟机中无法连接网络,此时设置虚拟机网卡,选择桥接模式,然后重启虚拟机


    image.png

    重启后如下图所示:


    image.png
  • 打开ssh远程连接
#判断系统是否安装openssh-server
yum list installed | grep openssh-server
#如果没有安装则执行安装
yum install openssh-server
#修改配置
vi /etc/ssh/sshd_config
#打开如下配置:
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
PermitRootLogin yes
PasswordAuthentication yes
#开启ssh服务
sudo service sshd start
#查看服务进程
ps -ef | grep sshd 
netstat -an | grep 22
#添加到自启动
systemctl enable sshd.service
#查看是否开启了自启动
systemctl list-unit-files | grep sshd

相关文章

网友评论

      本文标题:虚拟机中安装CentOS7

      本文链接:https://www.haomeiwen.com/subject/moxlektx.html