LoginSignup
20
35

More than 3 years have passed since last update.

WSLのインストール・アンインストール方法

Last updated at Posted at 2019-04-16

概要

Windows上で動くLinux, WSLのインストールとアンインストール方法です。
毎回調べてるので自分で書き残しておきます。

環境

Windows10 Pro
バージョン 1803
WSL ... Ubuntu 18.04 LTS

インストール

初めにやっておく設定

WSLを有効化します。

image2019-4-15_10-35-53.png
image2019-4-15_10-36-39.png

Windows Subsystem for Linux のチェックボックスにチェックを入れてOKを押す。再起動が必要です。
image2019-4-15_10-37-41.png

やっておかないと。。。

こんな感じで後で怒られます
image2019-4-15_10-34-9.png

Microsoft Storeからインストール

image2019-4-15_10-25-8.png
image2019-4-15_10-26-49.png
image2019-4-15_10-27-21.png

複数のデバイスと聞かれますが必要ありません。複数のデバイスっていうのがどういう意味なのかは不明。
image2019-4-15_10-28-41.png

ダウンロードしてくれます。
image2019-4-15_10-29-1.png

このMicrosoft Storeの画面で直接起動してもいいですし、下の画像のように普通にプログラムの起動しても同じです。
image2019-4-15_10-31-6.png
image2019-4-15_10-42-43.png

起動

ユーザー名入力

なんでもよいです。
image2019-4-15_10-44-19.png

パスワード入力

sudo 時とかに使うのでちゃんと覚えときましょう。
image2019-4-15_10-45-12.png

bashが使えるようになりました。
image2019-4-15_10-45-29.png

アンインストール

[アプリと機能] から消せます。

image2019-4-15_12-23-56.png
image2019-4-15_12-25-5.png
image2019-4-15_12-25-45.png

消した後。。。

bashを使おうとすると教えてくれます。
image2019-4-15_12-26-59.png

おまけ /mnt/c/Users 以下のディレクトリのパーミッションを変更できるようにする

WSLのパーミッションについて
要するにWindowsのファイルシステムにLinuxのメタデータを扱えるようにする。

ファイルのマウントしなおし
cd ~ # /mnt/c/Users 以下のディレクトリにいるとマウント解除できない
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata
/etc/wsl.conf
[automount]
options = "metadata"
20
35
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
20
35