{"id":520,"date":"2019-06-21T12:19:33","date_gmt":"2019-06-21T11:19:33","guid":{"rendered":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/?page_id=520"},"modified":"2019-10-04T14:32:12","modified_gmt":"2019-10-04T13:32:12","slug":"fluka-and-flair-on-windows-10","status":"publish","type":"page","link":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/fluka-and-flair-on-windows-10\/","title":{"rendered":"FLUKA and flair on Windows 10"},"content":{"rendered":"\n<p>FLUKA and flair can be run on a recent installation of Windows 10 using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/wsl\/about\">Windows Subsystem for Linux<\/a>. This document describes the installation process as of October 2019.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Obtaining FLUKA and Flair<\/h2>\n\n\n\n<p>You can download FLUKA from <a href=\"http:\/\/www.fluka.org\">http:\/\/www.fluka.org<\/a> after registering as a user. Several packages are available; you should download a 64-bit Linux package built with a version of gfortran that is as close as possible to the one we&#8217;ll be using. We&#8217;ll use gfortran-8 so, at the time of writing, the closest match was fluka2011.2x-linux-gfor64bit-8.3-AA.tar.gz.<\/p>\n\n\n\n<p>Flair can be downloaded from <a href=\"http:\/\/www.fluka.org\/flair\/download.html\">http:\/\/www.fluka.org\/flair\/download.html<\/a>. You should download the deb packages which are suitable for installation on 64-bit Ubuntu. At the time of writing, these were flair_2.3-0_all.deb and flair-geoviewer_2.3-0_amd64.deb.<\/p>\n\n\n\n<p>In some of the commands that follow, we assume that the three packages referred to above have been downloaded to the directory \\Users\\abc\\Downloads. When executing the commands, you should amend the directory and file names to reflect your own downloads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Ubuntu 18.04 LTS on Windows<\/h2>\n\n\n\n<p>In the Microsoft Store, search for &#8220;Ubuntu 18.04 LTS&#8221; and install the app. Once installed, launch the app from the Windows Start Menu. After some set up time, you will be prompted to create a UNIX user account. Choose a simple (one word) username and a password. You&#8217;ll need this password when executing commands which need admin access. (These commands are prefixed with <strong>sudo<\/strong>.) The Ubuntu app gives you access to a largely self-contained Linux system running within Windows. It has access to your Windows files. For example, our download directory is available at \/mnt\/c\/Users\/abc\/Downloads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing FLUKA in the Ubuntu app<\/h2>\n\n\n\n<p>You&#8217;ll need to run these commands in the window that opens on launching the Ubuntu app. First we&#8217;ll install some necessary software, and any updates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo DEBIAN_FRONTEND=noninteractive apt upgrade -y\nsudo DEBIAN_FRONTEND=noninteractive apt install -y gcc gfortran-8 make<\/code><\/pre>\n\n\n\n<p>We&#8217;ll add some commands to the startup script ~\/.bashrc to configure our environment. (See the FLUKA README for the use of FLUPRO, FLUFOR and GFORFLU.)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat &gt;&gt;~\/.bashrc &lt;&lt;EOF\numask 022\nexport DISPLAY=:0\nexport FLUPRO=~\/fluka\nexport FLUFOR=gfortran\nexport GFORFLU=gfortran-8\nEOF<\/code><\/pre>\n\n\n\n<p>We source the startup script to get this configuration. Subsequent launches of the Ubuntu app will do this by default. We then make a directory to hold the FLUKA files, extract our downloaded package to it, and build the code. (Remember to modify the path to the download if necessary.)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/.bashrc\nmkdir $FLUPRO\ncd $FLUPRO\ntar xvf \/mnt\/c\/Users\/abc\/Downloads\/fluka2011.2x-linux-gfor64bit-8.3-AA.tar.gz\nmake<\/code><\/pre>\n\n\n\n<p>If this completes without errors, FLUKA is ready to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing flair in the Ubuntu app<\/h2>\n\n\n\n<p>Flair is installed from the downloaded deb packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo DEBIAN_FRONTEND=noninteractive apt install -y \/mnt\/c\/Users\/abc\/Downloads\/{flair_2.3-0_all.deb,flair-geoviewer_2.3-0_amd64.deb}<\/code><\/pre>\n\n\n\n<p>As a graphical application, it needs access to an X server to run. Recently configured school machines have an X server (Xming) already installed. On other machines you may need to install one. You&#8217;ll need to make sure that the X server is running before starting flair. The DISPLAY environment variable also needs to be correctly set in Ubuntu; this should be working if you followed the instructions for ~\/.bashrc above. If these conditions are met, running the command <strong>flair<\/strong> in the Ubuntu app should start a new window with the application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Running flair from a Windows script<\/h2>\n\n\n\n<p>For convenience, you may create a script to run flair without going via a command window. Add the following to a file called flair.vbs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set objShell = CreateObject(\"Wscript.Shell\")\nobjShell.CurrentDirectory = objShell.ExpandEnvironmentStrings(\"%USERPROFILE%\")\nobjShell.Run \"ubuntu1804.exe run bash -ic flair\", 0, False<\/code><\/pre>\n\n\n\n<p>Clicking on this script should launch flair. (Remember that the X server must be running before starting flair.)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A note on storing files<\/h2>\n\n\n\n<p>You can choose to keep your input and output files in the Windows filesystem and operate on them via the \/mnt\/ path in the Ubuntu app. This may make management and backup easier. Some Linux applications have problems with files in the Windows filesystem, but FLUKA and flair seem to be unaffected.<\/p>\n\n\n\n<p>If you need to transfer files from the Windows filesystem to Linux, always do the transfer from inside the Ubuntu app, using Linux tools like cp. See <a href=\"https:\/\/blogs.msdn.microsoft.com\/commandline\/2016\/11\/17\/do-not-change-linux-files-using-windows-apps-and-tools\/\">https:\/\/blogs.msdn.microsoft.com\/commandline\/2016\/11\/17\/do-not-change-linux-files-using-windows-apps-and-tools\/<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>FLUKA and flair can be run on a recent installation of Windows 10 using the Windows Subsystem for Linux. This document describes the installation process as of October 2019. Obtaining FLUKA and Flair You can download FLUKA from http:\/\/www.fluka.org after &hellip; <a href=\"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/fluka-and-flair-on-windows-10\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":84,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-520","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/Pa93hP-8o","_links":{"self":[{"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/pages\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/users\/84"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":19,"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/pages\/520\/revisions"}],"predecessor-version":[{"id":605,"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/pages\/520\/revisions\/605"}],"wp:attachment":[{"href":"https:\/\/blogs.qub.ac.uk\/screenshotsfromtheedge\/wp-json\/wp\/v2\/media?parent=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}