-
Notifications
You must be signed in to change notification settings - Fork 146
Install EGSnrc on Windows with WSL
EGSnrc can be installed in its native GNU/Linux environment via the Windows Subsystem for Linux (WSL) on Windows 10 or Windows Server 1709 and later. WSL lets developers run a native Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a virtual machine.
WSL requires fewer resources (CPU, memory, and storage) than a full virtual machine. WSL also allows you to run Linux command-line tools and apps alongside your Windows command-line, desktop and store apps, and to access your Windows files from within Linux. This enables you to use Windows apps and Linux command-line tools on the same set of files if you wish.
This EGSnrc installation method affords many advantages:
- quickly install EGSnrc in a fail-safe way
- dodge installation issues on macOS or Windows
- enjoy a consistent EGSnrc experience across different computing platforms
- shelter your working copy against changes in the host OS
- install on a system with limited administration rights
- practice before installing on your main Linux system
The following instructions will guide you through the required steps to get EGSnrc running on WSL.
Installing EGSnrc in a WSL Linux system involves 3 steps:
- Enable WSL
- Install an available Linux distribution
- Install EGSnrc
Apart from the time required to download files, the entire installation process takes about 20 minutes on a modern computer.
Before you can run Linux distros on Windows, you must enable the "Windows Subsystem for Linux" optional feature for Windows 10 or Windows Server and reboot when prompted. This reboot is required in order to ensure that WSL can initiate a trusted execution environment.
Follow the specific installation instructions for Windows 10 or Windows Server.
At this point you have a basic Linux system, and you can follow the instructions to Install EGSnrc on Linux as usual. For completeness we provide below detailed step for quick installation on an Ubuntu base system.
-
Open a terminal (
Ctrl
+Alt
+T
) and issue the following commands to install the pre-requisite software, and some optional ones:sudo apt -y install git gcc gfortran make tk expect sudo apt -y install libmotif-dev qt5-default sudo apt -y install imagej kate
-
Clone the EGSnrc repository and checkout the
develop
branch, with the following commands:git clone https://github.com/nrc-cnrc/EGSnrc.git cd EGSnrc git checkout develop
-
Configure EGSnrc on your machine, using the default options, with the command:
HEN_HOUSE/scripts/configure.expect linux.conf 1
For a faster installation, you can skip the compilation of all EGSnrc applications by entering a
3
instead of1
in the command above, and compile any individual application you want to use later on by going to the application directory and issuing themake
command. If you want to enter different configuration options interactively, runHEN_HOUSE/scripts/configure
instead. -
Important: edit the text file
.bashrc
in your home directory to add the 3 configuration text lines specified at the end of the configuration script (for editing you can useApplication menu > Accessories > FeatherPad
, orKate
):export EGS_HOME=~/EGSnrc/egs_home/ export EGS_CONFIG=~/HEN_HOUSE/specs/linux.conf source ~/EGSnrc/HEN_HOUSE/scripts/egsnrc_bashrc_additions
Close the terminal window, and open a new one (
Ctrl
+Alt
+T
) to ensure that the definitions above are loaded. You can verify that is the case withecho $EGS_HOME
, which should return the string/home/yourname/EGSnrc/egs_home/
(whereyourname
is your chosen login name). -
Compile the EGSnrc gui applications: issue the following commands in the terminal (takes a while, and don't worry about compiler warnings):
export QTDIR=/usr/lib/qt5 (Lubuntu) export QTDIR=/usr/lib/x86_64-linux-gnu/qt5/ (Ubuntu) cd ~/EGSnrc/HEN_HOUSE/gui/ && make --quiet --print-directory cd ~/EGSnrc/HEN_HOUSE/egs++/view/ && make --quiet --print-directory cd ~/EGSnrc
-
To run GUIs from bash
-
Set environment variable DISPLAY temporarily by issuing the command
export DISPLAY=:0
or add the above line to your .bashrc file for a permanent definition
-
To access same EGSnrc repository on Windows and Linux
Create symbolic link `/home/your_user_name/EGSnrc -> /mnt/c/users/your_user_name/EGSnrc`
-
Run a sample
egs_app
simulation of a 20 MeV electron pencil beam impinging on a 1 cm thick water slab, and display the geometry and some particle tracks with theegs_view
utility:cd ~/EGSnrc/egs_home/egs_app make egs_app -i slab.egsinp egs_view slab.egsinp slab.ptracks
- Overview
- Install on VirtualBox
- Install on Linux
- Install on macOS
- Install on Windows
- Quick installation
- Upgrading