用 Linux 让旧 MacBook 重获新生
MacBook

> 
> 花上一小时，用 Fedora 让一台过时的 Mac 重新有用。
> 
> 
> 


![](/data/attachment/album/202101/02/102156tjj8g7r272j74huj.jpg)


最近，我偶然找到了一台 2011 年底的老款 13 英寸 MacBook Pro，有 125GB SSD 和 8GB 内存。我曾带着这台机器去世界各地旅行，当年，我开了很多场会议、研讨会或演示，分享 JBoss 技术带来的各种 AppDev 优势。


在验证了它的电池能用，充了电，重新安装了一个新的 OS X 之后，我发现 Safari 浏览器的版本受限于旧的安全规范，这意味着它现在无法连接到很多 HTTPS 网站。这就使得这个解决方案失效了。


这个老伙计该怎么处理呢？


自从我作为开发人员专门在 Linux 工作站上工作以来已经有几年了。我只使用 Fedora，所以我决定尝试在这台 MacBook Pro 上安装它的最新版本。


我只花了一个多小时就用下面的步骤让 [Fedora 33](https://getfedora.org/en/) 在这台笔记本上工作了。


### 下载 Fedora 33 并创建一个临场 USB


第一步是找到正确的安装 Fedora 的方法。这台机器有一个 CD 插槽，所以可以刻录一个 ISO 并从它启动，但我选择直接使用可启动的 USB 方式。


我登上了另一台 MacBook，访问了 [Fedora Workstation 网站](https://getfedora.org/en/workstation/download/)，它有 Fedora Media Writer 的链接。点击你的机器类型的图标（在我的例子中是苹果标志），你会得到一个安装包。


![Fedora Media Writer 下载界面](/data/attachment/album/202101/02/102214er9gtirp1f96nnmz.png "Fedora Media Writer download screen")


开始安装，可以看到一个引导你完成安装过程的图形用户界面（GUI）。选择 Fedora Workstation 33 选项。


![在 Fedora Media Writer 中下载 Fedora Workstation](/data/attachment/album/202101/02/102214ga184lakyj89jll4.png "Fedora Workstation download in Fedora Media Writer")


接下来，选择右上角的“Create Live USB”选项。


![创建 Live USB 的按钮](/data/attachment/album/202101/02/102215byrydjhndezjndhe.png "Create Live USB button")


镜像将开始下载，你将看到一个下拉菜单来选择安装位置。


![下载 Fedora Workstation](/data/attachment/album/202101/02/102215ljeh5zehchf598sg.png "Downloading Fedora Workstation")


插入一个有足够空间的 U 盘，下载完成后，就可以选择它并在上面安装镜像。完成后，关闭 GUI，取出 U 盘。


### 安装 Linux


将你创建的 U 盘插入 MacBook Pro 左侧的端口，并按住 `Cmd` 键左侧的 `Option`（或 `Alt`）键的同时重新启动。这将打开一个启动机器的选项菜单：使用 EFI 选项，因为那是 USB 镜像。


笔记本电脑将从 USB 设备启动，你可以按照[正常的 Fedora 安装](https://docs.fedoraproject.org/en-US/fedora/f33/install-guide/install/Booting_the_Installation/)过程进行。如果你能将 MacBook Pro 插入网线连接，会有帮助，因为它的 Broadcom WiFi 设备无法开箱即用。


![MacBook Pro](/data/attachment/album/202101/02/102215v6hhnbq2s83hobqz.jpg "MacBook Pro")


你现在也可以将 Fedora 安装到你的硬盘上，并将它永久地放在你的机器上。


![在 MacBook Pro 上安装 Fedora](/data/attachment/album/202101/02/102216z4dh4b4jpj3xzwdw.jpg "Installing Fedora on MacBook Pro")


一旦安装程序完成，重新启动机器，Fedora 33 现在应该是启动选项。


![MacBook Pro 启动到 Fedora](/data/attachment/album/202101/02/102216zmmmmk170lzjwppd.jpg "MacBook Pro booting into Fedora")


唯一缺少的就是 WiFi 驱动，所以要保持网线连接，安装你正在运行的内核的开发包，并为该内核构建 `broadcom-wl` 驱动。


验证你需要用于 WiFi 的卡。



```
$ lspci -vnn -d 14e4:

```

在输出中会有几项，包括如下内容：



```
Network controller [0280]: Broadcom Inc. and subsidiaries....

Subsystem: Apple Inc. AirPort Extreme...

```

安装一个仓库来拉取 Broadcom 相关的部分：



```
$ su -c 'dnf install -y http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'

```

接下来的部分很有趣：如果你查看正在运行的内核时，你会看到 `v5.9.8-200.fc33`，但是你要使用开发内核包来构建你的 Broadcom 无线驱动。所以，你需要安装 `v5.8.15-301.fc33`（在写这篇文章的时候可用）。使用 `uname -r` 检查它们，并使用 `sudo dnf list kernel` 列出已安装的内核包：



```
$ sudo dnf list kernel
kernel.x86_64                     5.8.15-301.fc33
kernel.x86_64                     5.9.8-200.fc33

```

安装开发包：



```
$ sudo dnf install -y akmods kernel-devel-5.8.15-301.fc33

```

![安装开发包](/data/attachment/album/202101/02/102216k92232xuzm9axrum.jpg "Installing development packages")


安装 Broadcom 无线软件包：



```
$ sudo dnf install -y broadcom-wl

```

构建内核模块：



```
$ sudo akmods

```

![构建内核模块](/data/attachment/album/202101/02/102217f3z54al4ff3waf54.jpg "Building the kernel module")


重新启动你的机器，你应该可以看到无线驱动（`wl`）。



```
$ lsmod | grep wl

```

在 Fedora 中设置你的无线连接：


![设置无线连接](/data/attachment/album/202101/02/102217hepdin3if5ghhafr.jpg "Set up wireless connection")


这篇文章对我来说有些出乎意料，但我希望它能帮助别人在周末享受一些老硬件的乐趣！



> 
> 现在要走不寻常路了……在 2011 年的 Macbook Pro 上安装 [#Fedora](https://twitter.com/hashtag/Fedora?src=hash&ref_src=twsrc%5Etfw)。祝我好运! [pic.twitter.com/zlsESnq2Px](https://t.co/zlsESnq2Px)。
> 
> 
> * Eric D. Schabell (@ericschabell) [2020 年 11 月 22 日](https://twitter.com/ericschabell/status/1330434517883121665?ref_src=twsrc%5Etfw)
> 
> 
> 


*此文原载于 [Schabell.org](https://www.schabell.org/2020/11/installing-fedora33-on-macbook-pro-13inch-late-2011.html)，经许可转载。*




---


via: <https://opensource.com/article/20/12/linux-macbook>


作者：[Eric D. Schabell](https://opensource.com/users/eschabell) 选题：[lujun9972](https://github.com/lujun9972) 译者：[wxy](https://github.com/wxy) 校对：[wxy](https://github.com/wxy)


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


OK
Recently, I stumbled on an old MacBook Pro 13" from late 2011, with a 125GB SSD and 8GB RAM. I've taken this machine on trips around the world, and back in the day, I ran many a session, workshop, or demo to share all the AppDev goodness from JBoss technologies.

After verifying that its battery works, charging it up, and reinstalling a new OS X, it turns out that the Safari browser version is limited to an old security specification, which means it can't connect to a lot of HTTPS sites now. This renders this solution defunct.


What to do with this old thing?

It's been a few years since I worked solely on Linux workstations as a developer. I specifically worked on Fedora, so I decided to try to install the latest version on this MacBook Pro.

It took me just over an hour to get [Fedora 33](https://getfedora.org/en/) working on this laptop with the steps below.

## Download Fedora 33 and create a live USB

The first step is to find the right way to install Fedora. This machine has a CD slot, so you could burn an ISO and boot from it, but I chose to go straight to a bootable USB option.

I got on my other MacBook and visited the [Fedora Workstation site](https://getfedora.org/en/workstation/download/), which links to Fedora Media Writer. Click on the icon for your machine type (in my case, the Apple logo), and you get an installation package.

![Fedora Media Writer download screen Fedora Media Writer download screen](https://opensource.com/sites/default/files/uploads/fedoramediawriter.png)

(Eric D. Shabell, CC BY-SA 4.0)

Start installing it to see a graphical user interface (GUI) that guides you through the process. Select the Fedora Workstation 33 option:

![Fedora Workstation download in Fedora Media Writer Fedora Workstation download in Fedora Media Writer](https://opensource.com/sites/default/files/uploads/fedoraworkstation33-installation.png)

(Eric D. Shabell, CC BY-SA 4.0)

Next, select the Create Live USB option in the top-right corner:

![Create Live USB button Create Live USB button](https://opensource.com/sites/default/files/uploads/create-live-usb.png)

(Eric D. Shabell, CC BY-SA 4.0)

The image will start to download, and you will see a drop-down menu to select where to install it:

![Downloading Fedora Workstation Downloading Fedora Workstation](https://opensource.com/sites/default/files/uploads/download_fedora-workstation.png)

(Eric D. Shabell, CC BY-SA 4.0)

Plug in a USB stick with enough space available, then after the download finishes, you can select and install the image on it. Once it's finished, close the GUI and remove the USB stick.

## Install Linux

Insert the USB stick you created into the port on the left side of your MacBook Pro, and restart it while holding down the **Option** (or **Alt**) key just to the left of the **Cmd** key. This opens a menu of options to start the machine; use the EFI option, as that's the USB image.

The laptop will boot from the USB device, and you can follow the [normal Fedora installation](https://docs.fedoraproject.org/en-US/fedora/f33/install-guide/install/Booting_the_Installation/) process. It helps if you can plug the MacBook Pro into a network cable connection, as the Broadcom WiFi device will not work out of the box.

![MacBook Pro MacBook Pro](https://opensource.com/sites/default/files/uploads/macbook.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

You should get the opportunity to install Fedora to your hard drive and put it on your machine permanently.

![Installing Fedora on MacBook Pro Installing Fedora on MacBook Pro](https://opensource.com/sites/default/files/uploads/macbook_install-fedora.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

Once the installer completes, reboot your machine, and Fedora 33 should now be the option to boot from.

![MacBook Pro booting into Fedora MacBook Pro booting into Fedora](https://opensource.com/sites/default/files/uploads/macbook_fedora-boot.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

The only thing missing is a WiFi driver, so keep your network cable connected to install the development packages for the kernel you are running and to build the `broadcom-wl`

driver for that kernel.

Verify the card you need for WiFi:

`$ lspci -vnn -d 14e4:`


There will be several items in the output, including something like:

```
Network controller [0280]: Broadcom Inc. and subsidiaries....
Subsystem: Apple Inc. AirPort Extreme...
```


Install a repository to pull the Broadcom stuff:

`$ su -c 'dnf install -y http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'`


The next part is interesting: As you look at the running kernel, you'll see `v5.9.8-200.fc33`

, but you will use the development kernel packages to build your Broadcom wireless driver. So, you need to install `v5.8.15-301.fc33`

(available at the time of this writing). Check them using `uname -r`

, and list the installed kernel packages using `sudo dnf list kernel`

:

```
$ sudo dnf list kernel
kernel.x86_64 5.8.15-301.fc33
kernel.x86_64 5.9.8-200.fc33
```


Install the development packages:

`$ sudo dnf install -y akmods kernel-devel-5.8.15-301.fc33`



![Installing development packages Installing development packages](https://opensource.com/sites/default/files/uploads/install-development-packages.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

Install the Broadcom wireless package:

`$ sudo dnf install -y broadcom-wl`


Build the kernel module:

`$ sudo akmods`



![Building the kernel module Building the kernel module](https://opensource.com/sites/default/files/uploads/build-kernel-module.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

Reboot your machine, and you should be able to view the wireless driver (`wl`

) with:

`$ lsmod | grep wl`


Set up your wireless connection in Fedora:

![Set up wireless connection Set up wireless connection](https://opensource.com/sites/default/files/uploads/wireless-setup.jpeg)

(Eric D. Shabell, CC BY-SA 4.0)

This article is a bit out of the ordinary for me, but I hope it might help someone else enjoy some fun on the weekend with some old hardware!

Going off the beaten path now... installing

[#Fedora]on a macbook pro from 2011. Wish me luck![pic.twitter.com/zlsESnq2Px]— Eric D. Schabell (@ericschabell)

[November 22, 2020]

*This originally appeared on Schabell.org and is republished with permission.*

## 16 Comments