中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Alpine Linux怎么安裝到Raspberry Pi

發布時間:2021-10-22 09:31:07 來源:億速云 閱讀:363 作者:柒染 欄目:互聯網科技

今天就跟大家聊聊有關Alpine Linux怎么安裝到Raspberry Pi,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。

Alpine Linux 安裝到 Raspberry Pi

This tutorial will help you install Alpine Linux on your Raspberry Pi.

Preparation

This section will help you format and partition your SD card:

  1. Download Alpine for Raspberry Pi tarball which is named as alpine-rpi-<version>-armhf.rpi.tar.gz. You will need version 3.2.0 or greater if you have a Raspberry Pi 2.

  2. Mount your SD card to your workstation

  3. Use gnome-disks or fdisk to create a FAT32 partition. If you are using fdisk, the FAT32 partition type is called W95 FAT32 (LBA) and its ID is 0xC.

  4. Mark the newly created partition as bootable and save

  5. Mount the previously created partition

  6. Extract the tarball contents to your FAT32 partition

  7. Unmount the SD Card.

Note: Due to a bug (#7024), you might want to add a "usercfg.txt" file (which is included by config.txt) with enable_uart=1 written in it. Otherwise, the error message "Can't open /dev/ttyS0" will repeatedly be written to the console.

Installation

Alpine Linux will be installed as diskless mode, hence you need to use Alpine Local Backup (lbu) to save your modifications between reboots. Follow these steps to install Alpine Linux:

  1. Insert the SD Card into the Raspberry Pi and turn it on

  2. Login into the Alpine system as root. Leave the password empty.

  3. Type setup-alpine

  4. Once the installation is complete, commit the changes by typing lbu commit -d

Type reboot to verify that the installation was indeed successful.

Post Installation

Update the System

Upon installation, make sure that your system is up-to-date:

apk update apk upgrade

Don't forget to save the changes:

lbu commit -d

Clock-related error messages

During the booting time, you might notice errors related to the hardware clock. The Raspberry Pi does not have a hardware clock and therefore you need to disable the hwclock daemon and enable swclock:

rc-update add swclock boot # enable the software clock rc-update del hwclock boot # disable the hardware clock

Since Raspberry Pi does not have a clock, the Alpine Linux needs to know what the time is by using a Network Time Protocol (NTP) daemon. Make sure that you a NTP daemon installed and running. If you are not sure, then you can install NTP client by running the following command:

setup-ntp

Busybox NTP client might be the most lightweight solution. Save the changes and reboot, once the NTP software is installed and running:

lbu commit -d reboot

After reboot, make sure that the date command outputs the correct date and time.

X11 Setup

Here are what you need if you want to try and run a single X11 application like a browser kiosk or maybe even a desktop:

setup-xorg-base apk add xf86-video-fbdev xf86-input-mouse xf86-input-keyboard dbus setxkbmap rc-update add dbus

Also edit the default X11 module config: /etc/X11/xorg.conf.d/20-modules.conf

Section "Module" Load "fbdevhw" Load "fb" Load "shadow" Load "shadowfb" Load "dbe" Load "glx" Disable "dri" EndSection

Commit your changes:

lbu_commit -d

Now you should be able to run a browser or desktop. (Guides may follow)

If setup-xorg-base gives you an error regarding rc-update that fails to add mdev to sysinit just run:

rc-update mdev sysinit

to add it manually. If you skip this the next time you reboot your Raspberry Pi the screen maybe will not display anything on screen.

Persistent storage

Loopback image with overlayfs

The install is in disk-less mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD mounted with overlayfs.

First make the sd-card writable again and change fstab to always do so:

mount /media/mmcblk0p1 -o rw,remount sed -i 's/vfat\ ro,/vfat\ rw,' /etc/fstab

Create the loop-back file, this example is 1 GB:

dd if=/dev/zero of=/media/mmcblk0p1/persist.img bs=1024 count=0 seek=1048576

Install the ext utilities:

apk add e2fsprogs

Format the loop-back file:

mkfs.ext4 /media/mmcblk0p1/persist.img

Mount the storage:

echo "/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors=remount-ro 0 0" >> /etc/fstab mkdir /media/persist mount -a

Make the overlay folders, we are doing /usr here, but you can do /home or anything else:

mkdir /media/persist/usr mkdir /media/persist/.work echo "overlay /usr overlay lowerdir=/usr,upperdir=/media/persist/usr,workdir=/media/persist/.work 0 0" >> /etc/fstab mount -a

Your /etc/fstab should look something like this:

/dev/cdrom /media/cdrom iso9660 noauto,ro 0 0 /dev/usbdisk /media/usb vfat noauto,ro 0 0 /dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask=0022,dmask=0022,errors=remount-ro 0 0 /media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors=remount-ro 0 0 overlay /usr overlay lowerdir=/usr,upperdir=/media/persist/usr,workdir=/media/persist/.work 0 0

Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)

lbu_commit -d

Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the 'apk add', otherwise while it boots it will try and install it to memory and not to the persist storage.

If you do want to install something small at boot you can use `apk add` and `lbu commit -d`.

If it is something a bit bigger then you can use `apk add` but then not commit it, it will be persistent (in /user), but do check everything you need is in that directory and not in folders you have not made persistent.

Traditional disk-based (sys) installation

Alpine Linux怎么安裝到Raspberry Pi

Warning: This isn't yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.

It is also possible to switch to a fully disk-based installation: this is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.

Split your SD card into two partitions: the FAT32 boot partition described above (in this example it'll be mmcblk0p1) , and a second partition to hold the root filesystem (here it'll be mmcblk0p2). Boot and configure your diskless system as above, then create a root filesystem:

apk add e2fsprogs mkfs.ext4 /dev/mmcblk0p2

Now do a disk install via a mountpoint. The setup-disk script will give some errors about syslinux/extlinux, but you can ignore these: the Raspberry Pi doesn't need this to boot anyway.

mkdir /stage mount /dev/mmcblk0p2 /stage setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage # (ignore errors about syslinux/extlinux)

Add a line to /stage/etc/fstab to mount the Pi's boot partition again:

/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0

Now add a root=/dev/mmcblk0p2 parameter to the Pi's boot command line, either cmdline-rpi2.txt or cmdline-rpi.txt depending on model:

mount -o remount,rw /media/mmcblk0p1 sed -i '$ s/$/ root=\/dev\/mmcblk0p2/' /media/mmcblk0p1/cmdline-rpi2.txt

You might also consider overlaytmpfs=yes here, which will cause the underlying SD card root filesystem to be mounted read-only, with an overlayed tmpfs for modifications which will be discarded on shutdown.

Beware, though, that the contents of /boot will be ignored when the Pi boots: it will use the kernel, initramfs, and modloop images from the FAT32 boot partition. To update the kernel, initfs or modules, you will need to manually (generate and) copy these to the boot partition or you could use bind mount so that manually copy the files to boot partition is not needed.

echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 >> /etc/fstab

看完上述內容,你們對Alpine Linux怎么安裝到Raspberry Pi有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

噶尔县| 逊克县| 大姚县| 岫岩| 容城县| 石台县| 乐平市| 丽水市| 辽源市| 牡丹江市| 西乌珠穆沁旗| 台前县| 泰来县| 商洛市| 天峨县| 平远县| 锡林浩特市| 陕西省| 桐乡市| 澄迈县| 会昌县| 洛宁县| 乐至县| 灵台县| 图木舒克市| 梅河口市| 山阳县| 吉木乃县| 杂多县| 女性| 越西县| 贡嘎县| 抚顺市| 定远县| 沂源县| 建阳市| 台州市| 陇西县| 南溪县| 通辽市| 蒙自县|