Installation vagrant in centos7 minimize installation + virtualbox create Web Hosting Tutorials

Foreword

The need to work and study in the use of centos7, also need to create a virtual host, will often use vagrant management tools to create a virtual host, wrote this summary recap.

Special Note: In case if you just want to succeed in this environment quickly installed, please read the full text after the operation, some of which did not depend on me to install, thank you!

1, preparation

1)vagrant

Vagrant is a Ruby-based tool for creating and deploying virtualized development environment. It uses Oracle's open source VirtualBox virtualization system, use Chef to create automated virtual environment. (Cited Baidu Encyclopedia https://baike.baidu.com/item/Vagrant/1321946?fr=aladdin)

Detailed instructions, consult the official website of documentation, software download address: https://www.vagrantup.com/

2)VirtualBox

VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2.(官网说明)

Software Download: https://www.virtualbox.org/

What we need here is the official website to download and install the rpm package installed, of course, you can use yum install VirtualBox, below I will put yum source (backward looking oh).

3) Check the computer's bios virtualization is not opened, the computer models are more, please Baidu own. View virtualization centos command as follows:

See if cpu support 

# grep -E ' SVM | VMX ' / proc / cpuinfo

 - VMX IS for Intel Processors

 - SVM IS for AMD Processors

4) yum source configuration of VirtualBox (official address: https: //www.virtualbox.org/wiki/Linux_Downloads, most bottom of the page)

vim /etc/yum.repos.d/vbox.repo

[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc

 

2, installation and deployment

1, when the upper side configuration or directly after completion of the software download, install command as follows:

[the root @ localhost ~] # RPM -ivh VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64.rpm 
Warning: VirtualBox - 6.0 - 6.0 .8_130520_el7- . 1 .x86_64.rpm: the DSA head V4 / SHAl the Signature, Key ID 98ab5139 : NOKEY 
error: dependent detection failure: 
        libGL.so. . 1 (64bit) () is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 need 
        libICE.so. . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 need 
        libsdl - 1.2 .so.0 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 need 
        libSM.so. . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 need 
        libX11 -xcb.so. . 1 ( ) (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 need 
        libX11.so are. . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 required 
        . libXcursor.so . 1 () (64bit) It is VirtualBox- 6.0- 6.0 .8_130520_el7- . 1 .x86_64 need 
        libXext.so. . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 required 
        . LibXmu.so . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7 - . 1 .x86_64 need 
        libXrender.so. . 1 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64 required 
        . libXt.so . 6 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1.x86_64 need 
        libfontconfig.so. 1 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 needs 
        . libopus.so 0 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 need 
        libpng15 . .so 15 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 needs 
        . libpng15.so 15 (PNG15_0) (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 need 
        libvpx.so. 1() (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 need 
        libxcb.so. 1 () (64bit) is VirtualBox- 6.0 - 6.0 .8_130520_el7- 1 .x86_64 need

When using the rpm package, on top of the error occurs, the lack of dependence, which is characteristic of linux, below we install dependencies:

yum -Y the install libGL libICE libsm libXcursor libXmu libxrender libXt the libpng the SDL libvpx the fontconfig Opus 
dependent libraries

Then you can directly install vbox (the abbreviated here) a

[the root @ localhost ~] # RPM -ivh VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 .x86_64.rpm 
Warning: VirtualBox - 6.0 - 6.0 .8_130520_el7- . 1 .x86_64.rpm: the DSA head V4 / SHAl the Signature, Key ID 98ab5139 : NOKEY 
preparation ################################# ... [ 100 % ] 
being upgraded / installation .. .
    . 1 : VirtualBox- 6.0 - 6.0 .8_130520_el7- . 1 ################################# [ 100 % ] 

Creating Group ' the vboxusers '. VM users must be member of that group!

This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-862.el7.x86_64
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-862.el7.x86_64

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.

Here, or the lack of something, reminds us that we support the linux kernel corresponding virtualization module is not added, but the addition of these modules has a corresponding dependence, resolve dependencies as follows:

yum -y install gcc gcc-c++ kernel-devel

After installation is complete, run the following command to re-load the appropriate kernel module

[root@localhost ~]# vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.

In fact, when loading the appropriate module, I also see such a command on the official website of the tutorial, it is also possible.

rcvboxdrv setup 
system core load the appropriate virtualization module, the specific cause of reference vbox official website of the manual.

2, install vagrant, this installation is not so much a question of directly execute the following command.

[root @ localhost ~] # RPM -ivh vagrant_2. 2 .5_x86_64.rpm 
preparation ... ############################ ##### [ 100 % ] 
being upgraded / installed ...
    . 1 : vagrant- . 1 : 2.2 . . 5 - . 1                 ####################### ########## [ 100 %],

3, on the use of vagrant

Our help documentation

[root@localhost ~]# vagrant --help
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     cloud           manages everything related to Vagrant Cloud
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     port            displays information about guest port mappings
     powershell      connects to machine via powershell remoting
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     snapshot        manages snapshots: saving, restoring, etc.
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     upload          upload to machine via communicator
     validate        validates the Vagrantfile
     version         prints current and latest Vagrant version
     winrm           executes commands on a machine via WinRM
     winrm-config    outputs WinRM configuration to connect to the machine

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.

The most commonly used command sequence:

vagrant box [url] download mirrors * .box

vagrant init box-name VM initialization, file creation vagrantfile

vagrant up the virtual machine

vagrant ssh remote connection virtual machine

vagrant halt off the virtual machine

vagrant destory delete a virtual machine

As the foreign box image download too difficult to use, often leads to the download fails, it is recommended Tsinghua source, the command is as follows:

the Add box HTTPS Vagrant: // mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/bionic/current/bionic-server-cloudimg-amd64-vagrant.box --name Ubuntu / Bionic 
download box virtual images
the init Ubuntu Vagrant / Bionic 
  initialization image 
 
vagrant up 
  the virtual machine 

Vagrant SSH 
  connection virtual machine SSH 

Vagrant HALT 
  off the virtual machine

Note: After the fact, here if you do not have the source of the box, it can also be downloaded through the browser to complete, copied to the centos, the initialization in the init, is also possible.

Here the basic installation is over.

 

Guess you like

Origin www.cnblogs.com/weixinboke/p/ding2019071700001.html
Recommended