Enable GUI on Vagrant Unbuntu 16.04 box

from: http://stackoverflow.com/questions/18878117/using-vagrant-to-run-virtual-machines-with-desktop-environment

  1. Get a basic Ubuntu image working. You should be able to boot it and vagrant ssh.
  2. Next, enable the VirtualBox display, which is off by default. Halt the VM and uncomment these lines in Vagrantfile:
    config.vm.provider :virtualbox do |vb|
      vb.gui = true
  3. Boot the VM and observe the new display window. Now you just need to install and start xfce4. Use vagrant ssh and:
    sudo apt-get install xfce4
    sudo startxfce4&

That’s it, you should be landed in a xfce4 session.

Update: For a better experience, I recommend these improvements:

  1. Don’t start the GUI as root. You really want to stay the vagrant user. To do this you need to permit anyone to start the GUI: sudo vim /etc/X11/Xwrapper.config and edit it to allowed_users=anybody.
  2. Next, install the VirtualBox guest tools before starting the GUI. This will give you a healthy screen resolution, integrated mouse, etc.
    $ sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
    $ sudo VBoxClient-all
  3. Only now should you start the GUI as the vagrant user, with $ startxfce4&.

Update 2: Tried this today and the VBoxClient-all script isn’t always installed. If it’s missing, you can replace with the equivalent:

sudo VBoxClient --clipboard
sudo VBoxClient --draganddrop
sudo VBoxClient --display
sudo VBoxClient --checkhostversion
sudo VBoxClient --seamless



Vagrant.configure(2) do |config|
  # Ubuntu 15.10
  config.vm.box = "ubuntu/wily64"

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true

  # Install xfce and virtualbox additions
  config.vm.provision "shell", inline: "sudo apt-get update"
  config.vm.provision "shell", inline: "sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"
  # Permit anyone to start the GUI
  config.vm.provision "shell", inline: "sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config"

To start the vm

vagrant up

Login with username: vagrant, password: vagrant via the login prompt on the virtualbox GUI.

Start xfce


Use Vagrant vm as Ansible control machine

1. Create Vagrantfile as below:

Vagrant.configure(“2”) do |config|

config.ssh.insert_key = “false”

config.vm.define “ansible” do |ansible|
ansible.vm.box = “centos7”
ansible.vm.provision “shell”, path: “provision.sh”

config.vm.define “vagrant1” do |vagrant1|
vagrant1.vm.box = “ubuntu/trusty64”
vagrant1.vm.network “private_network”, ip: “”


2. The content of provision.sh

#!/usr/bin/env bash

echo “Add extra packages for pip”
sudo rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
echo “update packages”
sudo yum -y update
echo “Install libraries”
sudo yum -y install python-pip python-devel python-lxml openssl-devel
echo “Update pip”
sudo pip install –upgrade pip
echo “Install ansible”
sudo pip install ansible
3. The ansible machine will be used to control the vagrant1 machine

4. After vagrant up, login into ansible machine by: vagrant ssh ansible
create private/public key and upload the public key to vagrant1 (make sure you can ping it first)

5. Add an entry to your /etc/hosts file: (optional)
[target server id] [hostname]
ex: testserv

6. create an Ansible inventory file hosts with the below content:
localhost ansible_connection=local (this line is added so that Ansible can provision local machine)
testserver ansible_host=testsrv ansible_user=vagrant

(Assume ‘testsrv’ is the hostname you add in your /etc/hosts file, if you didn’t add a hostname for the target server, then use its ip instead)

7. Run the following command to make sure Ansible can talk to both local and remote machine
ansible all -i hosts -m ping

How to fix Ansible failed to connect to remote machine due to publickey,password

Sometimes you will encounter an issue when connect to remote machine using Ansible, an example error is shown below:

[vagrant@localhost playbooks]$ ansible testserver -i hosts -m ping
testserver | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n”,
“unreachable”: true

The reason is you didn’t set up your private/public key properly, for example, if you try ssh username@remotehost, it will ask you for password, to fix it, follow the steps below (from: https://www.howtogeek.com/tips/bypass-ssh-logins-by-adding-your-key-to-a-remote-server-in-a-single-command/)

If you want to setup SSH keys to allow logging in without a password, you can do so with a single command. It’s quite easy.

The first thing you’ll need to do is make sure you’ve run the keygen command to generate the keys (if you have already generated keys, skip this step).

ssh-keygen -t rsa

Then use this command to push the key to the remote server, modifying it to match your server user name and host name.

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

You’ll have to enter your password the first time to copy the keys. After that, you should be able to login without a password, or even use scp or rsync without entering a password. You can test with this command:

ssh user@hostname

It’s definitely a lot easier than typing in a password all the time.

Change timezone in CentOS

from: https://www.vultr.com/docs/setup-timezone-and-ntp-on-centos-6

Input the following command in your terminal:


As you see, the Vultr CentOS 6 x64 OS uses the UTC time by default. You can modify it to any time zone as you wish, but using the local timezone of the server’s physical location is a best practice.

If our server was running in China, then we would use the “Asia/Shanghai” time zone:

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/America/Torono /etc/localtime

You can navigate to the directory /usr/share/zoneinfo to find the appropriate time zone. There is an excellent resource on Wikipedia for timezone listings.

Input date again, you will find that the local system time has changed to CST (China Standard Time) GMT+0800.

Next, we will write the system time info into the hardware clock.

vi /etc/sysconfig/clock

Modify the content of this file as below.


Save and quit.


Write the system time into the hardware clock.

hwclock --systohc --localtime

Input hwclock to see the result.

A sample Vagrantfile to install ems, oracle, and bpm

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The “2” in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don’t change it unless you know what
# you’re doing.
Vagrant.configure(“2”) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = “bento/centos-7.2”
config.vm.synced_folder “d:/software/dev_tools/BPM/bpm4.0/TIB_amx-bpm_4.0.0_linux24gl23_x86_64”, “/vagrant/bpm_install”
config.vm.synced_folder “d:/software/dev_tools/BPM/EMS8.2.2”, “/vagrant/ems_install”
config.vm.synced_folder “d:/software/dev_tools/oracle/12c/linux64/database”, “/vagrant/oracle_install”
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing “localhost:8080” will access port 80 on the guest machine.
# config.vm.network “forwarded_port”, guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network “private_network”, ip: “”

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network “public_network”

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder “../data”, “/vagrant_data”

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
config.vm.provider “virtualbox” do |vb|
vb.memory = “6144”

# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define “atlas” do |push|
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision “initialize”, type: “shell”, path: “scripts/initialize.sh”

#config.vm.provision “ems_install”, type: “shell”, path: “https://gist.githubusercontent.com/yonglai/caa8e8497a3640e23e93c61def9691ab/raw/f7e1daf08feb2abc98259574fdb1fea4960fb50f/ems_install.sh”
config.vm.provision “ems_install”, type: “shell”, path: “scripts/ems_install.sh”, privileged: false

config.vm.provision “ems_startup”, type: “shell”, path: “scripts/ems_startup.sh”

config.vm.provision “pre_oracle_install”, type: “shell”, path: “scripts/pre_oracle_install.sh”

config.vm.provision “oracle_install”, type: “shell”, path: “scripts/oracle_install.sh”

config.vm.provision “post_oracle_install”, type: “shell”, path: “scripts/post_oracle_install.sh”

config.vm.provision “bpm_install”, type: “shell”, path: “scripts/bpm_install.sh”, privileged: false

config.vm.provision “bpm_pre_config”, type: “shell”, path: “scripts/bpm_pre_config.sh”, privileged: false

config.vm.provision “bpm_config”, type: “shell”, path: “scripts/bpm_config.sh”, privileged: false

config.vm.provision “bpm_startup”, type: “shell”, path: “scripts/bpm_startup.sh”


To run:

vagrant up
vagrant provision –-provision-with initialize
vagrant reload
vagrant provision –-provision-with ems_install,ems_startup,pre_oracle_install,oracle_install
(wait for oracle install to complete)
vagrant provision –-provision-with post_oracle_install,bpm_studio_install,bpm_install,bpm_pre_config,bpm_config
vagrant provision –provision-with bpm_startup
vagrant provision –provision-with cleanup
vagrant provision –provision-with prepare_for_packaging

Config TIBCO EMS in silent mode

./tibemsadmin64 -server “tcp://localhost:7222” -user admin -password “” -script /vagrant/ems_install/ems_install/bpm_setup.scr

A sample script content:

delete queue >

delete topic >

create user bpmadm “bpm user” password=bpmadm

create queue AMX_SV.>

grant queue AMX_SV.> user=bpmadm create, delete, modify, send, receive

create topic EMSGMS.>

grant topic EMSGMS.> user=bpmadm create, modify, subscribe, publish

grant topic $sys.monitor.connection.* user=bpmadm subscribe

create queue com.tibco.amf.admin.deploymentServerQueue.>

grant admin user=bpmadm view-connection, view-server

grant queue com.tibco.amf.admin.deploymentServerQueue.> user=bpmadm create, delete, send, receive

create topic AMX_MGMT.>

grant topic AMX_MGMT.> user=bpmadm create, modify, subscribe, publish

create queue AMX_MGMT.>

grant queue AMX_MGMT.> user=bpmadm create, delete, modify, send, receive

create queue cl_logservice_queue.physical

create queue cl_payload_queue.physical

create queue amx.governance.stats

create queue amx.governance.internal.stats

grant queue cl_logservice_queue.physical user=bpmadm send, receive

grant queue cl_payload_queue.physical user=bpmadm send, receive

grant queue amx.governance.stats user=bpmadm send, receive

grant queue amx.governance.internal.stats user=bpmadm send, receive

create jndiname cl_logservice_queue queue cl_logservice_queue.physical

create jndiname cl_payload_queue queue cl_payload_queue.physical


Install EMS (8.2.2) in silent mode

You need to install 32bit library support on 64bit centos
1. sudo yum install glibc.i686
2. Copy the TIBCOUniversalInstaller-ems.silent file and rename the file.
3. Using a text editor, open the copied file and update the install location and features to install.
4. Run the installer using this command line:
TIBCOUniversalInstaller -silent -V responseFile=”myfilename.silent”

If you are using the TIBCOUniversalInstaller-ems.silent file (rather than a copy), you need not supply the file name and can use this command line:
TIBCOUniversalInstaller -silent.

./TIBCOUniversalInstaller-lnx-x86.bin -silent -V responseFile=ems_install.silent


sample silent file content:

<?xml version=”1.0″?>
<!DOCTYPE properties SYSTEM “http://java.sun.com/dtd/properties.dtd”&gt;
<comment>—Universal Installer Silent Installation Properties—</comment>

<!– Accept the license agreement –>
<entry key=”acceptLicense”>true</entry>

<!– The root installation directory –>
<!– If the product does not support multiple instances and TIBCO_HOME has already been set then –>
<!– this value is ignored and the existing TIBCO_HOME is used as the installation root. –>
<entry key=”installationRoot”>/opt/tibco</entry>

<!– If using an existing environment then the installationRoot AND environmentName MUST match a pre-existing environment. –>
<!– If creating a new environment then the installationRoot AND environmentName MUST BE UNIQUE and not match a pre-existing environment. –>
<entry key=”environmentName”>TIBCO-HOME</entry>
<!– This only needs to be used for the macos power platform. –>
<entry key=”environmentDesc”>my installation</entry>

<!– configDirectoryRoot – location of configuration files if it does not already exist –>
<entry key=”configDirectoryRoot”>/home/user/tibco</entry>

<!– The following configuration parameters control the download of Hibernate –>
<!– LGPLAssemblyLicenseAccepted – true or false to accept the license –>
<!– LGPLAssemblyDownload – true or false to download the assembly from the public TIBCO server –>
<!– LGPLAssemblyPath – if LGPLAssemblyDownload is false, this is the path where the Hibernate assembly is located on the system –>
<entry key=”LGPLAssemblyLicenseAccepted”>true</entry>
<entry key=”LGPLAssemblyDownload”>true</entry>
<entry key=”LGPLAssemblyPath”>/opt/tibco/thirdpartyDownload</entry>

<!–Product Feature Settings–>
<entry key=”feature_EMS Server Baseline_ems”>true</entry>
<entry key=”feature_Development Kit_ems”>true</entry>
<entry key=”feature_EMS Client Baseline_ems”>true</entry>
<entry key=”feature_EMS Source_ems”>true</entry>
<entry key=”feature_Hibernate (For Database Stores)_ems”>false</entry>

<!– Product-specific properties can be set below using the same ‘entry key=’ format as above. –>
<!– ONLY applicable for Windows platforms: –>
<!– manualRB – values can be true or false –>
<!– autoRB – values can be true or false –>
<!– Only one can be true, the default will be manual. –>
<entry key=”manualRB”>true</entry>
<entry key=”autoRB”>false</entry>
<entry key=”setUID”>false</entry>
<!– configFile – values can be the default value or a file that already exists –>
<!– If an invalid value is added, the default value will be used –>
<entry key=”configFile”>/home/user/tibco/cfgmgmt/ems/data/tibemsd.conf</entry>

Oracle systemd startup script

from: https://community.oracle.com/thread/2520738


sudo touch /etc/systemd/system/oracle.service

sudo chmod 644 /etc/systemd/system/oracle.service

Description=Oracle database server
After=syslog.target network.target




sudo touch /bin/oracle.sh

sudo chown :oinstall /bin/oracle.sh

sudo chmod 750 /bin/oracle.sh

#! /bin/bash
#  script used by oracle.service

$ORACLE_HOME/bin/lsnrctl start;

sudo systemctl daemon-reload

sudo systemctl enable oracle.service

[Note: if the database wasn’t started, you need to check the /etc/oratab to see if the third field is set to ‘N’. If so, the database will be ignored by dbstart and you need to manually change it to ‘Y’.]