FLUKA-Cern的安装(windows 7 vagrant)
作者:互联网
FLUKA-Cern的安装
因为有几台window7的电脑,所以采用了这个方法。
一、Linux虚拟系统的安装 (Vagrant)
因为是在Windows 7系统中安装,没有Windows10的Subsystem Ubantu,需要安装Virtual system Vagrant,安装过程可参考Fluka-Cern官方网站
https://fluka.cern/documentation/installation/fluka-flair-windows-vagrant
- Download Vagrant
Download Vagrant from https://www.vagrantup.com/and install it. After the installation restart Windows.
1.1. Install Guest Addtion Plugin for Vagrant
Run the following command in a command prompt to install the Guest Addtion Plugin for Vagrant:
vagrant plugin install vagrant-vbguest
1.2. VirtualBox
Download VirtualBox from virtualbox.org and install it.
1.3. Xming
Xming X Server for Windows is necessary to visualize the Flair’s graphical interface.
Download and install the Public Domain Release version from
http://www.straightrunning.com/XmingNotes
需要下载Xming-fonts和Xming - Setting up and using the virtual machine
2.1. Configuration file
Download the configuration files from here, and extract it. It contains the Vagrantfile storing the configuration of the virtual machine and a FLUKA folder.
https://github.com/horvathd/cern_fluka_vagrant/archive/master.zip
Configuration files was stored at the Github.com(但是被墙了,想办法连接).
Solution for github: https://blog.csdn.net/weixin_44455388/article/details/106915788
Vagrantfile 已经下载,在Fluka安装文件夹中,文件名cern_fluka_vagrant-master
2.2. Start a Command Prompt
Start a Command Prompt as Administrator, and change to the folder where the Vagrantfile is located.
提示:后续fluka都会安装在这个文件夹下,所以最好是选择根文件夹
Vagrantfile文件内容是将所有的vagrant包括virtualbox的配置都打包好了,所以fluka-cern的安装特别省心。vagrantfile文件内容如下:
![![在这里插入图片描述](https://www.icode9.com/i/ll/?i=20210513184709796.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjI5MDMyMg==,size_16,color_FFFFFF,t_70]
vagrantfile文件中config的内容的意思可以从网络上查找到,这里不再解释
2.3. Start the virtual machine
Simply use the command:
vagrant up
运行中提示:
解决方案:
https://blog.csdn.net/weixin_33775572/article/details/85977699?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-7.control&dist_request_id=1328665.20143.16160481740555695&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-7.control
win7内置的powershell 2.0已经落伍,需要进行更新。所有更新文件保存在安装文件夹中。
安装Microsoft .NET Framework 4.0的完整安装版本(dotNetFx40_Full_x86_x64.exe),或者,安装Microsoft .NET Framework 4.5的完整安装版本(dotNetFx45_Full_x86_x64.exe)。
安装Windows Management Framework 3.0的6.1内核版本安装文件(Windows6.1-KB2506143-x64.msu)。
验证Windows PowerShell 3.0 是否已安装成功。
Get-Host | Select-Object Version
powershell 更新以后再运行
Vagrant up
新问题
这是因为没有配置virtualbox的环境变量,具体配置方法如下:
在oralcle virtualbox属性里找到virtualbox的安装路径,如下图,复制起始位置
然后我的电脑打开属性-高级系统设置-环境变量-path-添加路径
终于成功,box下载中
安装过程因为要下载box文件会需要一点时间
PS:box文件是vagrant中已经配置好的环境。读取了vagrantfile以后发现FLUKA安装使用的是ubuntu/bionic64,也就是linux的ubuntu。
The first time you run, vagrant will download and configure the base for the virtual machine, which could take some time. Later the start should take around 20 seconds only.
If there is an error with the shared folder due to the missing VirtualBox Guest Additions, run the following command:
vagrant provision && vagrant vbguest && vagrant reload
2.4. Start Xming
Start the Xming app from the Start Menu.
2.5. Connect to the virtual machine
To connect use the command:
vagrant ssh
When you see the following words prompt, the virtual machine is ready to use.
vagrant@fluka:~$
(终于见到这行子了,大功告成,心情激动,撒花❀)
vagrant安装完成
2.6. Shared folder
In the Windows machine the FLUKA folder next to the Vagrantfile is automatically shared with the virtual machine at /fluka directory. 挂载的命令为:
sudo mount –t vboxsf Fluka share
笔者在使用过程中发现,每次笔记本/电脑重启以后,都需要从启动VM machine开始的命令重来一遍。或者Windows下启动VM,连接Fluka账户。然后才可以vagrant ssh,重新挂载共享文件夹。
2.7. Log out fron the virtual machine
Use the command.
logout
2.8. Stopping the virtual machine
the command will shut down the virtual machine
vagrant halt
2.9. Deleting the virtual machine
In case you don’t need the virtual machine any more, or you want to restart from a clean state, you can delete the virtual machine with the command. The shared folder on Windows won’t be deleted.
vagrant destroy
在SPHIC的office笔记本上安装目录在E:\Fluka_cern\ 下面,以下的命令也必须在这个目录下执行。Fluka也在这个目录下运行
二、FLUKA软件的安装
1.共享文件夹设置
使用vagrantfile已经在virtualbox中设置好共享文件夹位置
但是还要与使用账户中文件夹进行关联,操作如下:
在vagrant@fluka账号下建立共享文件夹:
mkdir share
(考虑是否直接把fluka账号这个文件夹给共享了,因为发现第一次在share中安装以后,只有在share文件夹里面才可以运行rfluka,当然也可能因为没有设置全局的环境变量)
共享文件夹设置命令 (其中Fluka是windows中文件夹的名字,share是账号下设置的文件夹名字)
sudo mount –t vboxsf Fluka share
检查文件夹内容,是否设置成功
Mount挂载的方法 在机器重启以后会失效 需要重新输入命令挂载。
2. Setting up Ubuntu and install Flair
Download the setup_wsl.sh script from here
(Right click, save link as …). In the Ubuntu terminal change the directory to the downloaded script and run the following command:
sudo ./setup_wsl.sh
The script will install the necessary packages and Flair.
3. Installing FLUKA using .deb files (fluka_…-Linux-gforXX_amd64.deb)
As superuser, type the following to install FLUKA:
vagrant@fluka~: sudo dpkg -i fluka-…-gforXX_amd64.deb
Like for .rpms, this creates the default FLUKA executables (fluka and flukadpm) and the auxiliary programs in the directory /usr/local/fluka/bin, which will be added automatically to the PATH environment variable. Note that PATH is not updated in the present terminal session, but a new shell needs to be launched.
重启ubuntu
flair和FLUKA都是安装在/usr/local目录下
4. 设置环境变量
The commands for setting environment variables differ for different shells. For bash shells, type:
export PATH=/pathtofluka/bin:$PATH (哈哈 pathtofluka应该是fluka安装的位置,比如在SPHIC office中应该是/home/)
source ~/.bashrc
5. 测试运行FLUKA和flair
拷贝example.inp文件到FLUKA的安装文件夹
cp /usr/local/fluka/bin/example/example.inp ./share/
直接在安装FLUKA的文件夹中运行输入命令,如下图
rfluka –M 5 example.inp
以下提示运行成功
运行flair,则直接type就好,如下运行成功
标签:FLUKA,Cern,vagrant,machine,windows,文件夹,fluka,安装 来源: https://blog.csdn.net/weixin_42290322/article/details/116761216