Difference between revisions of "Vagrant"

From GRASS-Wiki
Jump to navigation Jump to search
(basic info)
 
 
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page shows how to use {{wikipedia|Vagrant}} together with GRASS GIS. The GRASS source code contains customized Vagrantfile. This highly simplifies the vagrant usage.
{{toc|right}}
This page shows how to use {{wikipedia|Vagrant_(software)|Vagrant}} together with GRASS GIS. The GRASS source code contains customized {{src|Vagrantfile}}. This highly simplifies the vagrant usage.
 
Dependencies:
 
# Debian/Ubuntu
apt-get install vagrant virtualbox
# Fedora
dnf install vagrant libvirt VirtualBox


''Note:'' '$' shows commands to be entered from local machine, '#' from vagrant's virtual machine
''Note:'' '$' shows commands to be entered from local machine, '#' from vagrant's virtual machine
Line 5: Line 14:
First of all we download GRASS source code from SVN:
First of all we download GRASS source code from SVN:


  $ svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk
  $ svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk_vagrant
$ cd grass_trunk_vagrant


We start new vagrant instance by running:
We start new vagrant instance by:


  $ vagrant up
  $ vagrant up


The command creates new vagrant virtual machines, downloads all dependecies, and compiles GRASS on this machine. You can connect to this machine by:
The command creates new vagrant virtual machines, downloads all dependencies, and compiles GRASS on this machine. You can connect to this machine by:


  $ vagrant ssh
  $ vagrant ssh


The common usage may be:
Enjoy!
 
== Usage ==
 
Note: it's good idea to store ssh configuration for virtual machine to the file which we can use for scp and other similar commands:
 
  $ vagrant ssh-config > ssh-config
 
1) First, we need to get our GRASS data to the virtual machine, there are several options:
 
:1a) link your grassdata from local to virtual machine:
 
:Uncomment lines below in the Vagrantfile and define 'grassdata_dir' pointing to your GRASS data directory on local machine:
 
    grassdata_dir = "/opt/grassdata"                                                                                                                                                         
    host.vm.synced_folder grassdata_dir, "/home/vagrant/grassdata" 
 
:Then reload your virtual machine to reflect the synced GRASS data directory:
 
  $ vagrant reload
 
:1b) copy your grassdata from local to virtual machine:


1) create 'grassdata' directory in vagrant's home directory (enter commands from virtual machine):
  $ scp -r -F ssh-config /opt/grassdata grass-gis-vagrant:


# mkdir grassdata && cd grassdata
:1c) download on virtual machine sample grassdata from Internet:


2) download sample data
$ vagrant ssh
   
  # mkdir grassdata
  # wget https://grass.osgeo.org/sampledata/north_carolina/nc_spm_08_grass7.tar.gz
  # wget https://grass.osgeo.org/sampledata/north_carolina/nc_spm_08_grass7.tar.gz
  # tar xzf nc_spm_08_grass7.tar.gz
  # tar xzf nc_spm_08_grass7.tar.gz


Note: you can also copy your local data to the virtual machine by 'scp' command (enter commands from your local machine):
2) start GRASS from virtual machine


  $ vagrant ssh-config > ssh-config
  $ vagrant ssh
  $ scp -r -F ssh-config /opt/grassdata/gismentors default:grassdata
  # grass71


3) start GRASS from virtual machine
3) To halt running virtual machine type:


  # grass71
  $ vagrant halt
 
== How to update GRASS installation ==
 
First of all, update GRASS source code from SVN:
 
$ svn up
 
To update your GRASS installation in vagrant (make && make install):
 
$ vagrant provision
 
If you want to re-compile GRASS from scratch (make distclean && configure && make && make install) you need to destroy your virtual machine and create new one:


To halt running virtual machine type:
$ vagrant destroy -f && vagrant up


vagrant halt
== Notes ==


Enjoy!
* You can specify different image before creating a new virtual machine in Vagrantfile (default is Ubuntu 14.04 LTS 64bit):


=== How to update GRASS installation ===
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"

Latest revision as of 17:36, 16 February 2016

This page shows how to use Vagrant together with GRASS GIS. The GRASS source code contains customized Vagrantfile. This highly simplifies the vagrant usage.

Dependencies:

# Debian/Ubuntu
apt-get install vagrant virtualbox

# Fedora
dnf install vagrant libvirt VirtualBox

Note: '$' shows commands to be entered from local machine, '#' from vagrant's virtual machine

First of all we download GRASS source code from SVN:

$ svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk_vagrant
$ cd grass_trunk_vagrant

We start new vagrant instance by:

$ vagrant up

The command creates new vagrant virtual machines, downloads all dependencies, and compiles GRASS on this machine. You can connect to this machine by:

$ vagrant ssh

Enjoy!

Usage

Note: it's good idea to store ssh configuration for virtual machine to the file which we can use for scp and other similar commands:

 $ vagrant ssh-config > ssh-config

1) First, we need to get our GRASS data to the virtual machine, there are several options:

1a) link your grassdata from local to virtual machine:
Uncomment lines below in the Vagrantfile and define 'grassdata_dir' pointing to your GRASS data directory on local machine:
   grassdata_dir = "/opt/grassdata"                                                                                                                                                          
   host.vm.synced_folder grassdata_dir, "/home/vagrant/grassdata"  
Then reload your virtual machine to reflect the synced GRASS data directory:
 $ vagrant reload
1b) copy your grassdata from local to virtual machine:
 $ scp -r -F ssh-config /opt/grassdata grass-gis-vagrant:
1c) download on virtual machine sample grassdata from Internet:
$ vagrant ssh
# mkdir grassdata 
# wget https://grass.osgeo.org/sampledata/north_carolina/nc_spm_08_grass7.tar.gz
# tar xzf nc_spm_08_grass7.tar.gz

2) start GRASS from virtual machine

$ vagrant ssh
# grass71

3) To halt running virtual machine type:

$ vagrant halt

How to update GRASS installation

First of all, update GRASS source code from SVN:

$ svn up

To update your GRASS installation in vagrant (make && make install):

$ vagrant provision

If you want to re-compile GRASS from scratch (make distclean && configure && make && make install) you need to destroy your virtual machine and create new one:

$ vagrant destroy -f && vagrant up

Notes

  • You can specify different image before creating a new virtual machine in Vagrantfile (default is Ubuntu 14.04 LTS 64bit):
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"