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) "
 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) "
 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     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          Mount the specified floppy image
  --dvd          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            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 ~]# 

你可能感兴趣的:(CentOS7.5下Vagrant、VirtualBox安装配置)