-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadMe.txt
217 lines (146 loc) · 4.53 KB
/
ReadMe.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
A. Basic:
1. sudo apt install python
2. sudo apt install python-dev
3. sudo apt install python-pip
B. GDAL:
4. pip install numpy
5. pip install scipy
6. pip install pipenv
7. sudo add-apt-repository ppa:ubuntugis/ppa
8. sudo apt update
9. sudo apt install gdal-bin python-gdal
10 verify:
a. open python shell
b. import osgeo.gdal
c. osgeo.gdal.VersionInfo()
d. osgeo.gdal.__version__
C. Apache2:
11. sudo apt install apache2
12. sudo ufw enable
13. sudo ufw app list
14. sudo ufw allow 'Apache'
15. sudo ufw status
16. sudo systemctl status apache2
17. http://localhost
D. GRASS:
18. sudo apt install grass
19. sudo nano ~/.bashrc
20. add following lines:
export GISBASE="/usr/lib/grass74"
export PATH="$PATH:$GISBASE/bin:$GISBASE/scripts:$GISBASE/lib"
export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/"
export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/grass"
export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/grass/script"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GISBASE/lib"
export GIS_LOCK=$$
export GISRC="$HOME/.grassrc7"
21. source ~/.bashrc
E. mod-wsgi:
22. sudo apt-get install libapache2-mod-wsgi
23. sudo a2enmod wsgi
24. sudo systemctl restart apache2
25. sudo nano /etc/apache2/conf-available/wsgi.conf :-
WSGIScriptAlias /test_wsgi /var/www/html/test_wsgi.py
26. sudo nano /var/www/html/test_wsgi.py :-
def application(environ,start_response):
status = '200 OK'
html = '<html>\n' \
'<body>\n' \
'<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">\n' \
'mod_wsgi Test Page\n' \
'</div>\n' \
'</body>\n' \
'</html>\n'
response_header = [('Content-type','text/html')]
start_response(status,response_header)
return [html]
27. sudo a2enconf wsgi
28. sudo systemctl restart apache2
29. http://localhost/test_wsgi
F. pywps:
30. pip install pywps
31. sudo nano /etc/apache2/sites-available/pywps.conf
32. add the following lines:
# PyWPS
WSGIDaemonProcess pywps home=/var/www/html/wsgi user=www-data group=www-data processes=2 threads=5
WSGIScriptAlias /pywps /var/www/html/wsgi/pywps.wsgi process-group=pywps
<Directory /var/www/html/wsgi/>
WSGIScriptReloading On
WSGIProcessGroup pywps
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
33. sudo nano /var/www/html/wsgi/pywps.wsgi
34. add the following lines:
#!/usr/bin/python2
from pywps.app.Service import Service
import sys
import os
sys.path.append("/var/www/html/")
# processes need to be installed in PYTHON_PATH
from processes.sayhello import SayHello
processes = [
SayHello()
]
application = Service(
processes,
['pywps.cfg']
)
35. sudo nano /var/www/html/pywps.cfg
36. add the following lines:
[server]
maxsingleinputsize=1mb
maxrequestsize=3mb
url=http://localhost:80/pywps
outputurl=http://localhost:80/outputs/
outputpath=outputs
workdir=workdir
maxprocesses=10
parallelprocesses=2
[processing]
mode=default
[logging]
level=INFO
file=logs/pywps.log
database=sqlite:///logs/pywps-logs.sqlite3
[grass]
gisbase=/usr/lib/grass74/
37. sudo nano /var/www/html/processes/sayhello.py
38. add the following lines:
from pywps import Process, LiteralInput, LiteralOutput, UOM
class SayHello(Process):
def __init__(self):
inputs = [LiteralInput('name', 'Input name', data_type='string')]
outputs = [LiteralOutput('response',
'Output response', data_type='string')]
super(SayHello, self).__init__(
self._handler,
identifier='say_hello',
title='Process Say Hello',
abstract='Returns a literal string output\
with Hello plus the inputed name',
version='1.3.3.7',
inputs=inputs,
outputs=outputs,
store_supported=True,
status_supported=True
)
def _handler(self, request, response):
response.outputs['response'].data = 'Hello ' + \
request.inputs['name'][0].data
response.outputs['response'].uom = UOM('unity')
return response
39. sudo nano /var/www/html/processes/__init__.py
#this file is empty
40. sudo nano /var/www/html/logs/pywps.log
#this file is empty
41. sudo mkdir /var/www/html/outputs
42. sudo mkdir /var/www/html/workdir
43. sudo chmod -R 777 /var/www/
44. sudo a2ensite pywps
45. sudo systemctl restart apache2
G. set proper permissions to /var/www:
46. sudo chgrp www-data /var/www
47. sudo chmod 775 /var/www
48. sudo chmod g+s /var/www
49. sudo usermod -a -G www-data [YOURUSERNAME]