VirtualBox 安装 Centos8 使用 Xshell 连接
小太阳Sunny 人气:0
### 1.下载CentOS
CentOS下载地址:[https://wiki.centos.org/Download](https://wiki.centos.org/Download)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327170428648-1670557537.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327171128375-1580865318.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327171133962-1174514397.png)
这里选择本地安装包,网络安装包在安装时需要在线下载资源比较慢
### 2.安装VirtualBox
VirtualBox是Oracle旗下免费的轻量级虚拟机
VirtualBox下载地址:[https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327171811135-1573031803.png)
安装VirtualBox直接next安装完成。
### 3.新建虚拟机
1)新建虚拟电脑,选择系统类型和版本,分配内存大小
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327180858621-2050744796.png)
2)点击创建虚拟硬盘位置
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327180905416-1555307941.png)
### 4.安装CentOS8
1)启动,进入安装界面
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327184834485-891624551.png)
2)等待安装,进入系统设置界面
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327184915596-816017636.png)
3)选择语言
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327184935370-871376092.png)
4)按顺序进行设置,1和4只需要点进去确认即可
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185131654-257135703.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185318042-396481329.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185350270-1247320491.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185421414-342915680.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185502724-1107582696.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185538037-144076108.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185547528-1682528601.png)
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327185552904-888661746.png)
==安装完成之后,点右上角X,退出系统,回到VirtualBox,设置=》存储,把虚拟光盘移除掉,否则再次启动时会再次进入安装界面==
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327190127352-1834940633.png)
==设置虚拟机网络,就和本地电脑在同一网段==
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327191403175-461775301.png)
### 5.使用Xshell连接CentOS8
1)查看linux IP地址
```shell
ip addr
```
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327192125768-1612620310.png)
2)使用Xshell连接
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200328135119257-364397431.gif)
#### 常见问题
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200327192131283-151043777.png)
1)为了方便本地测试直接关闭防火墙
```shell
1.查看防火强状态
systemctl status firewalld.service
2.关闭防火墙
systemctl stop firewalld.service
3.禁用防火墙
systemctl disable firewalld.service
```
2)检查ssh-server服务有没有安装
```shell
1.检查是否安装openssh-server
rpm -qa |grep ssh
2.安装openssh-server
yum install openssh-server
3.开启ssh服务
systemctl start sshd.service
4.设置开机启动服务
systemctl enable sshd.service
5.检查服务状态
systemctl status sshd.service
```
3)查看22端口是否存在
```shell
ss -lnt
```
4)以上办法都没用就重装VirtualBox
本在在写这篇博客时演示安装完Centos8之后不明原因,之前能连上的,后来连不上了,就是重装之后重新初始化网络就好了。
![](https://img2020.cnblogs.com/blog/713857/202003/713857-20200328134929212-885519380.png)
尽情享用吧,接下来安装docker。
加载全部内容