{"id":15753,"date":"2024-01-06T17:55:20","date_gmt":"2024-01-06T08:55:20","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=15753"},"modified":"2024-01-30T06:27:06","modified_gmt":"2024-01-29T21:27:06","slug":"qgis-server%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b%ef%bc%81%ef%bc%88ubuntu-server-22-04%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/15753","title":{"rendered":"QGIS Server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01\uff08Ubuntu Server 22.04\uff09"},"content":{"rendered":"<p>Ubuntu Server 22.04\u306b\u3001QGIS Server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>\u4f7f\u7528\u3059\u308b\u74b0\u5883\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>\u4f7f\u7528\u3059\u308b\u74b0\u5883\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ hostnamectl\r\n Static hostname: vmsgis21\r\n       Icon name: computer-vm\r\n         Chassis: vm\r\n      Machine ID: e18a27fbe8ac4dbcb89641f30b005d2e\r\n         Boot ID: 68b9de348cf84f0ea516901b323f91b9\r\n  Virtualization: oracle\r\nOperating System: Ubuntu 22.04.3 LTS              \r\n          Kernel: Linux 5.15.0-84-generic\r\n    Architecture: x86-64\r\n Hardware Vendor: innotek GmbH\r\n  Hardware Model: VirtualBox\r\n<\/pre>\n<h2>\u524d\u63d0\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01<\/h2>\n<p>\u4eca\u56de\u4f7f\u7528\u3059\u308bUbuntu Server 22.04\u3067\u306f\u3001\u524d\u63d0\u3068\u306a\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u3067\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo apt install gnupg software-properties-common\r\nReading package lists... Done\r\nBuilding dependency tree... Done\r\nReading state information... Done\r\ngnupg is already the newest version (2.2.27-3ubuntu2.1).\r\ngnupg set to manually installed.\r\nsoftware-properties-common is already the newest version (0.99.22.7).\r\nsoftware-properties-common set to manually installed.\r\n0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.\r\n<\/pre>\n<h2>QGIS\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u767b\u9332\u3059\u308b\uff01<\/h2>\n<p>QGIS\u306e\u30ad\u30fc\u30ea\u30f3\u30b0\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo wget -O \/etc\/apt\/keyrings\/qgis-archive-keyring.gpg https:\/\/download.qgis.org\/downloads\/qgis-archive-keyring.gpg\r\n--2024-01-06 08:07:01--  https:\/\/download.qgis.org\/downloads\/qgis-archive-keyring.gpg\r\nResolving download.qgis.org (download.qgis.org)... 104.21.71.41, 172.67.143.23, 2606:4700:3035::ac43:8f17, ...\r\nConnecting to download.qgis.org (download.qgis.org)|104.21.71.41|:443... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 1969 (1.9K)\r\nSaving to: \u2018\/etc\/apt\/keyrings\/qgis-archive-keyring.gpg\u2019\r\n\r\n\/etc\/apt\/keyrings\/qgis-archiv 100%&#x5B;=================================================&gt;]   1.92K  --.-KB\/s    in 0.003s  \r\n\r\n2024-01-06 08:07:02 (726 KB\/s) - \u2018\/etc\/apt\/keyrings\/qgis-archive-keyring.gpg\u2019 saved &#x5B;1969\/1969]\r\n<\/pre>\n<p>QGIS\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo cat &lt;&lt;EOF | sudo tee \/etc\/apt\/sources.list.d\/qgis.sources\r\nTypes: deb deb-src\r\nURIs: https:\/\/qgis.org\/ubuntu\r\nSuites: jammy\r\nArchitectures: amd64\r\nComponents: main\r\nSigned-By: \/etc\/apt\/keyrings\/qgis-archive-keyring.gpg\r\nEOF\r\nTypes: deb deb-src\r\nURIs: https:\/\/qgis.org\/ubuntu\r\nSuites: jammy\r\nArchitectures: amd64\r\nComponents: main\r\nSigned-By: \/etc\/apt\/keyrings\/qgis-archive-keyring.gpg\r\n<\/pre>\n<p>\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u60c5\u5831\u3092\u6700\u65b0\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo apt update\r\n<\/pre>\n<h2>QGIS Server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01<\/h2>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo apt install qgis qgis-plugin-grass qgis-server\r\n<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u72b6\u614b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ \/usr\/lib\/cgi-bin\/qgis_mapserv.fcgi\r\nApplication path not initialized\r\nApplication path not initialized\r\nApplication path not initialized\r\nApplication path not initialized\r\nWarning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.\r\nWarning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.\r\nWarning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libdummy.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/liblandingpage.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libwcs.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libwfs.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libwfs3.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libwms.so&quot;\r\n&quot;Loading native module \/usr\/lib\/qgis\/server\/libwmts.so&quot;\r\nContent-Length: 0\r\nLocation: http:\/index.json\r\nServer:  QGIS FCGI server - QGIS version 3.34.2-Prizren\r\nStatus:  302\r\n<\/pre>\n<h2>\u30b5\u30f3\u30d7\u30eb\u306eQGIS\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u914d\u7f6e\u3059\u308b\uff01<\/h2>\n<p>\u52d5\u4f5c\u78ba\u8a8d\u306e\u305f\u3081\u30b5\u30f3\u30d7\u30eb\u306eQGIS\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2,3,4,5,6,7]; title: ; notranslate\" title=\"\">\r\n$ sudo apt install unzip\r\n$ sudo mkdir -p \/home\/qgis\/projects\/\r\n$ cd \/home\/qgis\/projects\/\r\n$ sudo wget https:\/\/github.com\/qgis\/QGIS-Training-Data\/archive\/release_3.22.zip\r\n$ sudo unzip release_3.22.zip\r\n$ sudo mv QGIS-Training-Data-release_3.22\/exercise_data\/qgis-server-tutorial-data\/world.qgs .\r\n$ sudo mv QGIS-Training-Data-release_3.22\/exercise_data\/qgis-server-tutorial-data\/naturalearth.sqlite .\r\n<\/pre>\n<h2>Apache\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01<\/h2>\n<p>QGIS Server\u3092\u52d5\u4f5c\u3055\u305b\u308bWeb\u30b5\u30fc\u30d0\u3068\u3057\u3066\u3001Apache\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ sudo apt install apache2 libapache2-mod-fcgid\r\n<\/pre>\n<h2>\u4eee\u60f3\u30db\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>QGIS Server\u7528\u306e\u4eee\u60f3\u30db\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\nsudo cat &lt;&lt;EOF | sudo tee \/etc\/apache2\/sites-available\/qgis.demo.conf\r\n&lt;VirtualHost *:80&gt;\r\n  ServerAdmin webmaster@localhost\r\n  ServerName qgis.demo\r\n\r\n  DocumentRoot \/var\/www\/html\r\n\r\n  # Apache logs (different than QGIS Server log)\r\n  ErrorLog ${APACHE_LOG_DIR}\/qgis.demo.error.log\r\n  CustomLog ${APACHE_LOG_DIR}\/qgis.demo.access.log combined\r\n\r\n  # Longer timeout for WPS... default = 40\r\n  FcgidIOTimeout 120\r\n\r\n  FcgidInitialEnv LC_ALL &quot;en_US.UTF-8&quot;\r\n  FcgidInitialEnv PYTHONIOENCODING UTF-8\r\n  FcgidInitialEnv LANG &quot;en_US.UTF-8&quot;\r\n\r\n  # QGIS log\r\n  FcgidInitialEnv QGIS_SERVER_LOG_STDERR 1\r\n  FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0\r\n\r\n  # default QGIS project\r\n  SetEnv QGIS_PROJECT_FILE \/home\/qgis\/projects\/world.qgs\r\n\r\n  # QGIS_AUTH_DB_DIR_PATH must lead to a directory writeable by the Server's FCGI process user\r\n  FcgidInitialEnv QGIS_AUTH_DB_DIR_PATH &quot;\/home\/qgis\/qgisserverdb\/&quot;\r\n  FcgidInitialEnv QGIS_AUTH_PASSWORD_FILE &quot;\/home\/qgis\/qgisserverdb\/qgis-auth.db&quot;\r\n\r\n  # Set pg access via pg_service file\r\n  SetEnv PGSERVICEFILE \/home\/qgis\/.pg_service.conf\r\n  FcgidInitialEnv PGPASSFILE &quot;\/home\/qgis\/.pgpass&quot;\r\n\r\n  # if qgis-server is installed from packages in debian based distros this is usually \/usr\/lib\/cgi-bin\/\r\n  # run &quot;locate qgis_mapserv.fcgi&quot; if you don't know where qgis_mapserv.fcgi is\r\n  ScriptAlias \/cgi-bin\/ \/usr\/lib\/cgi-bin\/\r\n  &lt;Directory &quot;\/usr\/lib\/cgi-bin\/&quot;&gt;\r\n    AllowOverride None\r\n    Options +ExecCGI -MultiViews -SymLinksIfOwnerMatch\r\n    Require all granted\r\n  &lt;\/Directory&gt;\r\n\r\n  &lt;IfModule mod_fcgid.c&gt;\r\n  FcgidMaxRequestLen 26214400\r\n  FcgidConnectTimeout 60\r\n  &lt;\/IfModule&gt;\r\n\r\n&lt;\/VirtualHost&gt;\r\nEOF\r\n<\/pre>\n<p>\u4eee\u60f3\u30db\u30b9\u30c8\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2,3,4]; title: ; notranslate\" title=\"\">\r\n$ sudo mkdir -p \/var\/log\/qgis\/\r\n$ sudo chown www-data:www-data \/var\/log\/qgis\r\n$ sudo mkdir -p \/home\/qgis\/qgisserverdb\r\n$ sudo chown www-data:www-data \/home\/qgis\/qgisserverdb\r\n<\/pre>\n<p>\u4eee\u60f3\u30db\u30b9\u30c8\u3092\u6709\u52b9\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2,3,4]; title: ; notranslate\" title=\"\">\r\n$ sudo a2enmod fcgid\r\n$ sudo a2ensite qgis.demo\r\n$ sudo a2dissite 000-default.conf\r\n$ sudo systemctl restart apache2\r\n<\/pre>\n<h2>QGIS Server\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306bhosts\u3092\u7de8\u96c6\u3059\u308b\uff01<\/h2>\n<p>QGIS Server\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u7528\u306e\u30de\u30b7\u30f3\u306ehosts\u306bQGIS Server\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nXXX.XXX.XXX.XXX qgis.demo\r\n<\/pre>\n<h2>QGIS\u30b5\u30fc\u30d0\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\uff01<\/h2>\n<p>\u4ee5\u4e0b\u306eURL\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002XML\u30d5\u30a1\u30a4\u30eb\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/qgis.demo\/cgi-bin\/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities\r\n<\/pre>\n<p><a href=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_01.png\" alt=\"\" width=\"1024\" height=\"813\" class=\"alignnone size-full wp-image-15767\" srcset=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_01.png 1024w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_01-300x238.png 300w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_01-768x610.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>QGIS\u30b5\u30fc\u30d0\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\uff01<\/h2>\n<p>\u4ee5\u4e0b\u306eURL\u3067QGIS\u30b5\u30fc\u30d0\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002\u4e16\u754c\u5730\u56f3\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/qgis.demo\/cgi-bin\/qgis_mapserv.fcgi?\r\n  MAP=\/home\/qgis\/projects\/world.qgs&amp;\r\n  LAYERS=countries&amp;\r\n  SERVICE=WMS&amp;\r\n  VERSION=1.3.0&amp;\r\n  REQUEST=GetMap&amp;\r\n  CRS=EPSG:4326&amp;\r\n  WIDTH=400&amp;\r\n  HEIGHT=200&amp;\r\n  BBOX=-90,-180,90,180\r\n<\/pre>\n<p><a href=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_02.png\"><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_02.png\" alt=\"\" width=\"1024\" height=\"813\" class=\"alignnone size-full wp-image-15768 lazyload\" data-srcset=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_02.png 1024w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_02-300x238.png 300w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2024\/01\/qgis_server_install_02-768x610.png 768w\" data-sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Ubuntu Server 22.04\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001QGIS\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u5bb9\u6613\u306bQGIS Server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/10355\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011 \u30b5\u30fc\u30d0\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/11\/eyecatch_serverapps_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011 \u30b5\u30fc\u30d0\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\uff01<\/div><div class=\"substr\">\u5404\u7a2e\u30b5\u30fc\u30d0\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u53c2\u8003\u60c5\u5831<\/h2>\n<p><a href=\"https:\/\/docs.qgis.org\/3.34\/en\/docs\/server_manual\/getting_started.html#id10\" rel=\"noopener\" target=\"_blank\">QGIS Server - Installation on Debian-based systems<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu Server 22.04\u306b\u3001QGIS Server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":14987,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[232],"tags":[1209,51,359,679,52],"class_list":["post-15753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server-applications","tag-qgis","tag-ubuntu","tag-ubuntu-server","tag-ubuntu-server-22-04","tag-52"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/15753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=15753"}],"version-history":[{"count":15,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/15753\/revisions"}],"predecessor-version":[{"id":15807,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/15753\/revisions\/15807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/14987"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=15753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=15753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=15753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}