### Editing /etc/systemd/system/ollama.service.d/override.conf### Anything between here and the comment below will become the contents of the drop-in file[Service]Environment="OLLAMA_HOST=0.0.0.0"Environment="OLLAMA_NUM_GPU=8"Environment="OLLAMA_MAX_LOADED_MODELS=2"Environment="OLLAMA_NUM_BATCH=2048"Environment="OLLAMA_NUM_THREAD=32"Environment="OLLAMA_KEEP_ALIVE=-1"Environment="CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7"### Edits below this comment will be discarded### /etc/systemd/system/ollama.service# [Unit]# Description=Ollama Service# After=network-online.target## [Service]# ExecStart=/usr/local/bin/ollama serve# User=ollama# Group=ollama# Restart=always# RestartSec=3
CNI_PLUGIN_VERSION="v1.7.1"CNI_PLUGIN_TAR="cni-plugins-linux-amd64-$CNI_PLUGIN_VERSION.tgz"# change arch if not on amd64CNI_PLUGIN_INSTALL_DIR="/opt/cni/bin"curl-LO"https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGIN_VERSION/$CNI_PLUGIN_TAR"sudo mkdir -p"$CNI_PLUGIN_INSTALL_DIR"sudo tar -xf"$CNI_PLUGIN_TAR"-C"$CNI_PLUGIN_INSTALL_DIR"rm"$CNI_PLUGIN_TAR"
crictl
DOWNLOAD_DIR="/usr/local/bin"sudo mkdir -p"$DOWNLOAD_DIR"CRICTL_VERSION="v1.33.0"ARCH="amd64"curl-L"https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz"|sudo tar -C$DOWNLOAD_DIR-xz
mikoto@kubernetes:~$ sudo kubectl get nodesNAME STATUS ROLES AGE VERSIONkubernetes Ready control-plane 7m51s v1.33.1mikoto@kubernetes:~$ sudo kubectl run hello-world --image=hello-world --restart=Neverpod/hello-world createdmikoto@kubernetes:~$ sudo kubectl get podNAME READY STATUS RESTARTS AGEhello-world 0/1 Completed 0 23smikoto@kubernetes:~$ sudo kubectl logs pod/hello-worldHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/
mikoto@kubernetes:~$ sudo docker run -it--rm hello-worldHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/
> wsl --update
更新プログラムを確認しています。
Linux 用 Windows サブシステムの最新バージョンは既にインストールされています。
インストール可能なディストリビューションの確認
> 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
Ubuntu 24.04 のインストール
> wsl --install 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: mikoto
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.153.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 Thu Jul 18 12:30:14 JST 2024
System load: 0.52 Processes: 28
Usage of /: 0.1% of 1006.85GB Users logged in: 0
Memory usage: 2% IPv4 address for eth0: 172.23.180.66
Swap usage: 0%
This message is shown once a day. To disable it please create the
/home/mikoto/.hushlogin file.
mikoto@mnmain:~$
$ exit
> wsl -d Ubuntu-24.04
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:1408fec50309afee38f3535383f5b09419e6dc0925bc69891e79d84cc4cdcec6
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
mikoto@DESKTOP-CO13JB2:~$ cd /usr/src/5.4.91-microsoft-standard/mikoto@DESKTOP-CO13JB2:/usr/src/5.4.91-microsoft-standard$ git logcommit 807335635710b9038f2bb95019878d846130501a (grafted, HEAD, tag: linux-msft-5.4.91)Author: Vivek Yadav <vyadav@microsoft.com>Date: Wed Jan 20 18:25:17 2021 +0000Merge remote-tracking branch 'msft/linux-msft-wsl-5.4.y' into linux-msft-wsl-5.4.ymikoto@DESKTOP-CO13JB2:/usr/src/5.4.91-microsoft-standard$ cd -/home/mikoto
linux-msft-5.4.91 のタグがチェックアウトされているのを確認できる。
現在のカーネル設定をコピー
cd /usr/src/5.4.91-microsoft-standard/sudo cp /proc/config.gz config.gzsudo gunzip config.gzsudo mv config .config
カーネルモジュール設定
make menuconfig で、カーネルモジュールの設定を行う。
sudo make menuconfig
以下に今回変更したものだけ記載する。環境によって差があるかも…。
■ USB 関連
Device Drivers
+- [*] USB support
+- <M> Support for Host-side USB
+- <M> USB Modem (CDC ACM) support
+- <M> USB Mass Storage support
+- <M> USB/IP support
| +- <M> VHCI hcd
+- <M> USB Serial Converter support
| +- <M> USB FTDI Single Port Serial Driver
+- USB Physical Layer drivers
| +- <M> NOP USB Transceiver Driver
+- Network device support
+- <M> USB Network Adapters
+- <M> Multi-purpose USB Networking Framework
| +- <M> Host for RNDIS and ActiveSync devices
+- <M> Multi-purpose USB Networking Framework
■ V4L2 関連
Device Drivers
+- <M> Multimedia support
+- [*] Cameras/video grabbers support
+- [*] Media USB Adapters
+- <M> USB Video Class (UVC)
カーネルのビルドとインストール
gcc 8 以上でないとコンパイルできないコードがあるため、 gcc のバージョンを上げて make する。
sudo apt-get install -y gcc-8sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8sudo make -j 12 &&sudo make modules_install -j 12 &&sudo make install -j 12
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hubBus 001 Device 019: ID 1bcf:2281 Sunplus Innovation Technology Inc.Bus 001 Device 002: ID 80ee:0021 VirtualBox USB TabletBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
今回の場合、 Vendor ID: 0x1bcf, Product ID: 2281 のものが Web カメラ。
mikoto@ubuntu:~$ lsusbBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hubBus 001 Device 002: ID 1bcf:2281 Sunplus Innovation Technology Inc.Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Vendor ID: 0x1bcf, Product ID: 0x2281 の、 Web カメラが認識されていることがわかる。