|
|
# Geant4 Installation on Windows 10 WSL2
|
|
|
# running Ubuntu 20.04 TLS
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
Hire we do not give the instructions for native Geant4 installation with the Visual Studio C++ compiler on Windows.
|
|
|
|
|
|
For this tutorial we install Geant4 in Windows Subsystem for Linux (WSL) machine.
|
|
|
|
|
|
## Installing WSL in Windows 11
|
|
|
|
|
|
We have chosen to install AlmaLinux 9 for our purpose.
|
|
|
|
|
|
1. Visit https://docs.microsoft.com/en-us/windows/wsl/install-win10
|
|
|
for detailed instructions how to enable WSL or WSL 2.
|
|
|
|
|
|
2. Install your Linux distribution, we made the tests with _AlamaLinux 9_
|
|
|
|
|
|
* Open "Microsoft Store" and search AlamaLinux.
|
|
|
|
|
|
* Choose Ubuntu AlamaLinux 9 and install it on the Windows Machine.
|
|
|
|
|
|
* Launch newly installed Linux
|
|
|
|
|
|
* You will then need to create a user account and password for your new Linux distribution
|
|
|
|
|
|
### X11 server for Windows or building WSlg server
|
|
|
|
|
|
The latest evrsion of Windows 10 and Windows 11 has WSLg code
|
|
|
fully integrated to WSL2 , no separate X11 server was nessessaraly.
|
|
|
|
|
|
See: _https://github.com/microsoft/wslg_ for more info
|
|
|
|
|
|
Follow the instruction from this link to use building WSLg server"
|
|
|
_https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps_
|
|
|
|
|
|
But you can configure and use external X11 server with WSL.
|
|
|
|
|
|
There are several servers like Xmind or Cygwin/X
|
|
|
http://www.straightrunning.com/XmingNotes/
|
|
|
https://x.cygwin.com/
|
|
|
|
|
|
We made tests with _XcXsrv_ and AlmaLinux 9 application window
|
|
|
|
|
|
https://sourceforge.net/projects/vcxsrv/
|
|
|
|
|
|
We also tested _Mobaterm MobaXterm_
|
|
|
https://mobaxterm.mobatek.net/
|
|
|
which provides both X11 server and terminal client with ssh.
|
|
|
|
|
|
*N.B. The corresponded driver which support OpenGL should be installed on Windows machine
|
|
|
or you will be not able to use Geant4 graphics.*
|
|
|
|
|
|
#### X11 DISPLAY settings.
|
|
|
|
|
|
After starting X11 server you can use
|
|
|
`export DISPLAY=localhost:0.0` in WSL1,
|
|
|
but in WSL2 microsoft has made a modification in the network which
|
|
|
prevent Windows <-> WSL routing.
|
|
|
The only way is to use the X11 server for Windows : Disable access control in X11 server and use the default router (local IP address of Windows machine) for display settings.
|
|
|
|
|
|
If you use *Xcxsrv* you will see the option Disable access control
|
|
|
when you launch the server using *Xlaunch*, then start *AlamLinux 9* application
|
|
|
|
|
|
In *MobaXterm* go to Setting->X11->X11 remote access and choose "full",
|
|
|
then in Section choose WSL and coose "AlamLinux 9" distribution.
|
|
|
|
|
|
On WSL2 use the command:
|
|
|
`export DISPLAY=`ip route | awk '/default/ {print $3; exit}'`:0.0`
|
|
|
to setup display.
|
|
|
|
|
|
You can do a quick test of *X11* by running `xev` and `glxgear` applications
|
|
|
|
|
|
|
|
|
### Installing Geant4 and Root on WSL
|
|
|
|
|
|
The big advantage of WSL installation, the WSL applications are binary compatible with application which you can run on the same Linux installed on physical computer. You can copy the applications/libraries between physical machines and
|
|
|
wls machines running the same Linux distribution.
|
|
|
|
|
|
You can follow the instructions in the [Install Geant4 on AlamaLinux](Linux Installation/AlmaLinux 9 Installation) section to install Geant4 and ROOT on WLS Ubuntu 20.04.
|
|
|
|
|
|
### Test you installation. ###
|
|
|
|
|
|
To test you installation you can use the procedure described in [Install Geant4 on Ubuntu](Ubuntu Installation).
|
|
|
|
|
|
## Installing and run Geant4 VM in Windows Machine
|
|
|
|
|
|
You can use VirtualBox WM if your Windows 10 version is older
|
|
|
than 1903 or if you do not use Windows Hyper-V or WSL2 on you Widows system.
|
|
|
|
|
|
After the introduction of WSL2 in Windows 10, Version 1903, Build 18362 or higher,
|
|
|
VirtualBox become unstable (memory corruptions, disk IO problems) with WSL (hyper-v)
|
|
|
enabled. In this case you need to use WSL or to create a virtual machine in Windows Hyper-V supervisor. See the next section.
|
|
|
|
|
|
If you choose the VirtualBox VM installation, please follow the instruction in the [VirtualBox VM](VBox Installation) section.
|
|
|
|
|
|
### Windows SSH Clients
|
|
|
|
|
|
To use the ssh connection to VM you need to install an ssh client capable of X11 forwarding like [PuTTY](http://www.putty.org) or to use Windows 10 ssh.
|
|
|
|
|
|
We use ssh from the Windows Git installation.
|
|
|
|
|
|
`ssh -X -p 2222 vagrant@localhost`
|
|
|
|
|
|
You can define the ssh session to localhost port 2222 in **MobaXterm**.
|
|
|
|
|
|
## Installing Geant4 VM on Windows Hyper-V ##
|
|
|
|
|
|
As the Hyper-V is not able to install the .ova machine, you need to convert the .ova disk file to the hyper-v .vhd format. We have tried this way but finished with VM without a network connection,
|
|
|
the network driver in hyper-v and VirtualBox were not the same.
|
|
|
|
|
|
Fortunately Hyper-V Quick Create allows us to create Ubuntu 20.04 VM.
|
|
|
It needs to download 2 Gb os installation image, but you will have a running VM
|
|
|
in a few minutes.
|
|
|
|
|
|
### Enable Hyper-V
|
|
|
|
|
|
Follow the Microsoft instructions to enable Hyper-V
|
|
|
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
|
|
|
|
|
|
### Create Ubuntu 20.04 VM
|
|
|
|
|
|
* Start _Hyper-V Quick Create_ from _"Windows Administrative Tools"_ menu.
|
|
|
|
|
|
* Choose "Ubuntu 20.04 LTS" and click Create Machine.
|
|
|
|
|
|
* Choose "Edit Settings"
|
|
|
|
|
|
* Change name of machine if you want.
|
|
|
|
|
|
* You need disk size >= 20 Gb. You can extend root partition or create second disk and mount it on `/usr/local`
|
|
|
|
|
|
* Click ok to exit setting.
|
|
|
|
|
|
* Run machine with "Connect" and <start>
|
|
|
|
|
|
* Follow setup process
|
|
|
- language
|
|
|
- keyboard - use default or select what you have in Win machine
|
|
|
i use (US, euro on 5)
|
|
|
- Select Paris as timezone
|
|
|
- Crete account
|
|
|
|
|
|
### Install ROOT and Geant4 on Hyper-V VM
|
|
|
|
|
|
* run the machine and *connect* to it login to the machine
|
|
|
|
|
|
* First install sshd server and git on you machine.
|
|
|
```
|
|
|
$ apt update
|
|
|
$ apt upgrade -y
|
|
|
|
|
|
$ apt install -y openssh-server
|
|
|
$ apt install -y git git-man
|
|
|
```
|
|
|
You will also need curl
|
|
|
|
|
|
`$ apt install -y curl`
|
|
|
|
|
|
|
|
|
* When setup has finished, login to the machine and follow the instructions from the [Install Geant4 on Ubuntu](Ubuntu Installation) section to install Geant4 and ROOT.
|
|
|
Use `GIT_SSL_NO_VERIFY=true git clone https://llrgit.in2p3.fr/semenjuk/installg4`
|
|
|
to download installation the scripts.
|
|
|
|
|
|
## Tips ##
|
|
|
|
|
|
- WLS 2
|
|
|
- Use the command
|
|
|
export DISPLAY=`ip route | awk '/default/ {print $3; exit}'`:0.0
|
|
|
to setup display.
|
|
|
|
|
|
- All environment variables related to laguage
|
|
|
(LANGUAGE, LANG, LC_* ) are set to C.UTF-8 in ubuntu wls.
|
|
|
If you see the warnings when connect to another machine via ssh,
|
|
|
use f.e. : export LC_ALL=un_US.UTF-8 TODO
|
|
|
|
|
|
- Geant4
|
|
|
- You check the Geant4 datasets installation using the command:
|
|
|
`geant4-config --check-datasets`
|
|
|
- `geant4-config --help` also shows the Geant4 features (configuration options)
|
|
|
|
|
|
Visit Geant4 installation Guide for more info:
|
|
|
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
|
|
|
- zsh on vm
|
|
|
- If you use zsh you need to use .zprofile instead of .bash_profile
|
|
|
- Use *source* not a *.* to source setup scripts
|
|
|
|
|
|
- Ubuntu Desktop in HyperV run full screen.
|
|
|
|
|
|
Start terminal
|
|
|
|
|
|
- sudo vi /etc/default/grub
|
|
|
|
|
|
- Change the GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” line to GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash video=hyperv_fb:1920x1080”
|
|
|
|
|
|
- sudo update-grub
|
|
|
|
|
|
- Restart your VM
|
|
|
|
|
|
VM will run full screen mode. |