Archive

Posts Tagged ‘vagrant’

Installing Elasticsearch 2.4

April 25, 2017 Leave a comment

Problem: Elasticsearch 2.4 on vm.

Solution:
Pretty straight foward if you following the instructions on the Elasticsearch site.

1. Setup a new box.

$ vagrant init ubuntu/trusty64
$ vagrant up
$ vagrant ssh

2. Download java.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html#BJFJJEFG

3. Install java.
As per instructions below.
http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux

Once you have java running on your vm.

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

4. Install Elasticsearch.
As per guide below.
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/_installation.html

$ cd elasticsearch-2.4.4/bin
$ ./elasticsearch
[2017-04-25 09:52:24,646][INFO ][node                     ] [Thundra] version[2.4.4], pid[7102], build[fcbb46d/2017-01-03T11:33:16Z]
[2017-04-25 09:52:24,652][INFO ][node                     ] [Thundra] initializing ...
[2017-04-25 09:52:25,905][INFO ][plugins                  ] [Thundra] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2017-04-25 09:52:26,009][INFO ][env                      ] [Thundra] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [34.6gb], net total_space [39.3gb], spins? [possibly], types [ext4]
[2017-04-25 09:52:26,011][INFO ][env                      ] [Thundra] heap size [1015.6mb], compressed ordinary object pointers [true]
[2017-04-25 09:52:26,012][WARN ][env                      ] [Thundra] max file descriptors [4096] for elasticsearch process likely too low, consider increasing to at least [65536]
[2017-04-25 09:52:30,427][INFO ][node                     ] [Thundra] initialized
[2017-04-25 09:52:30,429][INFO ][node                     ] [Thundra] starting ...
[2017-04-25 09:52:30,657][INFO ][transport                ] [Thundra] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-04-25 09:52:30,669][INFO ][discovery                ] [Thundra] elasticsearch/I1jPodmCSGG4YanF0bceyQ
[2017-04-25 09:52:33,738][INFO ][cluster.service          ] [Thundra] new_master {Thundra}{I1jPodmCSGG4YanF0bceyQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2017-04-25 09:52:33,786][INFO ][http                     ] [Thundra] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-04-25 09:52:33,788][INFO ][node                     ] [Thundra] started
[2017-04-25 09:52:33,844][INFO ][gateway                  ] [Thundra] recovered [0] indices into cluster_state
$ curl 'localhost:9200/_cat/health?v'
epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1493114161 09:56:01  elasticsearch green           1         1      0   0    0    0        0             0                  -                100.0%
Advertisements
Categories: elasticsearch Tags: , ,

Vagrant – Setting up an Ubuntu box on Mac OS X

August 21, 2015 Leave a comment

Problem:
Needed to have an Ubuntu Box on Mac OS X Yosemite.

Solution:
Vagrant + Ubuntu + Virtual Box

$ vagrant init ubuntu/trusty64

$ vagrant up --provider virtualbox

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
==> 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:
    default: Guest Additions Version: 4.3.10
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => /Users/rodnee/local_trusty
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.


$ vagrant ssh

Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-62-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Fri Aug 21 09:36:29 UTC 2015

  System load:  0.16              Processes:           92
  Usage of /:   2.9% of 39.34GB   Users logged in:     0
  Memory usage: 18%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud


Last login: Fri Aug 21 09:04:39 2015 from 10.0.2.2
-bash: warning: setlocale: LC_ALL: cannot change locale (en.US): No such file or directory

vagrant@vagrant-ubuntu-trusty-64:~$ exit
logout
Connection to 127.0.0.1 closed.

$ vagrant halt

==> default: Attempting graceful shutdown of VM...

Other commands:
1. To view the boxes that you have on your machine.


$ vagrant box list
ubuntu/trusty64     (virtualbox, 20150817.0.0)
ubuntu64box         (vmware_fusion, 0)

$ vagrant box remove ubuntu64box --provider vmware_fusion
Removing box 'ubuntu64box' (v0) with provider 'vmware_fusion'...

Assumptions:
1. You have VirtualBox installed on your machine.
2. You have Vagrant installed on your machine.

Source:
https://atlas.hashicorp.com/boxes/search?provider=virtualbox
Creating Development Environments with Vagrant by Michael Peacock

Working with “Vagrant and Oracle database 11g”

December 6, 2014 Leave a comment

This is a follow up to my earlier post here.

I. Some changes made to Vagrantfile

1. Changed the host port to 1234 as it complained that 1521 was already in use. (This is the one to connect to via sqlplus64)
config.vm.network :forwarded_port, guest: 1521, host: 1234
2. Changed the amount of memory database should use from 512 to 2048
i. In the VagrantFile
# Oracle claims to need 512MB of memory available minimum
"--memory", "2048",

ii. In /modules/oracle/manifests/init.pp file, changed from 1024 to 4096
"/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096",

II. Bring up Oracle 11g database on virtual instance of Ubuntu

$ cd vagrant-ubuntu-oracle-xe/
:~/vagrant-ubuntu-oracle-xe$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 1521 => 1234 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
... <deleted a bit of output>
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
:~/vagrant-ubuntu-oracle-xe$ vagrant provision
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: stdin: is not a tty
... <deleted a bit of output>
==> default: notice: /Stage[main]/Oracle::Server/Exec[apt-update]/returns: executed successfully
==> default: notice: /Stage[main]/Oracle::Xe/File[/tmp/oracle-env.sh]/ensure: defined content as '{md5}c874e5a7a4cc6b15ff68055335c136fb'
==> default: notice: /Stage[main]/Oracle::Xe/File[/tmp/xe.rsp.orig]/ensure: defined content as '{md5}b79c95d12321f3eb55d855082d1d6831'
==> default: notice: /Stage[main]/Oracle::Server/File[/tmp/60-oracle.conf]/ensure: defined content as '{md5}61b22d59fdc07f9fa6929ab74f5b6e99'
==> default: info: /Stage[main]/Oracle::Server/File[/tmp/60-oracle.conf]: Scheduling refresh of Exec[procps]

III. Install sqlplus
Download oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm from Oracle site.
http://download.oracle.com/otn/linux/instantclient/11204/oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

1. Install alien
# apt-get install alien
2. Convert rpm to deb
# alien -k --scripts oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
3. Install deb
# dpkg -i oracle-instantclient11.2-sqlplus_11.2.0.4.0-1_amd64.deb

IV. Connect to Oracle 11g database

$ sqlplus64 system/manager@//localhost:1234/XE

SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 6 13:44:32 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> 

If you have an issues with sqlplus64, try to follow instructions in this post. YMMV.

V. Adding History
# apt-get install rlwrap

As a normal user
$ rlwrap sqlplus64 system/manager@//localhost:1234/XE

Source:
http://webikon.com/cases/installing-oracle-sql-plus-client-on-ubuntu
https://wiki.kuali.org/display/KULRICE/Install+Oracle+11g+using+Vagrant
http://pastebin.com/tsJ32r4p

Using Oracle with Vagrant

December 6, 2014 Leave a comment

Problem:
This was a major issue for me. I needed Oracle 11g Database on my laptop.

Solution:
One of the possible solutions I took was to use vagrant. (I am pretty much just going to repeat the same steps as per what I got from the website listed in the Sources section below.)

1. Download and install Vagrant
2. Download and install VirtualBox
3. Download the Oracle 11g zip file for Linux x64
NB. Always download the Linux x64 zip file, even if you are on Windows or Mac OSX.
4. Clone the vagrant-ubuntu-oracle-xe repository from GitHub
git clone git://github.com/hilverd/vagrant-ubuntu-oracle-xe
5. Copy the Oracle 11g zip file to the directory vagrant-ubuntu-oracle-xe expects to find it in
cp ~/Downloads/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ~/vagrant-ubuntu-oracle-xe/modules/oracle/files
6. Install vbguest
vagrant plugin install vagrant-vbguest
7. Invoke Vagrant to install and configure Oracle 11g
cd ~/vagrant-ubuntu-oracle-xe
vagrant up

After a few minutes your local machine will be running an Oracle 11g server on a virtual instance of Ubuntu 12.04

Well… not exactly.
1. I had run out of space on my / partition. I couldn’t install the new linux header files that were needed. The quickest thing for me was to format my machine. This time round I gave a bit more GBs to / partition.
2. Added some mirrors to /etc/apt/sources.list
3. root> apt-get update
4. First mistake I made was not to do apt-get dist-upgrade
5. So, oblivious of that, I followed steps 1 to 7, but vagrant up brought more errors
6. The kernel version on my machine and the latest linux-headers- being seen by virtual box were not the same. I was getting an error similar to this. (It was late and I did not have the presence of mind to save the errors. Sorry.)
$ VBoxManage --version
WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-ose-dkms package and the appropriate
headers, most likely linux-headers-generic

You will not be able to start VMs until this problem is fixed.
X.X.XX_DebianXXXXX

7. Googled a bit. All references to above error were advising the OPs to do the following
apt-get install linux-headers-$(uname -r)
8. But above did not work since I could not find the linux-headers for the current system version that I had.
9. After 2 or 4 hours, I realised that I needed to get my kernel (3.14) to the same version as what was installed (3.16), so read about configuring kernels but the steps were too hard for my already fried brain. At this point I stumbled accross an page explaining what apt-get does. And thus I tried dist-upgrade with the hope that it would upgrade my kernel.
10. Ran the below command
root> apt-get dist-upgrade
11. Once that was done, I rebooted and sure enough my kernel was now 3.16
12. vagrant up now runs
13. So this install would have gone a whole lot more smoothly if I had updgraded my machine before I started this exercise. I’m much older and wiser 🙂

Source:
https://wiki.kuali.org/display/KULRICE/Install+Oracle+11g+using+Vagrant
https://help.ubuntu.com/community/AptGet/Howto