Add 2024-04-01_LXC 安裝 Windows 11,並分享 i915 內顯
This commit is contained in:
29
content/posts/2023/2023-03-03_解決 Qt 線上安裝很慢的問題/index.md
Normal file
29
content/posts/2023/2023-03-03_解決 Qt 線上安裝很慢的問題/index.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
slug: 解決 Qt 線上安裝很慢的問題
|
||||
title: 解決 Qt 線上安裝很慢的問題
|
||||
description:
|
||||
toc: true
|
||||
authors: [awin]
|
||||
tags: [qt]
|
||||
categories: [Programming]
|
||||
series: [Software note]
|
||||
date: 2023-03-03T00:00:00
|
||||
lastmod: 2023-03-03T00:00:00
|
||||
featuredVideo:
|
||||
featuredImage:
|
||||
draft: false
|
||||
enableComment: true
|
||||
---
|
||||
|
||||
`qt-unified-windows-x86-4.0.1-1-online.exe` 預設的 server 真的很慢,甚至會發生校驗錯誤的情況。
|
||||
|
||||
<!--more-->
|
||||
|
||||
可以在[Qt Downloads](https://download.qt.io/static/mirrorlist/)選 mirror server,然後在安裝的時候指定使用它。
|
||||
|
||||
例如我選的是 Yamagata University 的 mirror server,如下:
|
||||
```cmd
|
||||
qt-unified-windows-x64-4.7.0-online.exe --mirror https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/
|
||||
```
|
||||
|
||||
下載速度從 1~2 MB/s 進步到 25MB/s 左右。
|
||||
60
content/posts/2024/2024-01-08_線上備份樹莓派/index.md
Normal file
60
content/posts/2024/2024-01-08_線上備份樹莓派/index.md
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
slug: 線上備份樹莓派
|
||||
title: 線上備份樹莓派
|
||||
description:
|
||||
toc: true
|
||||
authors: [awin]
|
||||
tags: [raspberrypi]
|
||||
categories: [system]
|
||||
series: [Raspberry Pi]
|
||||
date: 2024-01-08T00:00:00
|
||||
lastmod: 2024-01-08T00:00:00
|
||||
featuredVideo:
|
||||
featuredImage:
|
||||
draft: false
|
||||
enableComment: true
|
||||
---
|
||||
|
||||
`image-backup` 是 `image-utils` 裡面的一個工具,可以直接把樹莓派系統直接備份到另一個檔案,不用拔卡或是關機,非常方便。
|
||||
<!--more-->
|
||||
`image-utils` 的Github repo在:[seamusdemora/RonR-RPi-image-utils: tools to create a backup of a running Raspbian system to an SD card image file](https://github.com/seamusdemora/RonR-RPi-image-utils)
|
||||
|
||||
## 安裝 `image-utils`
|
||||
```shell
|
||||
cd && mkdir ~/image-utilities && cd ~/image-utilities
|
||||
wget -O image.zip "https://forums.raspberrypi.com/download/file.php?id=63044&sid=58c9d2d90272e5ae96c12a58a30731d9"
|
||||
unzip ./image.zip
|
||||
chmod a+x image-*
|
||||
```
|
||||
|
||||
## 備份
|
||||
在 `~/image-utilities` 目錄下執行 `image-backup` 會以對話的方式來備份,像是這樣:
|
||||
```shell
|
||||
sudo ./image-backup
|
||||
|
||||
Image file to create? /media/backup/pi4_sd_backup.img ## 輸入檔案路徑,例子是/media/backup/pi4_sd_backup.img
|
||||
|
||||
Initial image file ROOT filesystem size (MB) [11631]? ## 按 Enter 跳過,使用 default 值
|
||||
|
||||
Added space for incremental updates after shrinking (MB) [0]? ## 按 Enter 跳過,使用 default 值
|
||||
|
||||
Create /media/backup/pi4_sd_backup.img (y/n)? y ## 按 y
|
||||
```
|
||||
|
||||
然後就會開始備份系統,過程會花上一些時間,取決於你的系統大小與檔案寫的速度。
|
||||
|
||||
## 自動備份
|
||||
但是這樣每次都要手動操作很麻煩,像下面這樣一個命令解決比較方便:
|
||||
```shell
|
||||
sudo ./image-backup -i /media/backup/pi4.img
|
||||
```
|
||||
|
||||
這樣就可以透過`crontab`自動執行了。
|
||||
|
||||
## 增量備份
|
||||
如果已經備份過系統,下次備份的時候有指定上一次的備份檔,就會做增量備份,如下:
|
||||
```shell
|
||||
sudo ./image-backup /media/upload/pi4.img
|
||||
```
|
||||
|
||||
注意沒有 `-i` 這個選項。
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 371 B |
@@ -0,0 +1,355 @@
|
||||
---
|
||||
slug: LXC 安裝 Windows 11,並分享 i915 內顯
|
||||
title: LXC 安裝 Windows 11,並分享 i915 內顯
|
||||
description:
|
||||
toc: true
|
||||
authors: [awin]
|
||||
tags: [linux, lxc, windows]
|
||||
categories: [system]
|
||||
series: [Windows, Linux]
|
||||
date: 2024-04-01T00:00:00
|
||||
lastmod: 2024-04-01T00:00:00
|
||||
featuredVideo:
|
||||
featuredImage:
|
||||
draft: false
|
||||
enableComment: true
|
||||
---
|
||||
這裡分享我在 Ubuntu Server 22.04 用 LXC 安裝 Windows 11,以及分享內顯 i915給虛擬機的的紀錄。
|
||||
要讓虛擬機可以使用 GPU,最常見的是 GPU passthrough,但是 GPU passthrough 只能給一個虛擬機使用,要讓多個虛擬機同時使用的話,必須打開 i915 的 SR-IOV ,可以多 7 個 VGA 來分享給虛擬機。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 準備
|
||||
|
||||
### 安裝 incus
|
||||
|
||||
根據 https://linuxcontainers.org/incus/docs/main/installing/#installing 的說明,Ubuntu 22.04 還沒辦法使用 apt 來安裝,因此依照 https://github.com/zabbly/incus 的說明來安裝:
|
||||
|
||||
```shell
|
||||
curl -fsSL https://pkgs.zabbly.com/key.asc | gpg --show-keys --fingerprint
|
||||
mkdir -p /etc/apt/keyrings/
|
||||
sudo curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
|
||||
|
||||
sudo sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
|
||||
Enabled: yes
|
||||
Types: deb
|
||||
URIs: https://pkgs.zabbly.com/incus/stable
|
||||
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
|
||||
Components: main
|
||||
Architectures: $(dpkg --print-architecture)
|
||||
Signed-By: /etc/apt/keyrings/zabbly.asc
|
||||
EOF'
|
||||
|
||||
sudo apt update
|
||||
sudo apt install incus
|
||||
```
|
||||
|
||||
### 設定 incus
|
||||
|
||||
使用 `sudo incus admin init` 來設定,會問一堆問題,如下:
|
||||
|
||||
```
|
||||
Would you like to use clustering? (yes/no) [default=no]:
|
||||
Do you want to configure a new storage pool? (yes/no) [default=yes]: no
|
||||
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
|
||||
Would you like to use an existing bridge or host interface? (yes/no) [default=no]: yes
|
||||
Name of the existing bridge or host interface: enp3s0
|
||||
Would you like the server to be available over the network? (yes/no) [default=no]: yes
|
||||
Address to bind to (not including port) [default=all]:
|
||||
Port to bind to [default=8443]:
|
||||
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]:
|
||||
Would you like a YAML "init" preseed to be printed? (yes/no) [default=no]:
|
||||
```
|
||||
|
||||
大部分都預設就可以。
|
||||
|
||||
### 建立 pool
|
||||
|
||||
```shell
|
||||
sudo incus storage create vmpool dir source=/lvm1/lxd_storage
|
||||
```
|
||||
|
||||
### 建立 profile
|
||||
|
||||
```shell
|
||||
sudo incus profile copy default windows
|
||||
```
|
||||
|
||||
編輯profile,內容如下:
|
||||
|
||||
```
|
||||
config:
|
||||
limits.cpu: "16"
|
||||
limits.memory: 16GiB
|
||||
raw.qemu: -device intel-hda -device hda-duplex -audio spice
|
||||
description: 'Windows: 16CPU, 16GB RAM, 1024GB DISK'
|
||||
devices:
|
||||
eth0:
|
||||
name: eth0
|
||||
nictype: macvlan
|
||||
parent: br0
|
||||
type: nic
|
||||
root:
|
||||
path: /
|
||||
pool: vmpool
|
||||
type: disk
|
||||
vtpm:
|
||||
path: /dev/tpm0
|
||||
type: tpm
|
||||
name: windows
|
||||
used_by: []
|
||||
```
|
||||
|
||||
### 安裝需要的套件
|
||||
|
||||
```shell
|
||||
sudo apt-get install genisoimage libguestfs-tools wimtools --yes
|
||||
sudo snap install distrobuilder --classic
|
||||
```
|
||||
|
||||
### 轉換 ISO
|
||||
|
||||
我們需要把Windows ISO轉換為lxc可用的ISO,先準備好原本的Windows ISO,這裡的檔名是 `Win11_23H2_Chinese_Traditional_x64v2.iso`,記得換成你自己的檔名。
|
||||
命令如下:
|
||||
|
||||
```shell
|
||||
sudo distrobuilder repack-windows Win11_23H2_Chinese_Traditional_x64v2.iso Win11_23H2_Chinese_Traditional_x64v2.lxd.iso
|
||||
```
|
||||
|
||||
我們把 `Win11_23H2_Chinese_Traditional_x64v2.iso` 轉為 `Win11_23H2_Chinese_Traditional_x64v2.lxd.iso`。
|
||||
|
||||
等一下 `Win11_23H2_Chinese_Traditional_x64v2.lxd.iso` 就是要餵給虛擬機安裝的檔案。
|
||||
|
||||
### 讓操作端跟 server 端可以互連
|
||||
|
||||
因為 Ubuntu server 沒有 GUI,都是透過命令操作,所以當虛擬機開機之後沒有辦法顯示畫面。所以我們需要從另一台 Windows 來把虛擬機開機,並在這台 Windows 上顯示並操作安裝畫面,這樣才可以安裝 Windows 虛擬機。
|
||||
|
||||
Ubuntu server 我們就稱為 server 端。
|
||||
Windows 這邊我們就稱為操作端。
|
||||
|
||||
#### server 端
|
||||
|
||||
這邊我們要讓 lxc 新增一個操作端,如下:
|
||||
|
||||
```shell
|
||||
sudo incus config trust add awn-pc1
|
||||
```
|
||||
|
||||
然後會跳出一堆字串,類似這樣:
|
||||
|
||||
```
|
||||
ucRZ8JO48d4J32MRZ1tuuvNh3Wg86Pb7LZ4QKk090BM3jA2SIRh9aDB1mQ4dZ0H76PJll1bb0YkG2ZK8l5YYPWX5Cw4UhVs2li722P5s7A45MW4B5WBXBQXFPT170L50MsMMjB8ZiVhO6Ug2JWXGwdxp897u8cELqE6AAbA901uUCBwo80qr5czfR2Pk3QS7JCRb9LFa6uKKQsQKSDHm76814UOD3Knf50E9cq3GB6C28A0B54NKBw9T5004ZQ75QqCZqBD0F32mjfAILGCI57R09RN81LHMJ0NLVAXAKQc2LTh0aHYjsO6J41ERLAQF8bk7T07cG4611YT6F57Y6lr93ZSc5L0W7F5R5RG7Xr6e0gJ6dXh5iI18uwpUrZ6MAhN6GSUSGYTqe218He5gLa3G3UMNAJY1PlLSShcV91UF3Z18QloVR8DP9O6wYa7R9LG2Cv04MDSIK8Hs94ZPQ4hsbS1BT2J5QqZ41su06R9a8WTjP9rX8hNsQz5x5744AJl2656SdUqbos4JKX9B2IbGheqK94D7Ya0SZYiODX7Y5rIWdH1P6M6e5J75nN6En0Y9UmgRCGE2WIeG6jXFhpb7
|
||||
```
|
||||
|
||||
這個記下來,等一下要在操作端輸入。
|
||||
|
||||
#### 操作端
|
||||
|
||||
命令:
|
||||
|
||||
```
|
||||
incus remote add awin-pc2 192.168.1.24
|
||||
```
|
||||
|
||||
然後輸入剛剛那一串字串。
|
||||
|
||||
接著命令:
|
||||
|
||||
```
|
||||
incus switch awin-pc2
|
||||
```
|
||||
|
||||
之後就可以在操作端啟動 server 端的虛擬機了。
|
||||
|
||||
## 建立虛擬機
|
||||
|
||||
server 端命令:
|
||||
|
||||
```shell
|
||||
sudo incus init --empty --vm --profile=windows MY-VM-WIN11
|
||||
sudo incus config device add MY-VM-WIN11 install disk source=/home/awin/lxd/Win11_23H2_Chinese_Traditional_x64v2.lxd.iso boot.priority=10
|
||||
```
|
||||
|
||||
操作端命令:
|
||||
|
||||
```shell
|
||||
incus start MY-VM-WIN11 --console=vga
|
||||
```
|
||||
|
||||
操作端會跳出一個新視窗,然後就是 Windows 的安裝流程,記得在 "Press any key to boot from CD" 文字出現的時候趕快按一個鍵進入安裝流程。
|
||||
來不及的話,左上角按鈕可以發送 `ctrl+alt+del` 來重新開機。
|
||||
|
||||
這邊要注意的是,一旦發生重開機的狀況,剛剛那個視窗會關掉,然後跳一堆錯誤訊息,像是:
|
||||
|
||||
```
|
||||
(remote-viewer.exe:23816): GSpice-CRITICAL **: 22:48:14.989: _usbdk_hider_update: assertion 'priv->usbdk_api != NULL' failed
|
||||
|
||||
(remote-viewer.exe:23816): GLib-GIO-WARNING **: 22:48:15.475: Unexpectedly, UWP app `Microsoft.OutlookForWindows_1.2024.214.400_x64__8wekyb3d8bbwe' (AUMId `Microsoft.OutlookForWindows_8wekyb3d8bbwe!Microsoft.OutlookforWindows') supports 4 extensions but has no verbs
|
||||
|
||||
(remote-viewer.exe:23816): GLib-GIO-WARNING **: 22:48:15.598: Unexpectedly, UWP app `Microsoft.ScreenSketch_11.2401.37.0_x64__8wekyb3d8bbwe' (AUMId `Microsoft.ScreenSketch_8wekyb3d8bbwe!App') supports 29 extensions but has no verbs
|
||||
|
||||
(remote-viewer.exe:23816): GLib-GIO-WARNING **: 22:48:15.600: Unexpectedly, UWP app `Clipchamp.Clipchamp_3.0.10220.0_neutral__yxz26nhyzhsrt' (AUMId `Clipchamp.Clipchamp_yxz26nhyzhsrt!App') supports 41 extensions but has no verbs
|
||||
|
||||
(remote-viewer.exe:23816): GSpice-CRITICAL **: 22:48:15.677: _usbdk_hider_update: assertion 'priv->usbdk_api != NULL' failed
|
||||
|
||||
(remote-viewer.exe:23816): GSpice-WARNING **: 22:48:15.677: Warning no automount-inhibiting implementation available
|
||||
Error: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp 192.168.1.24:8443->192.168.1.154:50714: write: broken pipe
|
||||
```
|
||||
|
||||
這時用 `incus console MY-VM-WIN11 --type=vga` 就可以再次連上已開機的虛擬機,不要用 `incus start MY-VM-WIN11 --console=vga`。
|
||||
只要虛擬機沒有關機,就是用 `incus console MY-VM-WIN11 --type=vga` 來連上畫面。
|
||||
關機的情況下才是用 `incus start MY-VM-WIN11 --console=vga` 來開機並顯示畫面。
|
||||
|
||||
再來 Windows 11 沒有網路會無法安裝,所以要跳過網路檢查,在最早的安裝畫面按 `shift+F10` 打開 command line,然後輸入:
|
||||
|
||||
```
|
||||
oobe/bypassnro
|
||||
```
|
||||
|
||||
安裝之後,把虛擬機連上 macvlan。
|
||||
|
||||
```shell
|
||||
sudo incus config device override MY-VM-WIN11 eth0 nictype=macvlan
|
||||
```
|
||||
|
||||
這樣虛擬機就有網路了。
|
||||
|
||||
### 虛擬機裝好之後
|
||||
|
||||
#### 虛擬機操作
|
||||
|
||||
1. 把遠端桌面連線打開
|
||||
2. 下載 driver: [virtio-win-guest-tools.exe](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.248-1/virtio-win-guest-tools.exe) ,然後安裝。
|
||||
|
||||
## 分享內顯給虛擬機
|
||||
|
||||
### 準備
|
||||
|
||||
安裝需要的套件
|
||||
|
||||
```shell
|
||||
apt install build-* dkms
|
||||
```
|
||||
|
||||
確認你的 kernel 是 6.1 ~ 6.5:
|
||||
|
||||
```shell
|
||||
uname -r
|
||||
# 6.5.0-26-generic
|
||||
```
|
||||
|
||||
### 安裝 i915 Driver
|
||||
|
||||
下載 i915 Driver:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/strongtz/i915-sriov-dkms
|
||||
```
|
||||
|
||||
進到剛剛 clone 的目錄,修改 `dkms.conf`,把 `PACKAGE_NAME` 改為 `"i915-sriov-dkms"`,把 `PACKAGE_VERSION` 改為 `"6.5"`,看你的 kernel 版號多少就改多少。我的版本是 6.5 ,所以這裡填 6.5。
|
||||
|
||||
```shell
|
||||
cd i915-sriov-dkms
|
||||
nano dkms.conf
|
||||
|
||||
# 前 2 行改成這樣
|
||||
# dkms.conf
|
||||
PACKAGE_NAME="i915-sriov-dkms"
|
||||
PACKAGE_VERSION="6.5"
|
||||
```
|
||||
|
||||
安裝 driver:
|
||||
|
||||
```shell
|
||||
# 記得要在 i915-sriov-dkms 這目錄裡面
|
||||
dkms add .
|
||||
dkms install -m i915-sriov-dkms -v 6.5
|
||||
dkms remove -m i915-sriov-dkms -v 6.5
|
||||
dkms install -m i915-sriov-dkms -v 6.5
|
||||
```
|
||||
|
||||
如果有出現類似以下的錯誤:
|
||||
|
||||
```
|
||||
update-initramfs: Generating /boot/initrd.img-6.5.0-26-generic
|
||||
W: Possible missing firmware /lib/firmware/i915/mtl_gsc_102.0.0.1511.bin for module i915
|
||||
W: Possible missing firmware /lib/firmware/i915/mtl_huc_8.4.3_gsc.bin for module i915
|
||||
W: Possible missing firmware /lib/firmware/i915/mtl_guc_70.6.4.bin for module i915
|
||||
```
|
||||
|
||||
去 [https://cgit.freedesktop.org/drm/drm-firmware/refs/](https://cgit.freedesktop.org/drm/drm-firmware/refs/) 把檔案找出來,放到 `/lib/firmware/i915/` 然後再重新安裝。
|
||||
|
||||
檢查是否有安裝成功:
|
||||
|
||||
```shell
|
||||
modinfo i915 | grep vf
|
||||
|
||||
# 應該要出現如下訊息
|
||||
# parm: max_vfs:Limit number of virtual functions to allocate. (0 = no VFs [default]; N = allow up to N VFs) (uint)
|
||||
```
|
||||
|
||||
如果沒有就重新安裝試試。
|
||||
|
||||
修改 grub:
|
||||
|
||||
```shell
|
||||
nano /etc/default/grub
|
||||
|
||||
# "GRUB_CMDLINE_LINUX_DEFAULT" 這一行加入:"quiet intel_iommu=on i915.enable_guc=3 i915.max_vfs=7",如下:
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on i915.enable_guc=3 i915.max_vfs=7"
|
||||
```
|
||||
|
||||
更新 grub 和 initramfs:
|
||||
|
||||
```shell
|
||||
update-initramfs -u -k all
|
||||
update-grub
|
||||
```
|
||||
|
||||
開機自動自動設定 vGPU 的數量:
|
||||
|
||||
```shell
|
||||
sudo nano /etc/rc.local
|
||||
|
||||
# 加入
|
||||
echo 7 > /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs
|
||||
```
|
||||
|
||||
然後 `sudo chmod +x /etc/rc.local`
|
||||
|
||||
重開機,開機之後檢查 VGA 數量是不是有 8 個(1 個是原本的,另外 7 個是可以分享給虛擬機的 )。
|
||||
|
||||
```shell
|
||||
lspci | grep 00:02
|
||||
|
||||
# 應該找到 8 個
|
||||
00:02.0 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.1 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.2 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.3 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.4 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.5 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.6 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
00:02.7 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
|
||||
```
|
||||
|
||||
### 設定 vGPU 給虛擬機
|
||||
|
||||
可以分享的 VGA 有 `00:02.1` ~ `00:02.7` ,然後在虛擬機裡面新增一個 device:
|
||||
|
||||
```shell
|
||||
sudo incus config device add MY-VM-WIN11 gpu pci address=0000:00:02.1
|
||||
```
|
||||
|
||||
然後在操作端把虛擬機開機:
|
||||
|
||||
```
|
||||
incus start MY-VM-WIN11 --console=vga
|
||||
```
|
||||
|
||||
這時後會變成黑畫面,像這樣:
|
||||

|
||||
|
||||
大概等個 1~3 分鐘就會跳出開機畫面了。
|
||||
|
||||
開機好之後,裝置管理員會出現一張顯卡,去 Windows Update 更新,就會出現 Intel UHD 770 顯示卡了。
|
||||
10
deploy.sh
10
deploy.sh
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONTAINER_DIR="/lvm1/docker/blog"
|
||||
IP_ADDR="192.168.1.24"
|
||||
|
||||
../../bin/0.100.1_extend/hugo.exe
|
||||
ssh -t awin@awinpi4 "rm -rf /home/awin/docker/blog/data/*"
|
||||
scp -r ./public/* awin@awinpi4:/home/awin/docker/blog/data/
|
||||
ssh -t awin@awinpi4 "sudo docker compose -f /home/awin/docker/blog/docker-compose.yml down ; sudo docker compose -f /home/awin/docker/blog/docker-compose.yml up -d"
|
||||
ssh -t awin@${IP_ADDR} "rm -rf ${CONTAINER_DIR}/data/*"
|
||||
scp -r ./public/* awin@${IP_ADDR}:${CONTAINER_DIR}/data
|
||||
ssh -t awin@${IP_ADDR} "sudo docker compose -f ${CONTAINER_DIR}/docker-compose.yml down ; sudo docker compose -f ${CONTAINER_DIR}/docker-compose.yml up -d"
|
||||
rm -rf public
|
||||
|
||||
10
deploy_pi4.sh
Normal file
10
deploy_pi4.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONTAINER_DIR="/home/awin/docker/blog"
|
||||
IP_ADDR="192.168.1.22"
|
||||
|
||||
../../bin/0.100.1_extend/hugo.exe
|
||||
ssh -t awin@${IP_ADDR} "rm -rf ${CONTAINER_DIR}/data/*"
|
||||
scp -r ./public/* awin@${IP_ADDR}:${CONTAINER_DIR}/data
|
||||
ssh -t awin@${IP_ADDR} "sudo docker compose -f ${CONTAINER_DIR}/docker-compose.yml down ; sudo docker compose -f ${CONTAINER_DIR}/docker-compose.yml up -d"
|
||||
rm -rf public
|
||||
Reference in New Issue
Block a user