*安裝GPU driver** Disable Secure Boot From the BIOS(VM記得將Secure Boot關閉) step 1 使用 lshw 指令檢查一下系統資訊,確認顯示卡的型號 ``` lshw -numeric -C display ``` step2 從 NVIDIA 網站 下載最新的顯示卡驅動程式 ``` wget https://us.download.nvidia.com/XFree86/Linux-x86_64/535.86.05/NVIDIA-Linux-x86_64-535.86.05.run ``` step3 安裝編譯器等基本開發工具 ``` yum groupinstall "Development Tools" ``` ``` yum install kernel-devel ``` 安裝epel套件 ``` sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms ``` ``` sudo dnf install \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm ``` ``` sudo dnf install inxi ``` 安裝動態核心模組支援(Dynamic Kernel Module Support,DKMS) ``` yum install dkms ``` step4 停用 nouveau 這個開放原始碼的顯示卡驅動程式 ``` # 修改 GRUB 設定 sudo vi /etc/default/grub ``` 將 GRUB_CMDLINE_LINUX 的參數後方加上 nouveau.modeset=0 ``` GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet nouveau.modeset=0" GRUB_DISABLE_RECOVERY="true" ``` step5 執行 grub2-mkconfig 產生新的 GRUB 設定檔 ``` # 更新 GRUB 設定檔(BIOS) sudo grub2-mkconfig -o /boot/grub2/grub.cfg # 更新 GRUB 設定檔(UEFI) sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg ``` step6 重新啟動作業系統。接著使用 lshw 指令再檢查一下系統資訊,確認 nouveau 已被停用 ``` lshw -numeric -C display ``` step7 執行剛剛下載的 NVIDIA 驅動程式安裝檔案 ``` # 執行 NVIDIA 驅動程式安裝檔案 sudo bash NVIDIA-Linux-x86_64-*.run ``` 安裝完成後,重新啟動系統 --------------------------------------------- **安裝Docker&Nvidia-docker** ``` sudo dnf update -y ``` ``` sudo dnf install -y yum-utils device-mapper-persistent-data lvm2 ``` ``` sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo ``` ``` sudo dnf install -y docker-ce --nobest ``` ``` sudo systemctl enable --now docker ``` ``` sudo systemctl status docker ``` ``` sudo docker --version ``` ``` curl https://nvidia.github.io/nvidia-docker/rhel9.0/nvidia-docker.repo > /etc/yum.repos.d/nvidia-docker.repo ``` ``` dnf -y install nvidia-container-toolkit ``` ``` sudo systemctl restart docker ``` ------------------------------------------------------- **安裝Jupyter** ``` mkdir work ``` ``` cd work ``` ``` wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/fashion_mnist_tf_example/versions/1.0/zip -O fashion_mnist_tf_example_1.0.zip ``` ``` unzip XXX.zip ``` ``` docker run --gpus 'device=0' -it --rm -p 8083:8888 \ -v /home/harry/work:/workspace \ nvcr.io/nvidia/tensorflow:19.12-tf2-py3 ``` ``` pip install notebook ``` ``` jupyter notebook --ip 0.0.0.0 --allow-root --port 8888 & ``` **Jupyter Terminal需安裝matplotlib元件** ``` pip install matplotlib ``` ***停止Docker*** ``` docker ps ``` ``` docker stop silly_lamarr ``` ***進入docker workspace*** ``` docker attach+docker ps 前面英文&數字編號 ``` ***查看顯示介面 ``` lspci | egrep 'VGA|3D' lsmod | grep nouveau lsmod | grep nvidia ``` ***Red Hat 更改權限 ``` sudo usermod -aG docker harry ``` ``` sudo vim /etc/group ``` ***參考文獻:*** https://linuxhint.com/install-nvidia-drivers-rhel-9/ https://tecadmin.net/how-to-install-docker-on-centos-stream-9/ https://www.ibm.com/docs/zh-tw/maximo-vi/continuous-delivery?topic=planning-installing-docker-nvidia-docker2#installing-sitedatakeyworddocker-and-nvidia-docker2__section_mz1_pdm_bvb https://access.redhat.com/discussions/6967008 ```= sudo docker images ``` ``` 更新container到images docker commit -m="has update" -a="stan" "container ID" ubuntu:v2 -m(自行設附註) -a(使用者) container ID(docker的CONTAINER ID) ubuntu(Name) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up