CentOS7.5下Vagrant、VirtualBox安装配置

需求

在服务器版本的CentOS7.5下需要安装一个Window版本的Sql Server 2014

解决方法

基于这个需求,首先想到的就是在CentOS7.5中安装VirtualBox,再安装对应的SQL Server版本了。基于类Docker操作习惯,选用Vagrant作为解决方案。

Vagrant安装

参考:
vagrant安装
vagrant下载

下载RPM包来安装

[root@htwy work]# mkdir vagrant
[root@htwy vagrant]# wget -c 0 https://releases.hashicorp.com/vagrant/2.1.5/vagrant_2.1.5_x86_64.rpm
--2018-09-26 22:34:43--  http://0/
Resolving 0 (0)... 0.0.0.0
Connecting to 0 (0)|0.0.0.0|:80... failed: Connection refused.
--2018-09-26 22:34:43--  https://releases.hashicorp.com/vagrant/2.1.5/vagrant_2.1.5_x86_64.rpm
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.109.183, 2a04:4e42:36::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.109.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 39469426 (38M) [application/x-redhat-package-manager]
Saving to: ‘vagrant_2.1.5_x86_64.rpm’

56% [=============================================================================================>                                                                          ] 22,234,360   223KB/s  eta 10s    100%[=======================================================================================================================================================================>] 39,469,426   206KB/s   in 2m 0s  

2018-09-26 22:36:44 (322 KB/s) - ‘vagrant_2.1.5_x86_64.rpm’ saved [39469426/39469426]

FINISHED --2018-09-26 22:36:44--
Total wall clock time: 2m 1s
Downloaded: 1 files, 38M in 2m 0s (322 KB/s)
[root@htwy vagrant]# ll
total 38548
-rw-r--r--. 1 root root 39469426 Sep 12 13:18 vagrant_2.1.5_x86_64.rpm
[root@htwy vagrant]# rpm -ivh vagrant_2.1.5_x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:vagrant-1:2.1.5-1                ################################# [100%]
[root@htwy vagrant]# vagrant version
Installed Version: 2.1.5
Latest Version: 2.1.5
 
You're running an up-to-date version of Vagrant!

安装VirtualBox

主要涉及到的操作命令

yum  install epel-release
cd /etc/yum.repos.d/
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
yum update
yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
查看安装的VirtualBox版本
vboxmanage --version

安装过程

[root@htwy ~]# yum  install epel-release
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
base                                                                                                                                                                                      | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                                                          | 2.9 kB  00:00:00     
extras                                                                                                                                                                                    | 3.4 kB  00:00:00     
updates                                                                                                                                                                                   | 3.4 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                                                                                                         | 187 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                                                                                                        | 5.2 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                                Arch                                             Version                                          Repository                                        Size
=================================================================================================================================================================================================================
Installing:
 epel-release                                           noarch                                           7-11                                             extras                                            15 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                                              |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : epel-release-7-11.noarch                                                                                                                                                                      1/1 
  Verifying  : epel-release-7-11.noarch                                                                                                                                                                      1/1 

Installed:
  epel-release.noarch 0:7-11                                                                                                                                                                                     

Complete!
[root@htwy ~]#  cd /etc/yum.repos.d/
[root@htwy yum.repos.d]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo 
--2018-09-26 23:03:32--  http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
Resolving download.virtualbox.org (download.virtualbox.org)... 23.36.192.188
Connecting to download.virtualbox.org (download.virtualbox.org)|23.36.192.188|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 259 [text/plain]
Saving to: ‘virtualbox.repo’

100%[=======================================================================================================================================================================>] 259         --.-K/s   in 0s      

2018-09-26 23:03:34 (19.3 MB/s) - ‘virtualbox.repo’ saved [259/259]

[root@htwy yum.repos.d]# ll
-rw-r--r--. 1 root root  259 Sep 30  2015 virtualbox.repo
[root@htwy yum.repos.d]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                      | 8.4 kB  00:00:00     
 * base: mirrors.cn99.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
epel                                                                                                                                                                                      | 3.2 kB  00:00:00     
virtualbox/7/x86_64/signature                                                                                                                                                             |  181 B  00:00:00     
Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc
Importing GPG key 0x98AB5139:
 Userid     : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>"
 Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139
 From       : https://www.virtualbox.org/download/oracle_vbox.asc
Is this ok [y/N]: y
virtualbox/7/x86_64/signature                                                                                                                                                             | 2.9 kB  00:00:20 !!! 
(1/4): epel/x86_64/group_gz                                                                                                                                                               |  88 kB  00:00:00     
(2/4): epel/x86_64/updateinfo                                                                                                                                                             | 943 kB  00:00:00     
(3/4): virtualbox/7/x86_64/primary_db                                                                                                                                                     | 107 kB  00:00:00     
(4/4): epel/x86_64/primary                                                                                                                                                                | 3.6 MB  00:00:00     
epel                                                                                                                                                                                                 12687/12687
Resolving Dependencies
--> Running transaction check
---> Package kexec-tools.x86_64 0:2.0.15-13.el7 will be updated
---> Package kexec-tools.x86_64 0:2.0.15-13.el7_5.1 will be an update
---> Package microcode_ctl.x86_64 2:2.1-29.10.el7_5 will be updated
---> Package microcode_ctl.x86_64 2:2.1-29.16.el7_5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                             Arch                                         Version                                                    Repository                                     Size
=================================================================================================================================================================================================================
Updating:
 kexec-tools                                         x86_64                                       2.0.15-13.el7_5.1                                          updates                                       341 k
 microcode_ctl                                       x86_64                                       2:2.1-29.16.el7_5                                          updates                                       1.4 M

Transaction Summary
=================================================================================================================================================================================================================
Upgrade  2 Packages

Total download size: 1.7 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): microcode_ctl-2.1-29.16.el7_5.x86_64.rpm                                                                                                                                           | 1.4 MB  00:00:00     
(2/2): kexec-tools-2.0.15-13.el7_5.1.x86_64.rpm                                                                                                                                           | 341 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                            4.1 MB/s | 1.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : kexec-tools-2.0.15-13.el7_5.1.x86_64                                                                                                                                                          1/4 
  Updating   : 2:microcode_ctl-2.1-29.16.el7_5.x86_64                                                                                                                                                        2/4 
  Cleanup    : kexec-tools-2.0.15-13.el7.x86_64                                                                                                                                                              3/4 
  Cleanup    : 2:microcode_ctl-2.1-29.10.el7_5.x86_64                                                                                                                                                        4/4 
  Verifying  : 2:microcode_ctl-2.1-29.16.el7_5.x86_64                                                                                                                                                        1/4 
  Verifying  : kexec-tools-2.0.15-13.el7_5.1.x86_64                                                                                                                                                          2/4 
  Verifying  : kexec-tools-2.0.15-13.el7.x86_64                                                                                                                                                              3/4 
  Verifying  : 2:microcode_ctl-2.1-29.10.el7_5.x86_64                                                                                                                                                        4/4 

Updated:
  kexec-tools.x86_64 0:2.0.15-13.el7_5.1                                                                  microcode_ctl.x86_64 2:2.1-29.16.el7_5                                                                 

Complete!
[root@htwy yum.repos.d]# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
Package binutils-2.27-28.base.el7_5.1.x86_64 already installed and latest version
Package 1:qt-4.8.7-2.el7.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package patch-2.7.1-10.el7_5.x86_64 already installed and latest version
Package libgomp-4.8.5-28.el7_5.1.x86_64 already installed and latest version
Package glibc-headers-2.17-222.el7.x86_64 already installed and latest version
Package glibc-devel-2.17-222.el7.x86_64 already installed and latest version
Package kernel-headers-3.10.0-862.11.6.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package dkms.noarch 0:2.6.1-1.el7 will be installed
--> Processing Dependency: elfutils-libelf-devel for package: dkms-2.6.1-1.el7.noarch
---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-862.11.6.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package elfutils-libelf-devel.x86_64 0:0.170-4.el7 will be installed
--> Processing Dependency: pkgconfig(zlib) for package: elfutils-libelf-devel-0.170-4.el7.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                                   Arch                                       Version                                                  Repository                                   Size
=================================================================================================================================================================================================================
Installing:
 dkms                                                      noarch                                     2.6.1-1.el7                                              epel                                         75 k
 gcc                                                       x86_64                                     4.8.5-28.el7_5.1                                         updates                                      16 M
 kernel-devel                                              x86_64                                     3.10.0-862.11.6.el7                                      updates                                      16 M
Installing for dependencies:
 cpp                                                       x86_64                                     4.8.5-28.el7_5.1                                         updates                                     5.9 M
 elfutils-libelf-devel                                     x86_64                                     0.170-4.el7                                              base                                         38 k
 libmpc                                                    x86_64                                     1.0.1-3.el7                                              base                                         51 k
 mpfr                                                      x86_64                                     3.1.1-4.el7                                              base                                        203 k
 zlib-devel                                                x86_64                                     1.2.7-17.el7                                             base                                         50 k

Transaction Summary
=================================================================================================================================================================================================================
Install  3 Packages (+5 Dependent packages)

Total download size: 38 M
Installed size: 90 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/8): elfutils-libelf-devel-0.170-4.el7.x86_64.rpm                                                                                                                                       |  38 kB  00:00:00     
(2/8): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                                                                                      |  51 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/epel/packages/dkms-2.6.1-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for dkms-2.6.1-1.el7.noarch.rpm is not installed
(3/8): dkms-2.6.1-1.el7.noarch.rpm                                                                                                                                                        |  75 kB  00:00:00     
(4/8): mpfr-3.1.1-4.el7.x86_64.rpm                                                                                                                                                        | 203 kB  00:00:00     
(5/8): zlib-devel-1.2.7-17.el7.x86_64.rpm                                                                                                                                                 |  50 kB  00:00:00     
(6/8): cpp-4.8.5-28.el7_5.1.x86_64.rpm                                                                                                                                                    | 5.9 MB  00:00:02     
(7/8): kernel-devel-3.10.0-862.11.6.el7.x86_64.rpm                                                                                                                                        |  16 MB  00:00:02     
(8/8): gcc-4.8.5-28.el7_5.1.x86_64.rpm                                                                                                                                                    |  16 MB  00:00:03     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             10 MB/s |  38 MB  00:00:03     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mpfr-3.1.1-4.el7.x86_64                                                                                                                                                                       1/8 
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                                                                                                     2/8 
  Installing : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                                   3/8 
  Installing : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                                                                                   4/8 
  Installing : kernel-devel-3.10.0-862.11.6.el7.x86_64                                                                                                                                                       5/8 
  Installing : zlib-devel-1.2.7-17.el7.x86_64                                                                                                                                                                6/8 
  Installing : elfutils-libelf-devel-0.170-4.el7.x86_64                                                                                                                                                      7/8 
  Installing : dkms-2.6.1-1.el7.noarch                                                                                                                                                                       8/8 
  Verifying  : zlib-devel-1.2.7-17.el7.x86_64                                                                                                                                                                1/8 
  Verifying  : kernel-devel-3.10.0-862.11.6.el7.x86_64                                                                                                                                                       2/8 
  Verifying  : elfutils-libelf-devel-0.170-4.el7.x86_64                                                                                                                                                      3/8 
  Verifying  : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                                                                                   4/8 
  Verifying  : mpfr-3.1.1-4.el7.x86_64                                                                                                                                                                       5/8 
  Verifying  : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                                   6/8 
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                                                                                                                     7/8 
  Verifying  : dkms-2.6.1-1.el7.noarch                                                                                                                                                                       8/8 

Installed:
  dkms.noarch 0:2.6.1-1.el7                                     gcc.x86_64 0:4.8.5-28.el7_5.1                                     kernel-devel.x86_64 0:3.10.0-862.11.6.el7                                    

Dependency Installed:
  cpp.x86_64 0:4.8.5-28.el7_5.1          elfutils-libelf-devel.x86_64 0:0.170-4.el7          libmpc.x86_64 0:1.0.1-3.el7          mpfr.x86_64 0:3.1.1-4.el7          zlib-devel.x86_64 0:1.2.7-17.el7         

Complete!
[root@htwy ~]# virtualbox --help
Oracle VM VirtualBox Manager 5.2.18
(C) 2005-2018 Oracle Corporation
All rights reserved.

Usage:
  --startvm <vmname|UUID>    start a VM by specifying its UUID or name
  --separate                 start a separate VM process
  --normal                   keep normal (windowed) mode during startup
  --fullscreen               switch to fullscreen mode during startup
  --seamless                 switch to seamless mode during startup
  --scale                    switch to scale mode during startup
  --no-startvm-errormsgbox   do not show a message box for VM start errors
  --restore-current          restore the current snapshot before starting
  --no-aggressive-caching    delays caching media info in VM processes
  --fda <image|none>         Mount the specified floppy image
  --dvd <image|none>         Mount the specified DVD image
  --dbg                      enable the GUI debug menu
  --debug                    like --dbg and show debug windows at VM startup
  --debug-command-line       like --dbg and show command line window at VM startup
  --debug-statistics         like --dbg and show statistics window at VM startup
  --no-debug                 disable the GUI debug menu and debug windows
  --start-paused             start the VM in the paused state
  --start-running            start the VM running (for overriding --debug*)

Expert options:
  --disable-patm             disable code patching (ignored by AMD-V/VT-x)
  --disable-csam             disable code scanning (ignored by AMD-V/VT-x)
  --recompile-supervisor     recompiled execution of supervisor code (*)
  --recompile-user           recompiled execution of user code (*)
  --recompile-all            recompiled execution of all code, with disabled
                             code patching and scanning
  --execute-all-in-iem       For debugging the interpreted execution mode.
  --warp-pct <pct>           time warp factor, 100% (= 1.0) = normal speed
  (*) For AMD-V/VT-x setups the effect is --recompile-all.

The following environment (and extra data) variables are evaluated:
  VBOX_GUI_DBG_ENABLED (GUI/Dbg/Enabled)
                             enable the GUI debug menu if set
  VBOX_GUI_DBG_AUTO_SHOW (GUI/Dbg/AutoShow)
                             show debug windows at VM startup
  VBOX_GUI_NO_DEBUGGER       disable the GUI debug menu and debug windows

[root@htwy ~]# vboxmanage --version
5.2.18r124319
[root@htwy ~]# 
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,482评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,377评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,762评论 0 342
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,273评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,289评论 5 373
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,046评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,351评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,988评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,476评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,948评论 2 324
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,064评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,712评论 4 323
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,261评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,264评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,486评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,511评论 2 354
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,802评论 2 345

推荐阅读更多精彩内容