LoginSignup
1
1

Windows 11をCP4Dのクライアント・ワークステーションとして使う(WSL使用)

Last updated at Posted at 2024-05-20

Windowsマシンを Cloud Pak for Data (CP4D) のクライアント・ワークステーションとして使用することもできます。事前に必要なセットアップを紹介します。

検証環境:

  • Windows 11 Enterprise バージョン 23H2 (VM)
  • CP4D 4.8.4
  • OpenShift 4.14

1. Windows Subsystem for Linux のインストール

Windowsで実行するには、 Windows Subsystem for Linuxをインストールする必要があります。デフォルトのLinux ディストリビューションであるUbuntuをインストールする手順です。

  1. ターミナル(管理者)を起動します。
    image.png

  2. wsl --install を実行します。
    image.png

  3. システムを再起動すると、本来Ubuntuが起動するのですが、この環境ではエラーになりました。
    image.png

  4. こちらを参考に、一旦shutdown後、VMの設定編集からハードウェア仮想化 を有効にします。
    enable_virtualization.png

  5. VMを起動すると、正常にUbuntuが起動しました。
    image.png

次回からは、スタートメニューの Ubuntu を起動することによりターミナルにアクセスできます。
image.png

2. Podmanのインストール

参考:

Podmanは次の2コマンドでインストールできます。

sudo apt-get update
sudo apt-get -y install podman
実行例
user01@DESKTOP-2RV6EAU:~$ sudo apt update && sudo apt upgrade -y
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
:
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for install-info (6.8-4build1) ...

user01@DESKTOP-2RV6EAU:~$ sudo apt install -y podman
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  buildah catatonit conmon containernetworking-plugins crun dconf-gsettings-backend dconf-service dns-root-data
:
Setting up buildah (1.23.1+ds1-2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...

user01@DESKTOP-2RV6EAU:~$ podman --version
podman version 3.4.4
user01@DESKTOP-2RV6EAU:~$ podman version
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.18.1
Built:        Thu Jan  1 09:00:00 1970
OS/Arch:      linux/amd64
user01@DESKTOP-2RV6EAU:~$

3. IBM Cloud Pak for Data コマンド・ライン・インターフェースのインストール

参考:

WSLから、本体のWindowsのC:ドライブを /mnt/c として参照できます。
今回、Windows上のブラウザを使用して必要なcpd-cliパッケージ(Linux x86_64用)をダウンロードし、そのパッケージをWSLで利用しました。

 user01@DESKTOP-2RV6EAU:~$ df -h
 Filesystem      Size  Used Avail Use% Mounted on
 none             16G  4.0K   16G   1% /mnt/wsl
 none            3.0T   39G  3.0T   2% /usr/lib/wsl/drivers
 none             16G     0   16G   0% /usr/lib/modules
 none             16G     0   16G   0% /usr/lib/modules/5.15.146.1-microsoft-standard-WSL2
 /dev/sdc       1007G  1.6G  955G   1% /
 none             16G   92K   16G   1% /mnt/wslg
 none             16G     0   16G   0% /usr/lib/wsl/lib
 rootfs           16G  1.9M   16G   1% /init
 none             16G  788K   16G   1% /run
 none             16G     0   16G   0% /run/lock
 none             16G  168K   16G   1% /run/shm
 tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
 none             16G   76K   16G   1% /mnt/wslg/versions.txt
 none             16G   76K   16G   1% /mnt/wslg/doc
 C:\             3.0T   39G  3.0T   2% /mnt/c
 snapfuse         92M   92M     0 100% /snap/gtk-common-themes/1535
 snapfuse        132M  132M     0 100% /snap/ubuntu-desktop-installer/1276
 snapfuse         74M   74M     0 100% /snap/core22/864
 snapfuse         41M   41M     0 100% /snap/snapd/20290
 snapfuse        128K  128K     0 100% /snap/bare/5
 snapfuse         75M   75M     0 100% /snap/core22/1122
 snapfuse        132M  132M     0 100% /snap/ubuntu-desktop-installer/1286
 
 user01@DESKTOP-2RV6EAU:~$ cd /mnt/c/Users/user01/Downloads
 user01@DESKTOP-2RV6EAU:/mnt/c/Users/user01/Downloads$ ls -l
 total 193128
 -rwxrwxrwx 1 user01 user01 197762900 Apr 12 18:35 cpd-cli-linux-EE-13.1.4.tgz
 -rwxrwxrwx 1 user01 user01       282 Apr 11 22:11 desktop.ini
 user01@DESKTOP-2RV6EAU:/mnt/c/Users/user01/Downloads$ mv cpd-cli-linux-EE-13.1.4.tgz ~
 user01@DESKTOP-2RV6EAU:/mnt/c/Users/user01/Downloads$ ls -l ~
 total 193132
 -rwxrwxrwx 1 user01 user01 197762900 Apr 12 18:35 cpd-cli-linux-EE-13.1.4.tgz

cpd-cliパッケージをuser01のホームディレクトリで展開します。

user01@DESKTOP-2RV6EAU:~$ tar zxvf cpd-cli-linux-EE-13.1.4.tgz
cpd-cli-linux-EE-13.1.4-109/
cpd-cli-linux-EE-13.1.4-109/LICENSES/
cpd-cli-linux-EE-13.1.4-109/LICENSES/LA_cs
:

cpd-cli-linux-EE-13.1.4-109/plugins/lib/linux/platform-diag
cpd-cli-linux-EE-13.1.4-109/plugins/lib/linux/platform-mgmt
cpd-cli-linux-EE-13.1.4-109/cpd-cli

4. OpenShift コマンド・ライン・インターフェースのインストール

同様にWindows上のブラウザを使用して OpenShift コンソールにアクセスし、ダウンロードしたパッケージ(oc for Linux for x86_64: oc.tar)を、WSLで利用しました。

user01@DESKTOP-2RV6EAU:~$ mv /mnt/c/Users/user01/Downloads/oc.tar .
user01@DESKTOP-2RV6EAU:~$ ls -l oc.tar
-rwxrwxrwx 1 user01 user01 152115200 Apr 12 19:11 oc.tar
user01@DESKTOP-2RV6EAU:~$ tar xvf oc.tar

user01@DESKTOP-2RV6EAU:~$ ls -l oc
-rwxr-xr-x 1 user01 user01 152111704 Mar 27 07:40 oc
user01@DESKTOP-2RV6EAU:~$ oc version
Client Version: 4.14.0-202403261739.p0.gf7b14a9.assembly.stream.el8-f7b14a9
Kustomize Version: v5.0.1

5. cpd-cliコマンド稼働確認

以上で、cpd-cliコマンドを実行できるようになりました。

user01@DESKTOP-2RV6EAU:~/cpd-cli-linux-EE-13.1.4-109$ ./cpd-cli manage restart-container
[INFO] 2024-04-12T19:13:53.319774Z Checking architecture: amd64
[INFO] 2024-04-12T19:13:53.319924Z Checking podman or docker
[INFO] 2024-04-12T19:13:53.361653Z Dockerexe: podman
[INFO] 2024-04-12T19:13:53.503718Z No running container found.
[INFO] 2024-04-12T19:13:53.652272Z Creating directory /home/user01/cpd-cli-linux-EE-13.1.4-109/cpd-cli-workspace/olm-utils-workspace/work
[INFO] 2024-04-12T19:13:53.652887Z Attempting pull container image icr.io/cpopen/cpd/olm-utils-v2:latest
[INFO] 2024-04-12T19:14:11.713300Z Pulling image output: Trying to pull icr.io/cpopen/cpd/olm-utils-v2:latest...
Getting image source signatures
Copying blob sha256:868f75f63f3f5119de926a6c52627eb1e7408ac528bf8f877bce659a5ce01b9e
:
Copying config sha256:649e9e78592467e2d1317d5f4bd85d8ef093f410147414dec8f083efe9c09722
Writing manifest to image destination
Storing signatures
649e9e78592467e2d1317d5f4bd85d8ef093f410147414dec8f083efe9c09722
[SUCCESS] 2024-04-12T19:14:11.713664Z Successfully pulled the container image icr.io/cpopen/cpd/olm-utils-v2:latest
[INFO] 2024-04-12T19:14:11.713944Z Delete any existing olm-utils-play-v2 container
[INFO] 2024-04-12T19:14:11.840479Z Checking SELinux configuration
[INFO] 2024-04-12T19:14:11.861062Z File /home/user01/cpd-cli-linux-EE-13.1.4-109/cpd-cli-workspace/olm-utils-workspace/work/.olm-utils/.kubeconfig does not exist
[INFO] 2024-04-12T19:14:11.861143Z Start the olm-utils-play-v2 container
[INFO] 2024-04-12T19:14:16.846193Z Run command: podman create  --name olm-utils-play-v2 --platform linux/amd64 --env EXTERNAL_WORK_ROOT=/home/user01/cpd-cli-linux-EE-13.1.4-109/cpd-cli-workspace/olm-utils-workspace/work --env  CMD_PREFIX="cpd-cli manage"  -v /home/user01/cpd-cli-linux-EE-13.1.4-109/cpd-cli-workspace/olm-utils-workspace/work:/tmp/work    icr.io/cpopen/cpd/olm-utils-v2:latest
[INFO] 2024-04-12T19:14:17.195766Z Run command: podman start olm-utils-play-v2
[INFO] 2024-04-12T19:14:22.198144Z Container is fully ready now
[SUCCESS] 2024-04-12T19:14:22.198485Z Successfully started the container olm-utils-play-v2
[SUCCESS] 2024-04-12T19:14:22.198753Z Container olm-utils-play-v2 has been re-created

補足:各ソフトウェアのバージョン確認方法

WSLのバージョン確認

PowerShell
PS C:\Users\user01> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

Ubuntuのバージョン確認

Ubuntuターミナル
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Podmanのバージョン確認

Ubuntuターミナル
$ podman version
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.18.1
Built:        Thu Jan  1 09:00:00 1970
OS/Arch:      linux/amd64

注意

CP4D 4.8.x のクライアント・ワークステーションの要件は、Podman バージョン 4.0.0 以降 となっています。今回使用したPodmanは3.4.4で要件を満たしていません。今回テスト的にいくつかのコマンドを実行した限りでは特に問題はありませんでしたが、要件を満たしたバージョンを使用する必要があります。

2024年5月現在WSLで Ubuntu 24.04 が選択可能です。このディストリビューションをインストールすることで、Podman 4.9.3 がインストールできますので、こちらの要件を満たした環境を使用するようにしてください。

PowerShell
PS C:\Users\user01> wsl --list --online
インストールできる有効なディストリビューションの一覧を次に示します。
'wsl.exe --install <Distro>' を使用してインストールします。

NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
Ubuntu-24.04                           Ubuntu 24.04 LTS
OracleLinux_7_9                        Oracle Linux 7.9
OracleLinux_8_7                        Oracle Linux 8.7
OracleLinux_9_1                        Oracle Linux 9.1
openSUSE-Leap-15.5                     openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5           SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed                    openSUSE Tumbleweed

PS C:\Users\user01> wsl --install -d Ubuntu-24.04
インストール中: Ubuntu 24.04 LTS
Ubuntu 24.04 LTS がインストールされました。
Ubuntu 24.04 LTS を起動しています...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: user01
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 24.04 LTS (GNU/Linux 5.15.146.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Wed May 15 17:43:23 JST 2024

  System load:  0.87                Processes:             24
  Usage of /:   0.1% of 1006.85GB   Users logged in:       0
  Memory usage: 1%                  IPv4 address for eth0: 172.23.140.42
  Swap usage:   0%


This message is shown once a day. To disable it please create the
/home/user01/.hushlogin file.
Ubuntuターミナル
user01@DESKTOP-2RV6EAU:~$ sudo apt update && sudo apt upgrade -y
user01@DESKTOP-2RV6EAU:~$ sudo apt install -y podman
user01@DESKTOP-2RV6EAU:~$ podman version
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
Client:       Podman Engine
Version:      4.9.3
API Version:  4.9.3
Go Version:   go1.22.1
Built:        Thu Jan  1 09:00:00 1970
OS/Arch:      linux/amd64

参考:

1
1
1

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
1
1