{"id":294,"date":"2015-10-30T07:59:20","date_gmt":"2015-10-30T07:59:20","guid":{"rendered":"http:\/\/95.85.43.55\/?page_id=294"},"modified":"2018-01-15T07:37:27","modified_gmt":"2018-01-15T07:37:27","slug":"running-flow-in-a-virtual-machine","status":"publish","type":"page","link":"https:\/\/opm-project.org\/?page_id=294","title":{"rendered":"Running Flow in a virtual machine"},"content":{"rendered":"<p>OPM targets the Linux platform, but that does not prevent you from experimenting with OPM in a Windows, OS X, or other\u00a0environment.<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/resinsight.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-317 size-full\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/resinsight.png\" alt=\"virtualbox_resinsight\" width=\"1016\" height=\"849\" \/><\/a><\/p>\n<p>This page will lead you through installing all prerequisites\u00a0and Flow in a virtual\u00a0environment. The recipe is made for Windows users, but\u00a0the exact same steps can be retraced on other platforms, such as Linux and OS X installations.<\/p>\n<p>The benefit of using a virtual environment is that you can try out Flow\u00a0in a safe environment without affecting the rest of your computer. If you don&#8217;t like it, it&#8217;s really easy to remove.<\/p>\n<p><!--nextpage--><\/p>\n<h4>Installing prerequisites<\/h4>\n<p>There is a so-called vagrant file that is capable of automatically setting up a virtual environment available, but to make use of this file we first need to install Vagrant and some other prerequisites.<\/p>\n<h6>Vagrant<\/h6>\n<p>Open <a href=\"https:\/\/www.vagrantup.com\/\">https:\/\/www.vagrantup.com\/<\/a>, download the most recent version of Vagrant, and install it.<\/p>\n<p>On some linux distributions you can also get Vagrant through your package handler. For example on Ubuntu you should be able to type<\/p>\n<pre><code>sudo apt-get install vagrant\r\n<\/code><\/pre>\n<p>to get started.<\/p>\n<h6>Secure shell<\/h6>\n<p>On Windows, we also need to install some\u00a0Linux tools, more specifically a secure shell client (SSH). The simplest way to do this is to install Git for Windows, which you can download and install from\u00a0<a href=\"https:\/\/git-scm.com\/download\/win\">https:\/\/git-scm.com\/download\/win<\/a>.<\/p>\n<p>This will enable us to quickly enter the virtual box using command line tools.<\/p>\n<p>On Linux, this should be installed already by your package manager.<\/p>\n<h6>Virtualbox<\/h6>\n<p>Vagrant uses a virtual machine behind the scenes, and the OPM vagrant file is based upon Virtualbox. Download and install Virtualbox from its webpages,\u00a0<a href=\"https:\/\/www.virtualbox.org\/\">https:\/\/www.virtualbox.org\/<\/a>.<\/p>\n<p>On Linux, this should be installed already by your package manager.<\/p>\n<p><em>Tip<\/em>: you might need to enable VT-X in your BIOS, and you might need to turn off Hyper-V in Windows.<\/p>\n<p><em>Note: You may\u00a0 need to use the 5.1 version or less of VirtualBox to make it work with the most recent version of Vagrant.\u00a0\u00a0<\/em><em>https:\/\/www.virtualbox.org\/wiki\/Download_Old_Builds_5_1<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><!--nextpage--><\/p>\n<h4>Downloading vagrant file<\/h4>\n<p>With all of the prerequisites installed, we can download the configuration file that will setup the virtual environment for you.<\/p>\n<p>The easiest way of acquiring the configuration file is to download it as a zip-file from<\/p>\n<p>https:\/\/github.com\/OPM\/opm-utilities\/archive\/master.zip<\/p>\n<p>After you have downloaded the zip-file, unzip it to a location of your choice. In the rest of this tutorial, we assume that you have unzipped it into your download directory,<\/p>\n<pre><code>C:\\users\\&lt;YOUR-USERNAME&gt;\\Downloads\\opm-utilities-master\r\n<\/code><\/pre>\n<p>If you prefer to use Git, you can alternatively\u00a0clone the repository using<\/p>\n<pre><code>git clone https:\/\/github.com\/OPM\/opm-utilities.git\r\n<\/code><\/pre>\n<p><!--nextpage--><\/p>\n<h4>Setting up your virtual machine<\/h4>\n<p>Once you have downloaded and unzipped the opm-utilities repository, go to the &#8220;vagrant_opm_user&#8221; folder in Windows Explorer and select &#8220;Git Bash&#8221;. On Linux or macOS, open a terminal window and cd to the folder.<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/git_bash_cmd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-447\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/git_bash_cmd.png\" alt=\"git_bash_cmd\" width=\"694\" height=\"811\" \/><\/a><br \/>\nNow, we are ready to setup the virtual machine. In the same command window, simply enter the command<\/p>\n<pre><code>vagrant up<\/code><\/pre>\n<p>and Vagrant will download the correct virtual machine image, and set up your machine. This process will take some time, especially on a slow internet connection. At the end, you should have a command window similar to the image below.<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2016\/10\/vagrant_cmd_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-739 size-full\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2016\/10\/vagrant_cmd_1.png\" alt=\"\" width=\"765\" height=\"432\" \/><\/a><\/p>\n<p><!--nextpage--><\/p>\n<h4>Running Flow in the virtual machine<\/h4>\n<p>Vagrant has so far set up your virtual machine, and automatically installed Flow. To run flow, we now need to enter the virtual machine, and run our commands from there. To get started, enter the command<\/p>\n<pre><code>vagrant ssh<\/code><\/pre>\n<p>from the same directory you ran vagrant up.\u00a0After having entered this command, you are inside the virtual Linux environment.<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/vagrant_cmd_31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-741 size-full\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/vagrant_cmd_31.png\" alt=\"\" width=\"765\" height=\"432\" \/><\/a><\/p>\n<p>You are now ready to run a Flow simulation.\u00a0Now, go through\u00a0<a href=\"\/\/opm-project.org\/?page_id=197\" target=\"_blank\">My First Reservoir Simulation<\/a>\u00a0to run your first simulation. You can safely skip installing the prerequisites, since these have been automatically set up for you by Vagrant, so you may start with <a href=\"\/\/opm-project.org\/?page_id=197&amp;page=3\">step 3<\/a> of that tutorial.<\/p>\n<p>Once you have run your first simulation, move on to see how you can examine the results in your host (Windows) environment.<\/p>\n<h4><!--nextpage--><\/h4>\n<h4>Getting\u00a0results to\u00a0Windows<\/h4>\n<p>Because the virtual machine\u00a0has its own virtual disk, the results are not immediately available in your host environment (Windows). However, there is one common shared directory. On your host side, it will be<\/p>\n<pre><code>C:\\&lt;YOUR-USERNAME&gt;\\Downloads\\opm-utilities-master\\<\/code><\/pre>\n<p>and on the\u00a0virtual machine side (Linux), it will be<\/p>\n<pre><code>\/host\/<\/code><\/pre>\n<p>You can see that the contents on the host and virtual side are the same by using the<\/p>\n<pre><code>dir<\/code><\/pre>\n<p>command on windows, or<\/p>\n<pre><code>ls<\/code><\/pre>\n<p>on linux (the .vagrant directory is hidden in linux. To show it, use ls -l).<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/cmd_4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-313 size-full\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/cmd_4.png\" alt=\"virtualbox_cmd_4\" width=\"685\" height=\"300\" \/><\/a><\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/vagrant_cmd_5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-461\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/vagrant_cmd_5.png\" alt=\"vagrant_cmd_5\" width=\"613\" height=\"336\" \/><\/a><\/p>\n<p>The, to make the simulation results available in Windows, we need to copy them to the \/host\/ directory. You can do this with the following commands:<\/p>\n<pre><code>cp -rv ~\/opm-data-master\/spe1 \/host\/spe1<\/code><\/pre>\n<h4><!--nextpage--><\/h4>\n<h4>Examining results in Windows<\/h4>\n<p>Once the results have been copied to windows, we can examine them with ResInsight. Install ResInsight by downloading the binary release\u00a0from their\u00a0webpage,\u00a0http:\/\/resinsight.org\/.<\/p>\n<p>Then open ResInsight, and select<\/p>\n<pre><code>File-&gt;Import-&gt;Import Eclipse Case\r\n<\/code><\/pre>\n<p>from the menu. Navigate to<\/p>\n<pre><code>C:\\users\\&lt;YOUR-USERNAME&gt;\\Downloads\\opm-utilities-master\\vagrant_opm_user\\spe1\r\n<\/code><\/pre>\n<p>which is the directory with the simulation results. Then open the file<\/p>\n<pre><code>SPE1CASE1.EGRID\r\n<\/code><\/pre>\n<p>You can now examine the results interactively by using your right and left mouse button. A tutorial on using ResInsight is outside the scope here, but you can read the online documentation on the ResInsight webpage,\u00a0http:\/\/resinsight.org\/.<\/p>\n<p><a href=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/resinsight.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-317 size-full\" src=\"\/\/opm-project.org\/wp-content\/uploads\/2015\/10\/resinsight.png\" alt=\"virtualbox_resinsight\" width=\"1016\" height=\"849\" \/><\/a><\/p>\n<h4><!--nextpage--><\/h4>\n<h4>Removing\u00a0the virtual machine<\/h4>\n<p>Throughout\u00a0the process in this tutorial, we have been using a virtual environment, which means that we can easily get rid of it all. The simplest way of deleting all\u00a0the data is to go to<\/p>\n<pre><code>C:\\users\\&lt;YOUR-USERNAME&gt;\\Downloads\\opm-utilities-master\\vagrant_opm_user\r\n<\/code><\/pre>\n<p>in a command window, and then enter the command<\/p>\n<pre><code>vagrant destroy\r\n<\/code><\/pre>\n<p>which will remove <em>everything<\/em> in your virtual machine. If you also want to get rid of the opm-utilities-master directory we created, you can safely delete it. Please note that this of course deletes any simulation results you may have in the directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OPM targets the Linux platform, but that does not prevent you from experimenting with OPM in a Windows, OS X, or other\u00a0environment. This page will lead you through installing all prerequisites\u00a0and Flow in a virtual\u00a0environment. The recipe is made for Windows users, but\u00a0the exact same steps can be retraced on other platforms, such as Linux &hellip; <a href=\"https:\/\/opm-project.org\/?page_id=294\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Running Flow in a virtual machine<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"parent":43,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/pages\/294"}],"collection":[{"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/opm-project.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=294"}],"version-history":[{"count":36,"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/pages\/294\/revisions"}],"predecessor-version":[{"id":1069,"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/pages\/294\/revisions\/1069"}],"up":[{"embeddable":true,"href":"https:\/\/opm-project.org\/index.php?rest_route=\/wp\/v2\/pages\/43"}],"wp:attachment":[{"href":"https:\/\/opm-project.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}