Alpine Linux 操作整理
設定時區
- Exp. 設定為台北時間
apk add tzdata cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime echo "Asia/Taipei" > /etc/timezone apk del tzdata
更改 IP
- Exp. 設定 IP 為 192.168.11.60
vi /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.11.60 netmask 255.255.255.0 gateway 192.168.11.254
更改 hostname
- Exp. 設定 hostname 為 pve-alpine3
echo "pve-alpine3" > /etc/hostname hostname -F /etc/hostname vi /etc/hosts
: 127.0.0.1 alpine3.ichiayi.com pve-alpine3 localhost.localdomain localhost :
- 驗證修改後的 hostname
pve-alpine3:~# hostname pve-alpine3 pve-alpine3:~# hostname -f alpine3.ichiayi.com
Alpine 版本升級方式
- 更新目前版本到最新版
apk update apk upgrade
- 更新 apk repo 設定 Exp. 3.18 → 3.19
vi /etc/apk/repositories
#/media/cdrom/apks http://dl-cdn.alpinelinux.org/alpine/v3.19/main http://dl-cdn.alpinelinux.org/alpine/v3.19/community
- 進行更新 repo
apk update
- 進行升級
apk upgrade --available && sync
- 重新開機讓升級生效
reboot
安裝 SSH Server
- 安裝步驟
apk add openssh rc-update add sshd rc-status rc-service sshd start
- 如果要讓 root 可以登入, 就要修改 /etc/ssh/sshd_config 內的 PermitRootLogin 定義
: #LoginGraceTime 2m PermitRootLogin yes :
然後重啟服務
rc-service sshd restart
安裝 snmpd Server
- 安裝步驟
apk add net-snmp
- 編輯 /etc/snmp/snmpd.conf
- 啟動 snmpd
rc-update add snmpd rc-service snmpd start
安裝 Qemu-Agent
- 啟用 community 套件來源
vi /etc/apk/repositories
: #/media/cdrom/apks http://mirror.dst.ca/alpine/v3.16/main http://mirror.dst.ca/alpine/v3.16/community #http://mirror.dst.ca/alpine/edge/main #http://mirror.dst.ca/alpine/edge/community #http://mirror.dst.ca/alpine/edge/testing
- 進行更新與安裝
apk update; apk upgrade apk add qemu-guest-agent
- 確認 vport 的位置
pve-airsonic:~# ls -lt /dev/vport* crw------- 1 root root 242, 1 Jan 30 11:06 /dev/vport1p1
- 修改 /etc/conf.d/qemu-guest-agent 設定 GA_PATH=“/dev/vport1p1”
: # Specifies the device path for the communications back to QEMU on the host # Default: /dev/virtio-ports/org.qemu.guest_agent.0 GA_PATH="/dev/vport1p1"
- 讓設定生效
rc-update add qemu-guest-agent rc-service qemu-guest-agent restart
其他安裝 Alpine 服務
2024/04/08 00:24 | Jonathan Tsai | |
2024/04/07 23:17 | Jonathan Tsai | |
2024/02/01 11:55 | Jonathan Tsai | |
2023/12/29 15:47 | Jonathan Tsai | |
2023/11/21 13:53 | Jonathan Tsai | |
2023/11/15 00:33 | Jonathan Tsai | |
2023/10/27 06:54 | Jonathan Tsai | |
2023/01/13 09:08 | Jonathan Tsai | |
2022/02/04 22:22 | Jonathan Tsai | |
2022/01/10 16:30 | Jonathan Tsai | |
2021/12/08 16:51 | Jonathan Tsai | |
2021/12/08 11:50 | Jonathan Tsai | |
2021/07/09 07:43 | Jonathan Tsai | |
2021/07/08 16:31 | Jonathan Tsai |