In recent projects, ParaView has been applied. It is necessary to deploy the ParaView web application and display the files in the specified path.
Since ParaView is an open source project, it gives me the impression that it is unpopular! Unpopular! Unpopular! In the process of trying, all the problems can only be solved through the Issue in GitHub (extremely painful). I secretly determined that when I finish, I must summarize the detailed process for everyone's convenience! ! ! !
Windows10
Note: The author used his own machine to put Apache and Paraview in the C: root directory according to the official website (for fear of a moth), but put it in E: when the server was configured, there was no problem, so this article Take C: as an example, everyone can modify it individually.
1. Apache server configuration
1. Download MPI
First go to download Microsoft MPI v10.1.2 , otherwise an error will appear when running paraview as follows:
pvpython.exe - System Error Code execution cannot continue because msmpi.dll could not be found. Reinstalling the program may resolve this issue.
The download process is as follows: After downloading, install it.
2. Download ParaView
Download ParaView , here the author is based on the ParaView-5.2.0-Qt4-OpenGL2-MPI-Windows-64bit.exe version downloaded from the official website, and friends can also install other versions according to your needs.
3. Download Apache Web
Windows does not natively support the Apache web server. To get the Windows installer, you can download the modified server from many third-party vendors, so you need to download the installer that supports Apache Web , I downloaded httpd-2.4.54-win64-vS16.zip
At this point, all preparations are over!
3. Configure Apache httpd server <br>For the explanation of <apache-root> and <paraview-root>, because the author's own machine is placed in C: so
<apache-root> ---> C:\Apache24
<paraview-root>---> C:\ParaView-5.2.0
①Add a virtual machine: configure the <apache-root>\conf\extra\httpd-vhosts.conf file, the content in "{}" needs to be replaced according to your <apache-root> or <paraview-root>
#授予所有访问权限httpd 服务器的目录
<Directory {C:/ParaView-5.2.0}>
Require all granted
</Directory>
#创建一个名为“paraview”的虚拟主机,它将用于将所有流量引导到 ParaView Web
#配置文件不需要带有{},笔者为了让大家清晰的看到哪里需要修改,因此添加了{}
<VirtualHost *:80>
ServerName paraview
ServerAdmin admin@paraview.com
DocumentRoot {C:/ParaView-5.2.0}/share/paraview-5.2/web/visualizer/www
ErrorLog {C:/ParaView-5.2.0}/error.log
CustomLog {C:/ParaView-5.2.0}/log/apache2/access.log combined
<Directory "{C:/ParaView-5.2.0}">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
AllowOverride None
Require all granted
</Directory>
# 处理启动器转发
# 端口和端点应该匹配 launcher.config
ProxyPass /paraview http://localhost:9000/paraview
# 处理 WebSocket 转发
RewriteEngine On
# 这是 Jetty 创建的映射文件的路径
# 代理路径应该匹配 launcher.config
RewriteMap session-to-port txt:{C:/Apache24}/proxy.txt
# 这是重写条件。
# 在 URL 的 # 查询部分中查找带有 sessionId= 的任何内容,并捕获要在下面使用的值。
RewriteCond %{QUERY_STRING} ^sessionId=(.*)&path=(.*)$ [NC]
# 这使用映射文件和 sessionId
RewriteRule ^/proxy.*$ ws://${session-to-port:%1}/%2 [P]
</VirtualHost>
Save the <apache-root>\conf\extra\httpd-vhosts.conf file ②Create a folder: <paraview-root>\log\apache2 (Note: many files you don’t have are log files, don’t worry about them)
②Create proxy.txt: Create an empty file named proxy.txt in the <apache-root> directory
③ Open the <apache-root>\conf\httpd.conf file and enable (uncomment) the following modules
1)Define SRVROOT "c:/Apache24"#这里要更换成你的根目录
2)在#ServerName www.example.com:80下面添加以下内容:
ServerName localhost:80
3)取消以下注释:
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
4. Configure local mapping <br>Because paraview cannot perform domain name resolution, it is necessary to perform ip mapping on the machine that needs to access paraview. The specific steps are as follows:
①Open C:\Windows\System32\drivers\etc
②hosts->right-click->properties->security->open modification, write permissions ③Add the following content to the hosts file:
127.0.0.1 paraview
<your-ip-address> paraview
At this point, the Apache web configuration is all over.
2. Paraview Web configuration
1. Create launcher.config file: Create launcher.config file in <paraview-root>;
Note: It is better to open the Windows file manager file extension
2. Write the launcher.config configuration file you just created:
The content in " " needs to be replaced according to your <apache-root> or <paraview-root>
The configuration file does not need to contain "". In order to let everyone clearly see where to modify, the author added ""
{
"configuration": {
"host" : "localhost",
"port" : 9000,
"endpoint": "paraview",
"content": "《C:/ParaView-5.2.0》/share/paraview-5.2/web/visualizer/www",
"proxy_file" : "《C:/Apache24》/proxy.txt",
"sessionURL" : "ws://paraview:80/proxy?sessionId=${id}&path=ws",
"timeout" : 30,
"log_dir" : "《C:/ParaView-5.2.0》/log/",
"fields" : []
},
"resources" : [ {
"host" : "localhost",
"port_range" : [9001, 9999]
} ],
"properties" : {
"dataDir":"C:/ParaView-5.2.0/data",
"python_exec" : "《C:/ParaView-5.2.0》/bin/pvpython.exe",
"visualizer": "《C:/ParaView-5.2.0》/share/paraview-5.2/web/visualizer/server/pvw-visualizer.py"
},
"apps": {
"visualizer": {
"cmd": [
"${python_exec}", "-dr", "${visualizer}", "--port", "${port}", "--authKey", "${secret}", "--data", "${dataDir}", "--load-file", "${dataFile}"
],
"ready_line" : "Starting factory"
}
}
}
3. Configure <paraview-root>\share\paraview-5.2\web\visualizer\www\index.html file
Here I made a series of changes according to my own needs, because ① the project needs to write the absolute path into the url to access a certain file, and the path format is fixed ② fixed access through Google browser. Therefore, the author configures this file according to his own needs. Those who use the window.location object to process the url can configure it according to the ParaView Window10 deployment official website , or change it according to their own needs.
Attached: The code in the author's index.html file <script></script>!
function getFileToLoad() {
let {search, href} = window.location;
if (search.length === 0) {
return {
dataFile: 'can.ex2',
dataDir: ''
};
}
search = search.replace(/\?/g, '');
let directory = '';
let filename = '';
if (search.lastIndexOf('.') > search.lastIndexOf('\\')) {
let index = search.lastIndexOf(`\\`);
directory = search.slice(0, index);
filename = search.slice(index + 1, search.length);
} else {
directory = search;
filename = 'can.ex2';
}
return {
dataFile: filename,
dataDir: directory
};
};
Visualizer.connect({
application: 'visualizer',
dataFile: getFileToLoad().dataFile,
dataDir: getFileToLoad().dataDir
});
Visualizer.autoStopServer(10);
4. Create a startup paraview batch script file <br>Create a launcher.bat file under <paraview-root> and write the following content:
set PV_HOME=<paraview-root>
%PV_HOME%\bin\pvpython.exe %PV_HOME%\bin\Lib\site-packages\vtk\web\launcher.py %PV_HOME%\launcher.config
3. Start ParaView Web Service
1. Start Apache Web Service: Double-click to run <apache-root>\bin\httpd.exe
2. Start the ParaView Web script file : double-click to run <paraview-root>\launcher.bat
In this process, if it is opened and closed immediately , it means that there is an error in the launcher.bat configuration file. After opening and before closing automatically, click the cmd that he pops up, and he will not close it. Just analyze the reason for the error.
3. Open the browser to visit: Open Google, enter http://paraview/?C: \ParaView-5.2.0\data\can.ex2 to visit
The author here is different from the official website input. As mentioned earlier, the author is the index.html file modified according to the project requirements
Linux (Ubuntu-18.04.6-DeskTop )
Due to some other reasons, Linux is only configured with ParaView for a single user. When it is freed later, it will be supplemented by multi-user configuration.
The author's environment is VMware+Ubuntu-18.04.6-DeskTop, and the process of installing the virtual machine and the Ubuntu operating system will not be described in detail here (I have retained detailed screenshots, and you can leave a message if necessary).
VMware official website download link
Ubuntu-18.04.6-DeskTop official website download link
After the environment is ready, download and deploy ParaView;
ParaView official website download link
Here the author downloads ParaView-5.4.1-Qt5-OpenGL2-MPlI-Linux-64bit.tar.gz . After the download is complete, you can use file transfer software such as VMtools or FileZilla Client to transfer files to the virtual machine.
Note: Be sure not to use the version given by the official website tutorial, there will be problems with that version, and there is no way to solve it! ! !
1. Install ParaView locally
- Unzip ParaView
tar -zxvf ParaView-5.4.1-Qt5-OpenGL2-MPlI-Linux-64bit.tar.gz
Modify the environment variable and type
gedit ~/.bashrc
At the end of the file, add the following sentence#Paraview export PATH=/home/root1/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin:$PATH
Type
source ~/.bashrc
Typeparaview
, the following interface will appear, indicating that ParaView is installed successfully
2. Configure single-user access to ParaView WebConfigure the startup ParaView script file and type
cd ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/
to enter the ParaView root directory
Type the following command to create a startup script filetouch start.sh gedit start.sh
Edit the script file and enter the following content, and save!
./bin/pvpython share/paraview-5.4/web/visualizer/server/pvw-visualizer.py --content ./share/paraview-5.4/web/visualizer/www --data ~/ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/ParaView-v5.4.1 --port 9000
Type
./start.sh
After starting the ParaViewWeb service, enter localhost:9000 in the browser to see the following interface
Since the author has already configured OK, I am not sure whether there will be any other problems.
If you have any questions, please leave a message, I believe it will be easier than clicking on an issue or sending an email to the ParaView maintainer!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。