LoginSignup
7
5

More than 1 year has passed since last update.

WSLのUbuntuにQGIS3をインストール

Last updated at Posted at 2020-06-01

概要

Windows10のWSL1,WSL2上にQGIS3環境を構築してみました。
普段、Windows版を利用されている方は、WSL(Windows Subsystem for Linux)が出てきたことで、ひょっとしてLinux版動くんではと思っている方もおられるかと。
今回はそういう人のために、WSL1,2でのQGIS3インストールから起動までの手順を書いておきます。
WSLが加わったことで、選択肢としてLinux版のQGIS3を直接インストールということが可能になったので、実際どの程度動くのかを検証してゆきましょう。
WSLを一度もインストールしていない方は、先にWindows Update 2004をインストールすることをお勧めします。

2020.05.20
WSL2のUbuntu20.04のリリースに伴い、新しい記事を作成しました。下記をご利用ください。
WSL2のUbuntu20.04にQGIS3.16をインストール

背景

QGISは地理情報のデータ閲覧、編集分析機能を有するクロスプラットフォームのオープンソースソフトウェアです。
最新バージョンは QGIS 3.12.3 'București' で、 15.05.2020にリリースされました。
近年、お仕事や研究で地理空間情報を扱っている多くの方に利用されています。
Windows10 ver1607以降、WindowsでWSL(Windows Subsystem for Linux) が使えるようになりました。
通常Windowsユーザーは、OSGeo4Wまたはスタンドアロン版QGISをインストールするかVirtualBoxやVMWare Workstation Playerを使用してOSGeoLiveを使用してQGISを使用しています。
Windows10でWSL環境で利用することが可能になったため、Linux版を使用することができるようになりました。

インストール

WSLのインストールですが、Windowsのログイン名が漢字の場合はうまくゆきません。
たまに日本人だから漢字がデフォルトですと胸をはる方がおられますが、諦めて1バイトと文字のアカウントをご使用ください。
自分のアカウントが2バイト文字かどうかわからない方は、コマンドプロンプトを起動して表示されるユーザーフォルダの文字列をじーっと見てご判断ください。

WSL1の準備

WSL1をインストールしていない場合は、管理者モードでPowerShellを開き、以下を実行します。

PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

再起動してWSL1環境を有効にします。

Ubuntu18.04のインストール

WSL1をインストールしたら、Microsoft StoreからUbuntu18.04 LTSをインストールします。

Ubuntuの初期起動とアカウント設定

WSLのUbuntuアイコンをクリックして、WSLを起動します。
初期起動では、しばらく自動実行の環境設定が行われます。
その後、ユーザーアカウントの設定メッセージが表示されますので、アカウントの指定を行います。
ユーザー名、パスワードに漢字は入れないでください

パッケージリストの更新

sudo apt update

パッケージのアップデート

sudo apt upgrade -y

上記で保留されたパッケージのアップデート

sudo apt dist-upgrade -y

不要になったパッケージの削除

sudo apt autoremove -y

python3およびpipのインストール

sudo apt install python3 python3-pip -y
sudo pip3 install pip -U

matplotlibのインストール

sudo pip3 install matplotlib

「tkinter」モジュールのインストール

sudo apt install python3-tk -y

Windows環境にXサーバをインストールする

Linux環境でQGISのGUIを表示するためには、Xサーバが必要になります。
ホストOSのWindows側でXサーバを動かして、Windows上でGUI環境をサポートします。

VcXsrv インストール

VcXsrv Windows X ServerのダウンロードページからVcXsrvをダウンロードして、インストールします。

Windows10側で、XLaunchを起動する

インストールが終了すると、デスクトップにXLaunchというアイコンが作成されます。
XLaunchアイコンをクリックするか、[スタート]メニューの[VcXsrv]-[XLaunch]を選択して、XLaunchを起動します。
Display settingダイアログが表示されるので、 Multiple windows を選択して、次へ進み、Select how to start clientsで Start on client を選択し、次へ進みます。
Extra settingsで Clipboard, Primary Selection, Native opengl を選択します。

表示先ディスプレイの設定

X Serverのディスプレイ指定は下記の書式になります。
DISPLAY=<ホスト名/IPアドレス>:<ディスプレイ番号>.<スクリーン番号>
下記のようにWSLのターミナルでコマンドを入力し、ログインユーザーの.profileにディスプレイ指定を追加します。

WSL1
echo export DISPLAY=:0.0 >> ~/.profile
echo export LIBGL_ALWAYS_INDIRECT=1  >> ~/.profile
source ~/.profile

Window上でcygwinを使用していて、cygwin環境とディスプレイ設定値 0.0 がバッティングする場合、1.0 や 2.0を指定しましょう。
なお、WSL2ではIPアドレスがホストの再起動ごとに変わってしまうため、WSLのnameserverの内容からセットする方法を使用します。

WSL2
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 >> ~/.profile
echo export LIBGL_ALWAYS_INDIRECT=1  >> ~/.profile
source ~/.profile

Xサーバ対応アプリをインストールする

Xサーバの動作チェックのために、x11のユーティリティをインストールし、テストしましょう。

sudo apt install x11-apps

Xアプリ「xeyes」を実行してみます。

xeyes

マウスポインタをトラックする眼のアプリウィンドウが表示されれば、Xサーバは動作していることが確認できます。
エラーが発生する場合は、原因を調べて修正しましょう。

WSL日本語化

WSLは日本語対応していますが、QGISを起動した際、レイヤーツリーなどで日本語が表示されない場合があります。
これを修正するため、日本語フォント環境を追加する必要があります。他の言語環境(韓国語など)でも同様に言語パックを追加する必要があるかもしれません。

sudo apt -y install language-pack-ja
sudo update-locale LANG=ja_JP.UTF8
sudo apt -y install manpages-ja manpages-ja-dev

日本語フォントインストール

sudo apt install fontconfig -y
fc-match -a Ubuntu | head
sudo sed -i.bak -e "s%http://archive.ubuntu.com/ubuntu/%http://ftp.iij.ad.jp/pub/linux/ubuntu/archive/%g" /etc/apt/sources.list
sudo apt update
sudo apt upgrade
sudo apt-get install git build-essential libssl-dev libreadline-dev zlib1g-dev x11-apps x11-utils x11-xserver-utils libsqlite3-dev nodejs fonts-ipafont libxml2-dev libxslt1-dev -y

QGIS3のインストール

2020/10/29 QGIS3のGPG変更にともない、インストール記述を修正しました。

パッケージリストにQGIS3のリポジトリを追加

QGIS3をインストールするために、WSL(Ubuntu18.04)のパッケージリストにQGIS3用のエントリを追加します。
QGISダウンロードサイトにパッケージごとのリポジトリリストがあります。
Debian/Ubuntuをクリックして、インストールドキュメントパッケージのラインからリポジトリRLを、WSLのUbuntuのバージョンに該当するコードネームを配布から選びます。
Ubuntu18.04のコードネームはbionicになります。

/etc/apt/sources.listパッケージリストに下記のエントリがある場合、コメントまたは削除してください。

$sudo vim /etc/apt/sources.list
# deb https://qgis.org/ubuntu bionic main
# deb-src https://qgis.org/ubuntu bionic main

下記のコマンドでgisパッケージ用のリポジトリを追加します。
2021/05/19時点では、qgisのバージョンは

sudo add-apt-repository "deb https://qgis.org/ubuntu $(lsb_release -c -s) main"

最初にこの手順に必要なツールをインストールする

sudo apt install gnupg software-properties-common

公開鍵を追加する

パッケージリストにエントリを追加したら、リポジトリアクセス用の公開鍵をWSL環境に追加します。

wget -qO - https://qgis.org/downloads/qgis-2020.gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/qgis-archive.gpg --import
sudo chmod a+r /etc/apt/trusted.gpg.d/qgis-archive.gpg

最新の安定版QGIS (3.16.x Hannover)のQGISレポジトリを追加します。

sudo add-apt-repository "deb https://qgis.org/debian `lsb_release -c -s` main"

公開鍵を追加したら、エントリが正しく追加されているかテストします。

sudo apt update
apt search qgis

必ずsudo apt updateしましょう。
qgisが3.12以降ならインストールを開始してもOKです。

パッケージが3.12になっている場合
$ apt search qgis
Sorting... Done
Full Text Search... Done
gpx2shp/bionic 0.71.0-4build1 amd64
  convert GPS or GPX file to ESRI Shape file

libqgis-3d3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared 3d library

libqgis-3d3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared 3d library

libqgis-3d3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared 3d library

libqgis-3d3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared 3d library

libqgis-3d3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared 3d library

libqgis-3d3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared 3d library

libqgis-3d3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared 3d library

libqgis-analysis2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared analysis library

libqgis-analysis3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared analysis library

libqgis-analysis3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared analysis library

libqgis-analysis3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared analysis library

libqgis-analysis3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared analysis library

libqgis-analysis3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared analysis library

libqgis-analysis3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared analysis library

libqgis-analysis3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared analysis library

libqgis-app2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared app library

libqgis-app3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared app library

libqgis-app3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared app library

libqgis-app3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared app library

libqgis-app3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared app library

libqgis-app3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared app library

libqgis-app3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared app library

libqgis-app3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared app library

libqgis-core2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared core library

libqgis-core3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared core library

libqgis-core3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared core library

libqgis-core3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared core library

libqgis-core3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared core library

libqgis-core3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared core library

libqgis-core3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared core library

libqgis-core3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared core library

libqgis-customwidgets/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS custom widgets for Qt Designer

libqgis-dev/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - development files

libqgis-gui2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared gui library

libqgis-gui3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared gui library

libqgis-gui3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared gui library

libqgis-gui3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared gui library

libqgis-gui3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared gui library

libqgis-gui3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared gui library

libqgis-gui3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared gui library

libqgis-gui3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared gui library

libqgis-native3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared native gui library

libqgis-native3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared native gui library

libqgis-native3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared native gui library

libqgis-native3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared native gui library

libqgis-native3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared native gui library

libqgis-native3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared native gui library

libqgis-native3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared native gui library

libqgis-networkanalysis2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared network analysis library

libqgis-server2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared server library

libqgis-server3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared server library

libqgis-server3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared server library

libqgis-server3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared server library

libqgis-server3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared server library

libqgis-server3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared server library

libqgis-server3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared server library

libqgis-server3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared server library

libqgisgrass7-2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared grass library

libqgisgrass7-3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared grass library

libqgisgrass7-3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared grass library

libqgisgrass7-3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared grass library

libqgisgrass7-3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared grass library

libqgisgrass7-3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared grass library

libqgisgrass7-3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared grass library

libqgisgrass7-3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared grass library

libqgispython2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared Python library

libqgispython3.12.2/bionic,bionic 1:3.12.2+28bionic amd64
  QGIS - shared Python library

libqgispython3.12.3/bionic,bionic 1:3.12.3+28bionic amd64
  QGIS - shared Python library

libqgispython3.14.0/bionic,bionic 1:3.14.0+28bionic amd64
  QGIS - shared Python library

libqgispython3.14.1/bionic,bionic 1:3.14.1+28bionic amd64
  QGIS - shared Python library

libqgispython3.14.15/bionic,bionic 1:3.14.15+28bionic-1 amd64
  QGIS - shared Python library

libqgispython3.14.16/bionic,bionic 1:3.14.16+28bionic amd64
  QGIS - shared Python library

libqgispython3.16.0/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - shared Python library

python-pysal/bionic 1.14.3-1 all
  Python Spatial Analysis Library - Python 2

python-qgis/bionic,bionic 1:3.16.0+28bionic all
  transitional package

python-qgis-common/bionic,bionic 1:3.16.0+28bionic all
  transitional package

python3-pysal/bionic 1.14.3-1 all
  Python Spatial Analysis Library - Python 3

python3-qgis/bionic,bionic 1:3.16.0+28bionic amd64
  Python bindings to QGIS

python3-qgis-common/bionic,bionic 1:3.16.0+28bionic all
  Python bindings to QGIS - architecture-independent files

qgis/bionic,bionic 1:3.16.0+28bionic amd64
  Geographic Information System (GIS)

qgis-api-doc/bionic,bionic 1:3.16.0+28bionic all
  QGIS API documentation

qgis-common/bionic,bionic 1:3.16.0+28bionic all
  QGIS - architecture-independent data

qgis-dbg/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS - debugging symbols

qgis-plugin-grass/bionic,bionic 1:3.16.0+28bionic amd64
  GRASS plugin for QGIS

qgis-plugin-grass-common/bionic,bionic 1:3.16.0+28bionic all
  GRASS plugin for QGIS - architecture-independent data

qgis-provider-grass/bionic,bionic 1:3.16.0+28bionic amd64
  GRASS provider for QGIS

qgis-providers/bionic,bionic 1:3.16.0+28bionic amd64
  collection of data providers to QGIS

qgis-providers-common/bionic,bionic 1:3.16.0+28bionic all
  collection of data providers to QGIS - architecture-independent files

qgis-server/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-common/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-dummy/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-landingpage/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-wcs/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-wfs/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-wfs3/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-wms/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qgis-server-wmts/bionic,bionic 1:3.16.0+28bionic amd64
  QGIS server providing various OGC services

qlandkartegt/bionic 1.8.1+ds-8build4 amd64
  GPS mapping (GeoTiff and vector) and GPSr management

下記のように2.18だけが表示される場合は、このままインストールすると2.18がインストールされてしまうので、パッケージリストを再度確認します。

パッケージが古い2.18の場合
$ apt search qgis
Sorting... Done
Full Text Search... Done
gpx2shp/bionic 0.71.0-4build1 amd64
  convert GPS or GPX file to ESRI Shape file

libqgis-analysis2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared analysis library

libqgis-app2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared app library

libqgis-core2.18.17/bionic 2.18.17+dfsg-1 amd64
  QGIS - shared core library
...

QGIS3のインストール

QGIS3とツール等をインストールします。
必要なツールが他にあれば、コマンドラインに追加します。

sudo apt install qgis python-qgis qgis-plugin-grass saga

sagaを使用する場合、sagaの指定は最後にした方が良いようです。
なお、sagaのバージョンはパッケージリストでは2.3.1になっています。

WSL2への移行

2020年5月にリリースされた、Windows10 Update 2004で、WSL2が正式リリースされました。
WSL2環境を使用するためにはWindows10(2004)へのアップデートを行う必要があります。

仮想化支援機能の有効化

まずはじめに、BIOSの仮想支援機能(インテル バーチャライゼーション・テクノロジー)をONにする必要があります。
WIndows10で仮想化支援が有効になっているかどうか確認するためには、タスクマネージャのCPU画面で「仮想化:有効」となっているかどうかをチェックします。
もし、無効になっていたら、ご使用のPCのBIOSで仮想化支援をONにします。

Windows10 Update 2004のインストール

Windows10 Update 2004は下記から手動インストールが可能です。

アップデートを行うWindows10で、Windows10 Updateにアクセスし、インストーラをダウンロードします。
異なるOSでアクセスした場合は、Windwows10のインストールイメージがダウンロードされるので、必ずWindows10で行ます。
Windows Updateが終了すると、WSL2がインストール可能になります。

WSLをインストールしていない場合は、管理者モードでPowerShellを開き、以下を実行します。

PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

再起動してWSL2環境を有効にします。

再起動後、WSL2をデフォルト環境に指定します。

PowerShell
wsl --set-default-version 2

WSLをインストールしていない場合は、ストアからUbuntu18.04 LTSをインストールします。

すでに、WSL1でQGIS3をインストールしている場合は、WSL1の環境をWSL2にコンバートするため、Linuxカーネルの更新を行います。

Linux カーネル更新プログラム パッケージをインストール

wsl_update_x64.msiがダウンロードされたら、実行します。

wsl_update_x64のインストールが終了したら、既存のWSL1のUbuntu18.04のLinuxカーネルをWSL2用に更新します。
変換するWSL1の名前が知りたい場合は、

wsl -l -v 
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1

でリストを表示して確認します。VERSION が 1 になっているものが対象です。

WSL1からWSL2への変換
wsl --set-version Ubuntu-18.04 2

Linuxカーネルの更新後、WSL2を起動します。

すでにQGIS3をインストールしている場合、VcXsrvのディスプレイ設定を次の通りに変更します。

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0

テストしてないけど、WSL2(2004)では、localhost forwardingが実装されたので、下記でもOKかもしれない。

export DISPLAY=localhost:0.0

ESETなどのウィルス対策ソフトのファイアウォールを使用している場合、WSL2の仮想ネットワークアドレスをファイアウォールがブロックしてしまうため、XサーバのIPがWSL2からアクセスできない場合があります。
この場合、ウィルス対策ソフトのファイアウォールにWSL2のアドレスを許可します。

QGISの起動と動作確認

WSLのshellからqgisを起動します。

$ qgis

WSL2でqgisを起動すると、WSL1の時よりも断然キビキビと動作します。
QGISonWSL2.jpg

ベンチマーク結果は、OSGeo.krの Sanghee Shin さんのブログにあるとおりです。内容を抜粋して日本語訳しました。

QGISプログラムの起動速度とデータの読み込み速度は以下の通りです。

プラットフォーム QGISプラログラムの起動
(初回)
QGISプラログラムの起動
(2回目)
データの読込
(Windowsストア)
データの読み込み
(WSLストア)
Windows10 38.06秒 17.81秒 17.05秒 ロード不可
WSL2 4.38秒 4.11秒 17.75秒 6.85秒
  • データがWSL2のファイルシステムにある場合QGISの処理速度は、Windows QGISを圧倒する。MSもWSL2のプログラムを利用してデータを処理する場合、Windowsではなく、WSL2のファイルシステムに直接保存することをお勧めします。
  • ちなみにWSL2からWindows上のファイルにアクセスする場合、WSL1より速度が遅くならない。(下のリンク参照)
    https://docs.microsoft.com/en-us/windows/wsl/compare-versions

不具合など

1.QGISアプリ内ののURLリンク遷移
QGISアップデートのリンクが下のステータスバーに出ることがありますが、クリックしてもリンクが開きません。
WSL上にChromeやFirefox等をインストールするか、シェル環境のブラウザを指定をする必要があります。
または、Windows側のブラウザを指定しておきます。

chromeの場合
export BROWSER=/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe

2.WSL2のホストメモリ枯渇対応
@yoichiwo7さんの記事から引用させていただきます。
%USERPROFILE%.wslconfigのコンフィグに以下の設定を行います。

  • %USERPROFILE%はC:\Users\taroのようなホームディレクトリを指します。
  • コンフィグが存在しない場合は作成してください。
  • 設定した後はWSL2を再起動するか、OSを再起動してください。
.wslconfigファイル
[wsl2]
memory=6GB
swap=0
  • memoryにはWSL2が最大確保するメモリサイズを指定します。PCの搭載メモリとWSL2の使用用途に応じてメモリサイズの値は変更してください。ちなみに未指定時のデフォルト値はPC搭載メモリの80%です。
  • swapを0に設定してスワップを無効にします。(どちらでもよい。詳しくは記事を参照してください)

QGISは適当に動かしてチェックしているので、動作上の不具合を発見した方はご報告ください。

参考ページ

WSLのインストールについてはこちらを参考にしました。
https://docs.microsoft.com/ja-jp/windows/wsl/install-win10

WSL1のWSL2コンバートについてはこちらを参考にしました。
https://docs.microsoft.com/ja-jp/windows/wsl/wsl2-kernel

VcXsrvインストールについてはこちらを参考にしました。
https://www.atmarkit.co.jp/ait/articles/1812/06/news040.html

WSL2におけるVcXsrvの設定はこちらを参考にしました。
https://qiita.com/ryoi084/items/0dff11134592d0bb895c

LinuxへのQGISのインストールについてはこちらを参考にしました。
https://www.qgis.org/ja/site/forusers/alldownloads.html#debian-ubuntu
https://www.gis-blog.com/how-to-install-qgis-3-on-ubuntu/

ベンチマーク結果についてはOSGeo.krの Sanghee Shin さんのブログを引用させていただきました。
https://endofcap.tistory.com/1863

Linuxで使える日本語フリーフォントには次のものもあります。
http://note.kurodigi.com/free-font2019/

国際化フォント
https://wiki.ubuntulinux.jp/UbuntuTips/Desktop/InstallFont

WSL2のメモリコントロールについては @yoichiwo7 さんの記事から引用させていただきました。
https://qiita.com/yoichiwo7/items/e3e13b6fe2f32c4c6120

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5