在树莓派 3 上安装 Fedora
Fedora 树莓派
![](/data/attachment/album/202008/15/232153dxw9jan3l2jg3aii.png)



> 
> 在树莓派上运行 Fedora。
> 
> 
> 


[树莓派基金会](https://www.raspberrypi.org/about/)这几年来生产了很多型号。本文的安装过程已经在第三代树莓派上进行了测试：[3B v1.2](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) 和 [B+](https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/)（较旧的 [树莓派 2](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/) 和新的 [树莓派 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) 都还没有测试）。这些是已经发布了几年的信用卡大小的树莓派。


### 获取硬件


你需要一些硬件组件，包括树莓派。你不需要任何 [HaT（安装在顶部的硬件）](https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/) 板或 USB 天线。如果你使用过树莓派，那么可能会有这些。


* **当前网络**。也许是你的家庭实验室。
* **网线**。连接当前网络到树莓派
* **树莓派 3**，型号 B 或 B+。
* **电源**。
* **8 GB 或更大容量的 micro-SD 卡**。
* **键盘**和**显示器**。


键盘和显示器共同组成本地控制台。即使没有控制台，也能进行操作（尽管很复杂），例如设置自动安装然后通过网络连接。在 Fedora 首次启动时，本地控制台可轻松回应配置问题。同样，在 AP 配置期间出错可能会破坏网络配置，从而阻止远程用户连入。


### 下载 Fedora Minimal


* 查找 Fedora 的[其他可选架构镜像](https://alt.fedoraproject.org/alt/)。
* 下载 [ARM® aarch64 架构镜像](https://download.fedoraproject.org/pub/fedora-secondary/releases/32/Spins/aarch64/images/Fedora-Minimal-32-1.6.aarch64.raw.xz)。


Fedora Minimal 镜像是 [Fedora 的其他可选下载之一](https://alt.fedoraproject.org/)，它有所有必需的核心软件包和网络软件包（嗯，是几乎，注意下面的 dnsmasq）。该镜像包含一个现成的文件系统，它已经安装了 400 多个软件包。此最小镜像不包括流行的软件包，像开发环境、互联网服务或桌面。这些类型的软件不是这里所必需的，如果安装它们，可能会占用过多的内存。


Fedora Minimal 原始镜像可安装在小型 SD 卡上，并在少于 1GB 的内存中运行（这些旧的树莓派有 1GB 的内存）。


下载文件的名称类似于 `Fedora-Minimal-32-1.6.aarch64.raw.xz`。该文件已压缩，大小约为 700MB。文件解压缩后为 5GB。这是一个 ext4 文件系统，它大部分是空的：已使用约 1GB，空余 4GB。这些空的空间是压缩文件比未压缩的原始文件小得多的原因。


### 复制到 micro-SD 卡


* 将镜像复制到 micro-SD 卡。


这可能比听起来更复杂，而且会带来痛苦的体验。找到一个[良好的 micro-SD 卡](https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019)需要花费精力。然后是将卡插到计算机的挑战。也许你的笔记本电脑有全尺寸的 SD 卡插槽，你还需要卡适配器，或者你需要一个 USB 适配器。然后，在进行复制时，操作系统可能会帮助你，也可能会妨碍你。你可能很幸运有 [Fedora Media Writer](https://fedoramagazine.org/make-fedora-usb-stick/)，或使用这些 Linux 命令：



```
unxz ./Fedora-Minimal-32-1.6.aarch64.raw.xz
dd if=./Fedora-Minimal-32-1.6.aarch64.raw of=/dev/mmcblk0 bs=8M status=progress oflag=direct

```

### 安装 Fedora


* 连接树莓派、电源线、网线和 micro-SD 卡。
* 打开电源。
* 当图形芯片通电时，看见彩色框。
* 等待 [anaconda 安装程序](https://fedoraproject.org/wiki/Anaconda)启动。
* 回答 anaconda 的设置问题。


操作系统的初始配置需要几分钟的时间。等待启动需要花费几分钟，还需要花费一些时间填写 anaconda 的文本安装程序的问题。在下面的例子中，用户名为 `nick`，并且还是管理员（`wheel` 组的成员）。


恭喜你！你的树莓派已启动并可运行。


### 更新软件


* 用 `dnf update` 更新软件包。
* 通过 `systemctl reboot` 重启。


多年来，很多人为使树莓派正常工作付出了很多工作。使用最新的软件，以确保你从他们的辛勤工作中受益。如果你跳过此步骤，你可能会发现有些东西无法正常工作。


此次更新下载并安装了约一百个软件包。由于存储设备是 micro-SD 卡，因此写入新软件的过程很慢。这就是 90 年代使用存储器的感觉。


### 可以摆弄的东西


如果你想摆弄的话，此时可以设置其他一些内容。这都是可选的。试试这些。


* `sudo hostnamectl set-hostname raspi` 替换 `localhost` 主机名。
* 用 `ip addr` 查找 IP 地址。
* 尝试 SSH 登录，甚至使用 `ssh-copy-id` 设置基于密钥的登录。
* 使用 `systemctl poweroff` 关机。




---


via: <https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/>


作者：[Nick Hardiman](https://fedoramagazine.org/author/nickhardiman/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Fire up a Raspberry Pi with Fedora.

The [Raspberry Pi Foundation](https://www.raspberrypi.org/about/) has produced quite a few models over the years. This procedure was tested on third generation Pis – a [Model B v1.2](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/), and a [Model B+ ](https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/)(the older [2](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/) and the new [4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) weren’t tested). These are the credit-card size Pis that have been around a few years.

### get hardware

You do need a few hardware items, including the Pi. You don’t need any [HaT (Hardware Attached on Top)](https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/) boards or USB antennas. If you have used your Pi in the past, you probably have all these items.

**current network**. Perhaps this is your home lab.**ethernet cable**. This connects the current network to the Raspberry Pi**Raspberry Pi 3**, model B or B+.**power supply****micro-SD card**, 8GB or larger.**keyboard**and**video monitor**.

The keyboard and video monitor together make up the local console. It’s possible – though complicated – to get by without a console, such as setting up an automated install then connecting over the network. A local console makes it easy to answer the configuration questions during Fedora’s first boot. Also, a mistake during AP configuration may break the network, locking out remote users.

### download Fedora Minimal

- Find Fedora’s
[alternate architecture images](https://alt.fedoraproject.org/alt/). - Download the
[ARM® aarch64 Architecture image](https://download.fedoraproject.org/pub/fedora-secondary/releases/32/Spins/aarch64/images/Fedora-Minimal-32-1.6.aarch64.raw.xz).

The *Fedora Minimal* image, one of [Fedora’s alt downloads](https://alt.fedoraproject.org/), has all the core packages and network packages required (well, nearly – check out *dnsmasq* below). The image contains a ready-made file system, with over 400 packages already installed. This minimal image does not include popular packages like a development environment, Internet service or desktop. These types of software aren’t required for this work, and may well use too much memory if you install them.

The *Fedora Minimal* raw image fits on a small SD card and runs in less than 1 GB of memory (these old Pis have 1GB RAM).

The name of the downloaded file is something like *Fedora-Minimal-32-1.6.aarch64.raw.xz*. The file is compressed and is about 700MB in size. When the file is uncompressed, it’s 5GB. It’s an ext4 file system that’s mostly empty – about 1GB is used and 4GB is empty. All that empty space is the reason the compressed download is so much smaller than the uncompressed raw image.

### copy to the micro-SD card

- Copy the image to a micro-SD card.

This can be a more complex than it sounds, and a painful experience. Finding a [good micro-SD card](https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019) takes work. Then there’s the challenge of physically attaching the card to your computer.Perhaps your laptop has a full SD card slot and you need a card adapter, or perhaps you need a USB adapter. Then, when it comes to copying, the OS may either help or get in your way. You may have luck with [Fedora Media Writer](https://fedoramagazine.org/make-fedora-usb-stick/), or with these Linux commands.

unxz ./Fedora-Minimal-32-1.6.aarch64.raw.xz dd if=./Fedora-Minimal-32-1.6.aarch64.raw of=/dev/mmcblk0 bs=8M status=progress oflag=direct

### set up Fedora

- Connect the Pi, power cable, network cable and micro-SD card.
- Hit the power.
- See the colored box as the graphics chip powers up.
- Wait for the
[anaconda installer](https://fedoraproject.org/wiki/Anaconda)to start. - Answer anaconda’s setup questions.

Initial configuration of the OS takes a few minutes – a couple minutes waiting for boot-up, and a couple to fill out the spokes of anaconda’s text-based installer. In the examples below, the user is named **nick** and is an administrator (a member of the *wheel* group).

Congratulations! Your Fedora Pi is up and operational.

### update software

- Update packages with `dnf update`.
- Reboot the machine with `systemctl reboot`.

Over the years, a lot of people have put a lot of work into making the Raspberry Pi devices work. Use the latest software to make sure you get the benefit of their hard work. If you skip this step, you may find some things just don’t work.

The update downloads and installs about a hundred packages. Since the storage is a micro-SD card, writing new software is a slow process. This is what using computing storage felt like in the 1990s.

### things to play with

There are a few other things that can be set up at this point, if you want to play around. It’s all optional. Try things like this.

- Replace the
*localhost*hostname with the command `sudo hostnamectl set-hostname raspi`. - Find the IP address with `ip addr`.
- Try an SSH login, or even set up key-based login with `ssh-copy-id`.
- Power down with `systemctl poweroff`.

## Shy

Hi world.

Does anyone have any hands-on experience with running Fedora on R181-T90, R181-T92, R281-T91 or R281-T94 or other Marvell ThunderX2 servers and would like to share their impressions, incites etc. please?

Thank you,

## L'rence Aldridge

Yes, but as a newbie (and of course finding this article via Google News) what are the advantages of fedora on a raspberry pi over raspian?

## Stephen

The advantage is you would have Fedora the best Distro on your RPi

## L'rence Aldridge

Thanks for your reply, Stephen. it’s an understandable position, given the blog is titled Fedora Magazine.

I guess the question now, is “Why do people consider fedora the best distro?” (Background: I don’t have much exposure to different distros – I have entered via the world of raspberry pi.)

## Stephen Snow

Well, in truth if you read other comments around here on the topic of RPi and Fedora, you can tell Fedora isn’t the first choice by many for an installation on a Raspberry Pi. Fedora is however the best Linux distribution IMO, and alot of my reason is coming from their stance on FOSS and their dogged support of it, also I like their near bleeding edge focus on the linux ecosystem, and release cadence. The four foundational core values of Fedora are “Freedom, Friends, Features, First”, this is at the core of the community and the distribution.

## fedora_usr

because it is the best 🙂

## Versace

It’s true, I love Fedore 🙂 but Fedora on Raspberry PI is a failure … SD card slot is too slow. You can run Fedore on an external SSD via USB 3.0 to make it run much faster, but you still don’t have the options you expect from a Raspberry Pi.

## Doug

Yeah, Fedora 32 Server uses the XFS filesystem on an SD Card which is just a performance disaster and needs to be fixed

## Edwin Buck

I find the consistency of RPM packaging to be the best real advantage.

At work, we already have the infrastructure set up for RPM builds and deployments, adding ARM to it is easy due to the tooling we can borrow from Fedora.

As there is no need to describe a hybrid packaging and release system, it cuts down on training, documentation, and effort of debugging when things go wrong.

## Phoenix

When it comes to the Raspberry Pi, I am mostly interested if the GPIO would work. The last time I checked, the binary was only readily available within its Debian derivative OS. Is the command “gpio” available now? Or was it already available longer and I simply did not find the right package/repo?

## emlen

not work, as is the vcgencmd

## bookwar

Standard libraries used on Raspbian most likely won’t work because they hardcode Raspbian configuration in their system-level functions.

New library

will work as it uses standard API of the vanilla kernel. It is packaged for Fedora and can be used as cli tool or via Python bindings. See

I also wrote a simple python library (https://github.com/bookwar/python-gpiodev/) to operate GPIO pins via kernel API. Haven’t packaged it for Fedora yet, but I will, someday.

## Edwin Buck

I had success getting the GPIO pins to work with a Raspberry Pi 2B running Fedora. It wasn’t as simple as it could have been, but if you can open up the source for the library you’ll have to install manually, as well as the source for the kernel drivers; at least for that hardware and set of code, I managed to individually light 16 leds.

Of course, it involved a bit of programming, and wasn’t quite as simple as I believed it should have been.

## Stephen

I thought, and this is going back a bit, that there was a python library for that, which is usable in Fedora too.

PHP lib https://github.com/PiPHP/GPIO

Python Lib https://maker.pro/raspberry-pi/tutorial/how-to-get-started-with-the-raspberry-pi-gpio-python-library

or howto with C https://www.digikey.com/en/maker/blogs/2019/how-to-use-gpio-on-the-raspberry-pi-with-c

## emlen

not work on 64 bit

## Pat

When it boots up it asks if you can’t to continue quit or refresh. So I press c to continue and then it asks for a localhost user name and password. Anyone know what it is?

## Jerald

Is YouTube and other HD video play fine in this fedora version.

I flashed android in raspberry Pi 3b, when i play video cpu usage raises high because of software rendering.

and video struck in middle.

## emlen

GPIO is supported with the use of libgpiod and associated bindings and utilities.

RPI.GPIO is not currently supported.

## Stephen Snow

Wouldn’t you just use pip install RPI.GPIO or some such? I’m not a python programmer so I am just asking, but that was my impression on how you went about doing it.

## emlen

I am a Fedora’s fan. So I tried off course.. )I’ll repeat again- it not work on 64 bit, 100%

## bookwar

Unfortunately libraries like RPI.GPIO internally have some checks which are basically saying “If system is not Raspbian – stop”. To be usable on other systems they need to be refactored to use standard API.

## emlen

vcgencmd not compile or install too..

## Sophia

Hello,

I use the Samsung EVO 256GB microSDXC UHS-I U3 100MB/s Full HD & 4K UHD, it has never had any issues with speed. I have tried a lot of Distro’s for my RPi. I did not like the speed that the SanDisk was giving me and I had a few that had issues. I am happy Fedora has a Pi version, as it is the only distro that I use daily at work and at home. I am also the only Support Tech where I work that uses Linux. It is by choice also!!

Just my 2 cents,

Miss. McKnight

## Calvato

Hi everybody, has anybody ever got Fedora running on a Raspbi 4?

## van

Not ready yet. CentOS7.8/Debian10/Ubuntu20.04/ArchLinux/RaspiOS now works on Raspbi 4.

## Calvato

Okay, thank you van.

## Emblaze

Actually, while it’s not officially supported, Fedora 32 runs perfectly well on my 4GB Raspberry Pi 4 with Mate (Gnome also worked but it’s a bit resource consuming). Start with the minimal aarch64 image, then customise it up as you see fit.

## Arjan Hulsebos

I’ve had a number of micro-sd cards go bad in a relative quick time, so I looked at getting th Pi to run from a usb stick. You cannot completely do away with the micro-sd as it really is needed in the first boot stage, but you can run your file systems, including /dev, /etc, and /sbin from the usb stick. I noticed one odd thing, some Pi do need /boot on the micro-sd, others are happy with /boot on the usb, don’t know why (and I haven’t looked into it, I must say).

It’s fairly easy to do, it requires editing a few files, and assigning new UUIDs to a few partitions. All can be found on Google 🙂

## tsyang

Boot from USB without SD card is possible

https://www.raspberrypi.org/forums/viewtopic.php?t=75784