Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System

当前位置: 首页 » 技术文章 » Cloud

Vagrant with oracle

Vagrant是一款用于构建及配置虚拟开发环境的软件,基于Ruby,主要以命令行的方式运行。主要使用Oracle的开源VirtualBox虚拟化系统,与Chef,Salt,Puppet等环境配置管理软件搭配使用, 可以实行快速虚拟开发环境的构建。


  1. Install Oracle VM VirtualBox
  2. Install Vagrant
$ vagrant box add --name <name> <url>
$ vagrant init <name>
$ vagrant up
$ vagrant ssh
For example:
$ vagrant box add --name ol76
$ vagrant init ol76
$ vagrant up
$ vagrant ssh

To verify the checksum of the downloaded box:
$ vagrant box add --name ol76 --checksum 4ba496525f44bd2ad4f741c4a9328cdb78f606b0c87df7125e6a32b33b808a8e \
--checksum-type sha256
C:\>vagrant box add --name ol76
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ol76' (v0) for provider:
    box: Downloading:
    box: Progress: 100% (Rate: 944k/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'ol76' (v0) for 'virtualbox'!
C:\>vagrant init ol76
The user that is running Vagrant doesn't have the proper permissions
to write a Vagrantfile to the specified location. Please ensure that
you call `vagrant init` in a location where the proper permissions
are in place to create a Vagrantfile.

C:\>cd C:\Users\nini\.vagrant.d

C:\Users\nini\.vagrant.d>vagrant init ol76
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

C:\Users\nini\.vagrant.d>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ol76'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrantd_default_1550648895681_55990
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

This option can be disabled globally with an environment variable:


or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: Guest Additions Version: 5.2.22
    default: VirtualBox Version: 6.0
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/nini/.vagrant.d
C:\Users\nini\.vagrant.d>vagrant ssh
Last login: Wed Nov 14 15:03:15 2018 from
Last login: Wed Nov 14 15:03:15 2018 from

Welcome to Oracle Linux Server release 7.6 (GNU/Linux 4.14.35-1818.4.5.el7uek.x86_64)

The Oracle Linux End-User License Agreement can be viewed here:

    * /usr/share/eula/eula.en_US

For additional packages, updates, documentation and community help, see:


[vagrant@localhost ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::a00:27ff:fed0:4f43  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:d0:4f:43  txqueuelen 1000  (Ethernet)
        RX packets 626  bytes 79592 (77.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 458  bytes 81419 (79.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 64  bytes 5440 (5.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5440 (5.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[vagrant@localhost ~]$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[vagrant@localhost ~]$ id root
uid=0(root) gid=0(root) groups=0(root)
[vagrant@localhost ~]$ su -
Last login: Wed Nov 14 15:03:16 UTC 2018 on pts/0

[root@localhost ~]#

mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/192
chown -R oracle: /u01/app/oraInventory
chown -R oracle: /u01/app/oracle
su - oracle



其他有用的docker工具,比如Docker Toolbox(包含boot2docker,kitematic),不是Docker for windows


关键词:vagrant cloud oracle 


低代码开发用Oracle Apex,看这篇就够了
Oracle Database 20c之SQL宏
Java beginner for Oracle DBA
Oracle Database 20c之区块链表
Oracle Database 20c的一些微妙变化
Oracle Database 19c在优化方面有哪些新特性
Oracle Database 20c云端预览版发布了
Oracle 19c新特性之RAC Automatic Failback Service
Install Oracle RAC Database 19c Step by Step