Vbox update authored by Igor Semeniouk's avatar Igor Semeniouk
VirtualBox Ubuntu 20.04 VM # Gean4 Virtual Machine
\ No newline at end of file
For this tutorial we prepare virtual machines with preinstalled Geant4 and Root. We have created [VirtualBox](https://www.virtualbox.org) VM running Ubuntu 20.04 Server.
If you planed to run VirtualBox in Windows look into [Installation on Windows](Win10 Installation) before you start.
## Ubuntu 20.04 LTS Virtual Machine
* Ubuntu 20.04 LTS Server installation.
* 2 Gb of memory, 40 Gb disk, nat network.
* OpenSSH-server running.
* Geant4 10.6.2 and Root 6.22/02 preinstalled.
* build-essential, curl, gnu g++, git and cmake packages.
The file _g4vm-ubuntu-20.ova_ for VirtualBox
can be downloaded from LLR owncloud server, following above link:
https://llrbox.in2p3.fr/owncloud/index.php/s/V2ESxh1Wrc74Czt
You can open this link in browser or use _curl_ or _wget_ with direct download link
https://llrbox.in2p3.fr/owncloud/index.php/s/V2ESxh1Wrc74Czt/download
This is full virtual machine imported from VirtualBox running on Ubuntu 18.04 nn OVF 2.0 format. Open Virtualization Format (OVF) is a packaging format for virtual appliances.
## VirtualBox installation
You will need Oracle VirtualBox application run this virtual machine.
You can download VirtualBox for you software platform
from https://www.virtualbox.org . It can run on must Linux distributions, MacOS and Windows.
If you want to install Oracle VM VirtualBox Extension Pack read
VirtualBox Personal Use and Evaluation License (PUEL).
You can found more information in VirtualBox User Manual.
https://www.virtualbox.org/manual/UserManual.html
## Installation g4vm guest into VirtualBox
You can import .ova file using VirtualBox Gui:
1. Open Virtualbox and go to _File_ | _Import Appliance_.
Browse the .ovf file you just downloaded.
2. In the next window, you can see the virtual machine settings. You may change some settings here. For example you may want to allocate more RAM
3. Click _Import_ to start the import process. In few minutes, Virtualbox will create a new virtual machine with the settings you specified
From command line you can use command for import:
`$ VBoxManage import g4vm-ubuntu-20.ova`
## More VM customisation
You can use VirtualBox Gui to make additional modifications in VM
You can add disk, shared points, network interfaces, etc selection
The machine in left side of gui window and pressing <Settings> button.
You also can use `VBoxManage modifyvm ...` command to change VM settings.
## Running installed Geant4 VM
The machine was installed with help of HashiCorp Vagrant application https://www.vagrantup.com/ . The vagrant box _ubuntu/focal64_ used as base of this server.
Machine prepared to run as headless server, no Gui installed.
You can run machine from terminal
`$ VBoxManager stratum g4vm-ubuntu-20 -type headless`
and login to VM with ssh:
`ssh -X -p 2222 vagrant@localhost` .
On MacOS you need use -Y because xauth not present
`ssh -Y -p 2222 vagrant@localhost` .
Only one user defined on machine `vagrant` with _vagrant_ as password.
To avoid clashes with ssh server on host machine, ssh port (22) of virtual
machine was remapped to local port 2222 on host machine.
You can start vm from VirtualBox Gui , but you will see only terminal prompt and you will not able to run X11 applications.
If you want install X11 desktop you need use the command `tasksel`.
Without parameters `tassel` show list of tasks in curses windows and allow you select tasks to execute.
You can also use `tassel --list-tasks` to see list.
I tested gnome desktop installation with command:
`sudo tassel install ubuntu-desktop-minimal`
Now you you reboot the machine you will see virtual machine windoww ith gnome chooser.
## Tests
In vagrant home directory you can see the file _setup_env.sh_,
You need source this file before starting wot with Geant4 or root.
`. setup_env.sh`
You can look into [Installation Ubuntu 20.04](Ubuntu Installation) to see haw you can test Geant4 and Root.
## Tips
- ubuntu
-- use _sudo_ to run commands as root user, `sudo -I` start root login shell.
-- use `apt update`; `apt upgrade` before installing additional software.
-- you can use the command user add to add new user to vm.
e.g. I add my account executing following command as root ( sudo -i )
```
useradd -m -N -c "Igor Semeniouk" semenjuk
usermod -G adm,cdrom,sudo,dip,plugdev,netdev semenjuk
usermod -s /bin/bash semenjuk
passwd semenjuk
```
- geant4
- you check the geant4 datasets installations using command:
`geant4-config --check-datasets`
- `geant4-config --help` also show geant4 features ( configuration options )
Visit geant4 installation Gide for info:
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
- zsh
- if you use zsh you need use .zprofile on place of .bash_profile
- use *source* not a *.* to source setup scripts