Alpine Linux 操作整理

  • Exp. 設定為台北時間

    apk add tzdata
    cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
    echo "Asia/Taipei" > /etc/timezone
    apk del tzdata

  • 實際操作過程
  • 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
  • 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

  1. 更新目前版本到最新版

    apk update
    apk upgrade

  2. 更新 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
  3. 進行更新 repo

    apk update

  4. 進行升級

    apk upgrade --available && sync

  5. 重新開機讓升級生效

    reboot

  • 安裝步驟

    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
  • 安裝步驟

    apk add net-snmp

  • 編輯 /etc/snmp/snmpd.conf
  • 啟動 snmpd

    rc-update add snmpd
    rc-service snmpd start

  • 啟用 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

2024/04/08 00:24Jonathan Tsai
2024/04/07 23:17Jonathan Tsai
2024/02/01 11:55Jonathan Tsai
2023/12/29 15:47Jonathan Tsai
2023/11/21 13:53Jonathan Tsai
2023/11/15 00:33Jonathan Tsai
2023/10/27 06:54Jonathan Tsai
2023/01/13 09:08Jonathan Tsai
2022/02/04 22:22Jonathan Tsai
2022/01/10 16:30Jonathan Tsai
2021/12/08 16:51Jonathan Tsai
2021/12/08 11:50Jonathan Tsai
2021/07/09 07:43Jonathan Tsai
2021/07/08 16:31Jonathan Tsai
  • tech/alpine.txt
  • 上一次變更: 2024/08/15 15:07
  • jonathan