source code 的 Makefile, install :
- build from source assign prefix=~/mymender
- make install
- copy all mymender to /
- start service
如果 dist 的版本太舊。可以用官網的 tar 安裝。
make 前先..
export DESTDIR=/home/pi/instmake 完,make install
go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=7cb96ca" install -m 755 -d /home/pi/inst/usr/bin install -m 755 mender /home/pi/inst/usr/bin/ install -m 755 -d /home/pi/inst/etc/mender echo "artifact_name=unknown" > /home/pi/inst/etc/mender/artifact_info install -m 755 -d /home/pi/inst/usr/share/mender install -m 755 -d /home/pi/inst/usr/share/dbus-1/system.d install -m 644 support/dbus/io.mender.AuthenticationManager.conf /home/pi/inst/usr/share/dbus-1/system.d/ install -m 755 -d /home/pi/inst/usr/share/doc/mender-client/examples install -m 0644 support/demo.crt /home/pi/inst/usr/share/doc/mender-client/examples/ install -m 755 -d /home/pi/inst/usr/share/mender/identity install -m 755 support/mender-device-identity /home/pi/inst/usr/share/mender/identity/ install -m 755 -d /home/pi/inst/usr/share/mender/inventory install -m 755 support/mender-inventory-bootloader-integration support/mender-inventory-hostinfo support/mender-inventory-network support/mender-inventory-os support/mender-inventory-provides support/mender-inventory-rootfs-type support/mender-inventory-update-modules /home/pi/inst/usr/share/mender/inventory/ install -m 755 -d /home/pi/inst/usr/share/mender/inventory install -m 755 support/mender-inventory-geo /home/pi/inst/usr/share/mender/inventory/ install -m 755 -d /home/pi/inst/usr/share/mender/modules/v3 install -m 755 support/modules/deb support/modules/docker support/modules/directory support/modules/single-file support/modules/rpm support/modules/script /home/pi/inst/usr/share/mender/modules/v3/ install -m 755 -d /home/pi/inst/lib/systemd/system install -m 0644 support/mender-client.service /home/pi/inst/lib/systemd/system/看一下 inst..
├── etc │ └── mender │ └── artifact_info ├── lib │ └── systemd │ └── system │ └── mender-client.service └── usr ├── bin │ └── mender └── share ├── dbus-1 │ └── system.d │ └── io.mender.AuthenticationManager.conf ├── doc │ └── mender-client │ └── examples │ └── demo.crt └── mender ├── identity │ └── mender-device-identity ├── inventory │ ├── mender-inventory-bootloader-integration │ ├── mender-inventory-geo │ ├── mender-inventory-hostinfo │ ├── mender-inventory-network │ ├── mender-inventory-os │ ├── mender-inventory-provides │ ├── mender-inventory-rootfs-type │ └── mender-inventory-update-modules └── modules └── v3 ├── deb ├── directory ├── docker ├── rpm ├── script └── single-file 18 directories, 20 files然後舊可以把 inst 下對應的 folder copy 到系統的 ../
debian 的 /lib 是 link 到 /usr/lib,所以要 copy 到 /usr
然後參考 demo server 的 script,手動:
$ sudo mender setup --device-type "raspberrypi3" --quiet --demo --server-ip 192.168.144.179生成的 /etc/mender/mender.conf
{ "ClientProtocol": "https", "ArtifactVerifyKey": "", "HttpsClient": { "Certificate": "", "Key": "", "SSLEngine": "" }, "Security": { "AuthPrivateKey": "", "SSLEngine": "" }, "RootfsPartA": "", "RootfsPartB": "", "DeviceTypeFile": "/var/lib/mender/device_type", "DBus": { "Enabled": true }, "UpdatePollIntervalSeconds": 5, "InventoryPollIntervalSeconds": 5, "SkipVerify": false, "RetryPollIntervalSeconds": 30, "StateScriptTimeoutSeconds": 0, "StateScriptRetryTimeoutSeconds": 0, "StateScriptRetryIntervalSeconds": 0, "ModuleTimeoutSeconds": 0, "ServerCertificate": "/usr/share/doc/mender-client/examples/demo.crt", "ServerURL": "", "UpdateLogPath": "", "TenantToken": "", "Servers": [ { "ServerURL": "https://docker.mender.io" } ] }然後 /etc/hosts 多了一行:
192.168.144.179 docker.mender.io s3.docker.mender.io重新開機後...
~ $ sudo systemctl status mender-client ● mender-client.service - Mender OTA update service Loaded: loaded (/lib/systemd/system/mender-client.service; disabled; vendor preset: enabled) Active: inactive (dead)所以手動啟動...systemctl start mender-client
之後,在 local 的 mender server 上就可以看到 pending device 了..
同樣的 方法在 ubuntu 上做,結果 fail.. journalctl -r
Jan 29 10:05:16 ubuntu mender[2068]: time="2021-01-29T10:05:16Z" level=error msg="Authorize failed: transient error: authorization request failed: transient error: authorization request failed: Unknown url.Error type: dial tcp 192.168.144.79:443: connect: connection refused" Jan 29 10:05:16 ubuntu mender[2068]: time="2021-01-29T10:05:16Z" level=error msg="Failure occurred while executing authorization request: Method: Post, URL: https://docker.mender.io/api/devices/v1/authentication/auth_requests"
在 debian 上出現 self-sign error,所以修改一下
~ $ curl -k -X POST https://docker.mender.io/api/devices/v1/authentication/auth_requests {"error":"failed to decode auth request: unexpected end of JSON input","request_id":"f315ea65-8df2-4f8f-8d8a-67bca6947014"}所以跟 distribution 有關?
用 nmap 檢查...
pi@raspberrypi:~ $ nmap docker.mender.io Starting Nmap 7.70 ( https://nmap.org ) at 2021-01-29 10:32 GMT Nmap scan report for docker.mender.io (192.168.144.179) Host is up (0.0014s latency). Not shown: 992 closed ports PORT STATE SERVICE 22/tcp open ssh 111/tcp open rpcbind 139/tcp open netbios-ssn 443/tcp open https 445/tcp open microsoft-ds 2049/tcp open nfs 8084/tcp open unknown 9000/tcp open cslistener Nmap done: 1 IP address (1 host up) scanned in 0.36 seconds
星期一 gateway pc 重開機後,手動build, install 的 rpi3 ubuntu arm64 可以正確註冊到 demo server 上了 (不是 gateway 上的)。
demo server 的 nmap 正確list port 443
所以上面的build, install 程序應該 OK
恢復到 不 enable dbus lzma
make TAGS=nolzma nodbus
實際在 evb 上安裝,發現只需要..
* mender : 執行檔 * demo.crt : cert file * mender-device-identity : script to get board mac address, name and system property * artifact_info : info file * mender-client.service : systemd service config file安裝完 run mender setup .. 就會產生 mender.conf. 和 修改 /etc/hosts...
mender 會 call 其他 sys tool,所以systemd 的 service conf 要能 access 到 system tool (/bin ?)
所以大概是..
[Unit] Description=Mender OTA update service After=network.target [Service] Type=idle User=root Group=root #ExecStart=/usr/bin/mender daemon ExecStart=/bin/bash -c "PATH=/bin: exec /usr/bin/mender daemon" [Install] WantedBy=multi-user.target安裝在 /usr/lib/system/system/ 下的 mender-client.serivce,手動 systemctl start 成功後。就可以用 systemctl enable mender-client 把他設定為系統開機就啟動。
-- 會 create link 到 /etc/systemd/system/multi-usr.targt
沒有留言:
張貼留言