Preparing for Installation

本章节将介绍开始安装之前的一些准备事项。你不需要严格按照这里所说地去做,例如说如果你希望使用默认的安装设定,你就不需要收集分区 UUID 信息和卷标或者网络信息如 IP 地质。然而,你仍然应该读一下这个章节,它将为你介绍可用的安装介质、如何准备安装介质和安装来源。

升级还是安装?

如果你已经安装 Fedora 且希望将你的系统升级到当前的版本,你可以:

使用 dnf system upgrade 执行自动升级

使用 dnf system upgrade 执行升级是我们推荐的方式。你可以阅读 这个页面 了解如何通过这个方式升级。

手动重装系统

除了使用 dnf system upgrade 之外,你还可以手动完成系统升级。你可以引导安装介质并执行全新安装,或者让安装程序探测你当前的 Fedora 系统,将根分区改写的同时保留其它的分区或卷。当然对于只重装不升级的情况,也是可以采取一样的方法的。具体可以查看 手动系统升级与系统重装 这篇文章。

无论如何,在升级和重装系统之前务必备份好你的个人数据。

准备安装介质

Fedora 的映像文件是混合的 ISO 文件,你可以将它烧录到光盘、写入到 USB 驱动器,可以在 BIOS 模式下启动,也可以在 UEFI 模式下启动。

Fedora Media Writer

Fedora Media Writer 是 Fedora 官方提供且支持的可启动设备制作工具。 Fedora Media Writer 支持 Linux、Mac 和 Windows 系统。这个工具将允许你很方便地创建 Fedora(或其它发行版)的 USB 启动盘。尽管还有其它可用的工具,我们强烈推荐你使用 Fedora Media Writer

你可以直接在 Fedora Media Writer 的主页面点击获取 Fedora Workstation 和 Server 的安装映像文件,然而你也可以通过 Custom image 选项选择自己的安装映像文件(例如 Xfce 和 Mate 的 Fedora Spin 安装映像)。

很多人可能会使用 Unetbootin 这样的通用 USB 启动盘创建工具。这些软件通常通过从安装映像中解压和提取文件,并将 syslinux 引导程序写入设备从而在 USB 驱动器上创建一个文件系统。

这些方法会忽略 Fedora 映像中内置的引导程序配置,Fedora 映像是预先分区的,而且为启用安全启动设置的 UEFI 系统和 BIOS 系统做过适配。使用这些方法将会导致导致实际写入的内容和 Fedora 原映像文件不一致,在 UEFI 模式下这个差异会体现地特别明显。

综上所述,我们推荐的做法是不对 Fedora 映像做任何的改动,直接写入即可。

在将映像文件写入设备之前一定要再三思考。根据本文介绍的方法,USB 驱动器上的所有数据都被删除,所以在开始前一定要做好数据备份,此外务必确认你选择了正确的目标设备!

安装和运行 Fedora Media Writer

在 Fedora 系统

如果你在使用 Fedora 25 或更高版本, Fedora Media Writer 已经进入了官方软件仓库。你可以使用 dnf 安装这个软件。

  1. 要安装 Fedora Media Writer ,执行:

    $ sudo dnf install mediawriter
  2. 要运行 Fedora Media Writer ,执行:

    $ mediawriter

    如果你在使用 GNOME ,可以前往 活动 视图然后点击运行 Fedora Media Writer

在其它 Linux 发行版

对于大部分的 Linux 发行版,安装 Fedora Media Writer 最简单的方式就是安装预先构建好的 Flatpak 软件包。你可以在 Flatpak 软件仓库 Flathub.org 获取这个软件包。

  1. 要在你的系统配置 Flatpak ,只需按照 Flatpak 文档 按部就班即可。

  2. 启动应用程序:

    $ sudo mediawriter

在 Windows 系统

  1. 你可以从 GetFedora.org 获取适用于 Windows 的安装程序。我们的服务器会探测你的系统并为你提供合适的安装文件。

  2. 双击安装程序,根据安装向导的提示操作就可以自定义安装并执行安装。

  3. 点击启动项就可以启动应用程序了。

    在 Windows 8 和 10, Fedora Media Writer 的启动项位于开始菜单的 F 分类下。在 Windows 10 下,你可以在任务栏搜索 Fedora Media Writer 找到启动项。

在 MacOS 系统

  1. 你可以从 GetFedora.org 获取 Macintosh 磁盘文件(即拓展名为 .dmg 的文件)。我们的服务器会探测你的系统并为你提供合适的安装文件。

  2. 打开 .dmg 文件,在点击 Fedora Media Writer 应用的同时按住 Ctrl 键。

  3. 在弹出的菜单中点击打开选项。

  4. 如果还有任何的确认对话框,继续点击打开按钮。

Writing the ISO image to the USB Media.

  1. Select the Fedora Edition you wish to make a bootable USB drive for.

    Image of Fedora Media Writer Main Screen
    Figure 1. Fedora Media Writer Main Screen: Choose your Edition of Fedora

    The main selection lets you choose one of the default Fedora editions, Fedora Workstation or Server. Fedora Media Writer displays more details about the edition before you can proceed with downloading the image and the USB creation. You can choose a different architecture, if you select Other variants.

  2. Select "Create Live USB" to proceed.

    Image of Fedora Media Writer Distro Information Screen
    Figure 2. Fedora Media Writer Distro Information

    Fedora Media Writer will automatically download the ISO for you. If you have downloaded the ISO before and placed it in the Downloads directory, it will be immediately available to use.

    Image of Fedora Media Writer Automatic Download
    Figure 3. Fedora Media Writer Automatic Download
  3. Plug in a USB drive on which you want to create the bootable media.

  4. To write the image onto the media, click the red Write to disk button.

    Image of Fedora Media Writer write to device red button
    Figure 4. Fedora Media Writer Write to USB Device

Other methods to create a live USB

Using the Fedora Media Writer is highly recommended for everybody, because it offers a reliable way to create a live USB stick for Fedora installation.

However, some experienced users may prefer to go through the creation process manually. If you decide to do so, you have to download the installation images and use an application to write them onto the USB stick.

If you have downloaded and verified the installation images manually, you still can write them onto the USB stick using Fedora Media Writer.

Downloading Boot and Installation Images

The Fedora Project offers different Editions tailored for some specific use cases. Choose the Fedora Edition best for you, or you can build your own by customizing after the installation, or by using a kickstart file as described in Creating a Kickstart File. Kickstart installation requires the netinstall media type, or a direct installation booting method such as PXE; kickstarts are not supported with live images.

Read more about Fedora Workstation, Fedora Cloud, Fedora Server and the available media types in Downloading Fedora.

You can also choose a Fedora Spin featuring favorite alternative desktops or tools for specialized tasks at https://spins.fedoraproject.org.

Verifying the Downloaded Image

Because transmission errors or other problems may corrupt the Fedora image you have downloaded, it is important to verify the file’s integrity. After the images are created, an operation is performed on the file that produces a value called a checksum using a complex mathematical algorithm. The operation is sufficiently complex that any change to the original file will produce a different checksum.

By calculating the image’s checksum on your own computer and comparing it to the original checksum, you can verify the image has not been tampered with or corrupted. The original checksum values are provided at https://getfedora.org/security/, and are gpg signed to demonstrate their integrity.

Verifying checksums on Windows systems

  1. Download the Fedora image of your choice from https://fedoraproject.org/get-fedora and the corresponding checksum file from https://getfedora.org/security/

  2. Open a powershell session.

  3. Change to the directory containing the downloaded files.

    > cd $HOME\Downloads\
    > ls
    
    Directory: C:\Users\Pete\Downloads
    
    Mode                LastWriteTime         Length  Name
    ----                -------------         ------  ----
    -a---        11/25/2014  12:39 PM            272  Fedora-Server-21-x86_64-CHECKSUM
    -a---        11/25/2014  12:39 PM     2047868928  Fedora-Server-DVD-x86_64-21.iso
  4. Load the resources required to calculate the checksum.

    > $image = "Fedora-Server-DVD-x86_64-21.iso"
    > $checksum_file = "Fedora-Server-21-x86_64-CHECKSUM"
    > $sha256 = New-Object -TypeName System.Security.Cryptography.sha256CryptoServiceProvider
    > $expected_checksum = ((Get-Content $checksum_file | Select-String -Pattern $image) -split " ")[0].ToLower()
  5. Calculate the downloaded image’s checksum. This will take a while!

    > $download_checksum = [System.BitConverter]::ToString($sha256.ComputeHash([System.IO.File]::ReadAllBytes("$PWD\$image"))).ToLower() -replace '-', ''
  6. Compare the calculated checksum to the expected checksum.

    > echo "Download Checksum: $download_checksum"
    > echo "Expected Checksum: $expected_checksum"
    > if ( $download_checksum -eq "$expected_checksum" ) {
    echo "Checksum test passed!"
    } else {
    echo "Checksum test failed."
    }

Verifying checksums on Linux and OSX systems

  1. Download the Fedora image of your choice from https://fedoraproject.org/get-fedora and the corresponding checksum file from https://getfedora.org/security/

  2. Open a terminal window, and navigate to the directory with the downloaded files.

    $ cd ~/Downloads
  3. Use the appropriate utility to verify the image checksum.

    • For Linux:

      $ sha256sum -c *CHECKSUM
    • For OSX:

      $ grep '^SHA256' *-CHECKSUM | awk -F '[()=]' '{ print $4 " " $2 }' | shasum -a 256 -c

Writing the images to USB media

Creating USB media with GNOME Disks

  1. On a system with GNOME, or with the gnome-disk-utility package installed, open Disks using the system menu.

  2. Click your USB device in the left column.

  3. Click the menu icon in the upper right corner of the window, and choose the Restore Disk Image option.

  4. Navigate to your image file and click Start Restoring. After a few minutes, it will report the process is complete and your installation media will be ready to use.

Creating USB Media on the Linux command line

  1. Open a terminal window and insert the usb drive.

  2. Find the device node assigned to the drive. In the example below, the drive is given sdd.

    $ dmesg|tail
    [288954.686557] usb 2-1.8: New USB device strings: Mfr=0, Product=1, SerialNumber=2
    [288954.686559] usb 2-1.8: Product: USB Storage
    [288954.686562] usb 2-1.8: SerialNumber: 000000009225
    [288954.712590] usb-storage 2-1.8:1.0: USB Mass Storage device detected
    [288954.712687] scsi host6: usb-storage 2-1.8:1.0
    [288954.712809] usbcore: registered new interface driver usb-storage
    [288954.716682] usbcore: registered new interface driver uas
    [288955.717140] scsi 6:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9228 PQ: 0 ANSI: 0
    [288955.717745] sd 6:0:0:0: Attached scsi generic sg4 type 0
    [288961.876382] sd 6:0:0:0: sdd Attached SCSI removable disk
  3. Use the dd utility to write the image.

    # dd if=/path/to/Fedora-Live-Security-x86_64-21.iso of=/dev/sdd

    Pay extreme attention to the source (if=) and target (of=) device. The dd command destroys all data on the target device. If you made a mistake, you could lose important data.

Creating a Boot CD or DVD

In addition to creating a bootable USB flash drive, you can also use the provided ISO images to create bootable optical media (a CD or DVD). This approach may be necessary when installing Fedora on an older system which can not boot from USB.

The exact steps you need to take to burn a bootable CD or DVD from an ISO image will vary depending on what disc burning software you use. This procedure only offers a general overview.

  1. Insert a blank CD or DVD into your system’s CD or DVD burner.

  2. Open your system’s burning software - for example, Brasero on Fedora systems with GNOME desktop environment, or Nero on Windows systems. In the software’s main menu, find an option which lets you burn an ISO image to a disc. For example, in Brasero, this option is Burn image in the main menu on the left side of the window.

  3. When prompted, select the ISO image of Fedora to be burned, and the CD or DVD burner with a blank disc inside (if you have more than one drive).

  4. Confirm your selection, and wait for the disc to be burned.