首页 > 技术文章 > 【Docker--Ubuntu18.04安装】安装vmtools,配置阿里云软件源,并且安装docker-compose,vulhub环境搭建。

darkerg 2021-03-17 20:28 原文

一、安装VMwareTools

1.点击VMware的虚拟机选项中,点击安装VMware Tools,随后在桌面上就会出现一个工具驱动。

 

 

 2.双击打开驱动之后将VMwareTools-10.3.22-15902021.tar,gz复制到桌面上,然后邮件点击“提取到此处”。

 

 

 3.打开文件夹后,找到vmware-install.pl。在终端打开,运行vmware-install.pl。

 

 

 

 第一个选项输入y,之后一直回车就可以了。然后重新启动虚拟机,功能就正常了。

 

二、安装Docker

Ubuntu安装docker官方的源很慢,所以我们采用阿里云的软件源安装。

1.首先配置阿里云软件源

  在文件管理中打开本机根目录,进入/etc/apt文件夹中,有一个sources.list文件。现将这个文件备份到一个位置(位置自选)

  然后在此处打开终端,输入

sudo gedit sources.list

  打开文件后,使用下面的阿里云源配置即可。

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://mirrors.aliyun.com/ubuntu bionic main restricted
# deb-src https://mirrors.aliyun.com/ubuntu bionic main restricted
 
## Major bug fix updates produced after the final release of the
## distribution.
deb https://mirrors.aliyun.com/ubuntu bionic-updates main restricted
# deb-src https://mirrors.aliyun.com/ubuntu bionic-updates main restricted
 
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb https://mirrors.aliyun.com/ubuntu bionic universe
# deb-src https://mirrors.aliyun.com/ubuntu bionic universe
deb https://mirrors.aliyun.com/ubuntu bionic-updates universe
# deb-src https://mirrors.aliyun.com/ubuntu bionic-updates universe
 
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb https://mirrors.aliyun.com/ubuntu bionic multiverse
# deb-src https://mirrors.aliyun.com/ubuntu bionic multiverse
deb https://mirrors.aliyun.com/ubuntu bionic-updates multiverse
# deb-src https://mirrors.aliyun.com/ubuntu bionic-updates multiverse
 
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb https://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu bionic-backports main restricted universe multiverse
 
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
 
deb https://mirrors.aliyun.com/ubuntu bionic-security main restricted
# deb-src https://mirrors.aliyun.com/ubuntu bionic-security main restricted
deb https://mirrors.aliyun.com/ubuntu bionic-security universe
# deb-src https://mirrors.aliyun.com/ubuntu bionic-security universe
deb https://mirrors.aliyun.com/ubuntu bionic-security multiverse
deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic stable
# deb-src [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic stable

 下面开始安装Docker

  如果系统里已经有了,可以先卸载。没有安装过,可以忽略。

sudo apt-get remove docker docker-engine docker-ce docker.io

  更新软件列表

sudo apt-get update

  apt-get 可以使用https库

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

  添加docker的使用的公钥

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

  添加docker的远程库

sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" 
sudo apt-get update

  安装docker-ce

sudo apt-get install -y docker-ce

  启动docker

sudo systemctl status docker

  运行hello-world

sudo docker run hello-world

 

三、安装Docker-Compose

  同样,在安装Docker-compose的时候,官方的源太慢了,我们是用一个国内的。在终端下运行命令

curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

  上面会提示权限不够,那么就加上sudo命令。之后发现权限还是不够,那么我们进入超级管理员身份。

sudo -i 

  然后再执行上面的 curl命令。下载好之后,创建软链。

chmod +x /usr/local/bin/docker-compose

  最后,检查是否安装成功。

docker-compose --version

 

 

四、下载Vulhub,搭建漏洞复现环境。

  Vulhub 我们是用git来下载,在ubuntu终端中输入

git --version

  来查看是否安装了git,没有安装git可以自己查一查别的文章哈~

  接下来,是用gitee上面的vulhub链接来下载。

git clone https://gitee.com/wssz/vulhub.git

  下一篇文章介绍如何启动Vulhub的环境,以及如何在宿主机上面访问虚拟机中的Docker环境。

 

 

 

 

 

 

  

 

推荐阅读