Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-11-24 10:23:13 +08:00
commit 933ad59819
9 changed files with 651 additions and 430 deletions

View File

@ -1,31 +1,31 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12851-1.html)
[#]: subject: (Unlock encrypted disks on Linux automatically)
[#]: via: (https://opensource.com/article/20/11/nbde-linux)
[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield)
自动解锁 Linux 上的加密磁盘
======
通过使用网络绑定磁盘加密 NBDE无需手动输入密码即可打开加密磁盘。
![Lock][1]
从安全的角度来看对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。Linux 统一密钥设置([LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头中,所以它使数据迁移变得简单。
> 通过使用网络绑定磁盘加密NBDE无需手动输入密码即可打开加密磁盘。
![](https://img.linux.net.cn/data/attachment/album/202011/23/104735lmx18sxxs18f4xcc.jpg)
从安全的角度来看,对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。<ruby>Linux 统一密钥设置<rt>Linux Unified Key Setup</rt></ruby>[LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头部中,所以它使数据迁移变得简单。
要使用 LUKS 配置加密磁盘或分区,你需要使用 [cryptsetup][3] 工具。不幸的是,加密磁盘的一个缺点是,每次系统重启或磁盘重新挂载时,你都必须手动提供密码。
然而,网络绑定磁盘加密 NBDE 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。
然而,<ruby>网络绑定磁盘加密<rt>Network-Bound Disk Encryption</rt></ruby>NBDE 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,包括从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。
NBDE 采用以下技术实现:
* **[Clevis 框架][4]**一个可插拔的框架工具,可自动解密和解锁 LUKS 卷
* **[Tang 服务器][5]**用于将加密密钥绑定到网络状态的服务
* [Clevis 框架][4]:一个可插拔的框架工具,可自动解密和解锁 LUKS 卷
* [Tang 服务器][5]:用于将加密密钥绑定到网络状态的服务
Tang 向 Clevis 客户端提供加密密钥。 据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。
Tang 向 Clevis 客户端提供加密密钥。据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。
由于 NBDE 使用客户端-服务器架构,你必须同时配置客户端和服务器。你可以在你的本地网络上使用一个虚拟机作为 Tang 服务器。
@ -33,19 +33,17 @@ Tang 向 Clevis 客户端提供加密密钥。 据 Tang 的开发人员介绍,
用 sudo 安装 Tang
```
`sudo yum install tang -y`
sudo yum install tang -y
```
启用 Tang 服务器:
```
`sudo systemctl enable tangd.socket --now`
sudo systemctl enable tangd.socket --now
```
Tang 服务器工作在 80 端口,且必须加入 firewalld。 添加相应的 firewalld 规则:
Tang 服务器工作在 80 端口,需加入到 firewalld 防火墙。添加相应的 firewalld 规则:
```
@ -59,15 +57,13 @@ sudo firewall-cmd --reload
在本例中,假设你已经添加了一个名为 `/dev/vdc` 的新的 1GB 磁盘到你的系统中。
使用 fdisk 或 parted 创建主分区:
使用 `fdisk``parted` 创建主分区:
```
sudo fdisk /dev/vdc
```
完成以下步骤来安装客户端。
完成以下步骤来安装客户端:
```
Welcome to fdisk (util-linux 2.23.2).
@ -81,8 +77,7 @@ Building a new DOS disklabel with disk identifier 0x4a6812d4.
Command (m for help):
```
输入 **n** 来创建新的分区:
输入 `n` 来创建新的分区:
```
Partition type:
@ -99,8 +94,7 @@ Using default response p
Partition number (1-4, default 1):
```
按下**回车**键选择默认分区号:
按下回车键选择默认分区号:
```
First sector (2048-2097151, default 2048):
@ -108,8 +102,7 @@ Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151):
```
按**回车**键选择最后一个扇区:
按回车键选择最后一个扇区:
```
Using default value 2097151
@ -118,8 +111,7 @@ Partition 1 of type Linux and of size 1023 MiB is set
Command (m for help): wq
```
输入 **wq** 保存更改并退出 fdisk
输入 `wq` 保存更改并退出 `fdisk`
```
The partition table has been altered!
@ -130,20 +122,17 @@ Syncing disks.
运行 `partprobe` 通知系统分区表的变化:
```
`sudo partprobe`
sudo partprobe
```
使用 sudo 安装 cryptsetup 软件包:
使用 `sudo` 安装 cryptsetup 软件包:
```
`sudo yum install cryptsetup -y`
sudo yum install cryptsetup -y
```
使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入 **YES**,并选择和输入密码来加密磁盘:
使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入大写的 `YES`,并输入密码来加密磁盘:
```
sudo cryptsetup luksFormat /dev/vdc1
@ -159,7 +148,6 @@ Verify passphrase:
使用 `cryptsetup luksOpen` 命令将加密的分区映射到一个逻辑设备上。例如,使用 `encryptedvdc1` 作为名称。你还需要再次输入密码:
```
sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1
Enter passphrase for /dev/vdc1:
@ -169,67 +157,58 @@ Enter passphrase for /dev/vdc1:
在加密的分区上创建一个 XFS 文件系统:
```
`sudo mkfs.xfs /dev/mapper/encryptedvdc1`
sudo mkfs.xfs /dev/mapper/encryptedvdc1
```
创建一个挂载加密分区的目录:
```
`sudo mkdir /encrypted`
sudo mkdir /encrypted
```
使用 `cryptsetup luksClose` 命令锁定分区:
```
`cryptsetup luksClose encryptedvdc1`
cryptsetup luksClose encryptedvdc1
```
使用 sudo 安装 Clevis 软件包:
使用 `sudo` 安装 Clevis 软件包:
```
`sudo yum install clevis clevis-luks clevis-dracut -y`
sudo yum install clevis clevis-luks clevis-dracut -y
```
修改 /etc/crypttab在启动时打开加密卷
修改 `/etc/crypttab`,在启动时打开加密卷:
```
`sudo vim /etc/crypttab`
sudo vim /etc/crypttab
```
增加以下一行:
```
`encryptedvdc1 /dev/vdc1 none _netdev`
encryptedvdc1 /dev/vdc1 none _netdev
```
修改 /etc/fstab在重启时或启动时自动挂载加密卷
修改 `/etc/fstab`,在重启时或启动时自动挂载加密卷:
```
`sudo vim /etc/fstab`
sudo vim /etc/fstab
```
增加以下一行:
```
`/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2`
/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2
```
在这个例子中,假设 Tang 服务器的 IP 地址是 `192.168.1.20`。如果你喜欢,也可以使用主机名或域名。
运行以下 `clevis` 命令:
```
sudo clevis bind luks -d /dev/vdc1 tang '{"url":"<http://192.168.1.20"}>'
sudo clevis bind luks -d /dev/vdc1 tang '{"url":"http://192.168.1.20"}'
The advertisement contains the following signing keys:
rwA2BAITfYLuyNiIeYUMBzkhk7M
@ -238,16 +217,15 @@ Do you wish to trust these keys? [ynYN] Y
Enter existing LUKS password:
```
输入 **Y** 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。
通过 systemctl 启用 clevis-luks-askpass.path以防止非 root 分区被提示输入密码。
输入 `Y` 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。
通过 `systemctl` 启用 `clevis-luks-askpass.path`,以防止非根分区被提示输入密码。
```
`sudo systemctl enable clevis-luks-askpass.path`
sudo systemctl enable clevis-luks-askpass.path
```
客户端已经安装完毕。 现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。
客户端已经安装完毕。现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。
如果 Tang 服务器因为任何原因不可用,你需要手动提供密码,才能解密和挂载分区。
@ -258,7 +236,7 @@ via: https://opensource.com/article/20/11/nbde-linux
作者:[Curt Warfield][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,90 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Reclaim hard-drive space with LVM)
[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/)
[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/)
Reclaim hard-drive space with LVM
======
![Hard drive image][1]
Photo by Frank R @ Unsplash.com
LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. It is commonly used on Fedora installations (prior to BTRFS as default it was LVM+Ext4). But have you ever started up your system to find out that Gnome just said the home volume is almost out of space! Luckily, there is likely some space sitting around in another volume, unused and ready to re-alocate. Heres how to reclaim hard-drive space with LVM.
The key to easily re-alocate space between volumes is the [Logical Volume Manager (LVM)][2]. Fedora 32 and before use LVM to divide disk space by default. This technology is similar to standard hard-drive partitions, but LVM is a lot more flexible. LVM enables not only flexible volume size management, but also advanced capabilities such as read-write snapshots, striping or mirroring data across multiple drives, using a high-speed drive as a cache for a slower drive, and much more. All of these advanced options can get a bit overwhelming, but resizing a volume is straight-forward.
### LVM basics
The _volume group_ serves as the main container in the LVM system. By default Fedora only defines a single volume group, but there can be as many as needed. Actual hard-drive and hard-drive partitions are added to the _volume group_ as _physical volumes_. _Physical volumes_ add available free space to the _volume group_. A typical Fedora install has one formatted boot partition, and the rest of the drive is a partition configured as an LVM _physical volume_.
Out of this pool of available space, the _volume group_ allocates one or more _logical volumes_. These volumes are similar to hard-drive partitions, but without the limitation of contiguous space on the disk. LVM _logical volumes_ can even span multiple devices! Just like hard-drive partitions, _logical volumes_ have a defined size and can contain any filesystem which can then be mounted to specific directories.
### Whats needed
Confirm the system uses LVM with the _gnome-disks_ application, and make sure there is free space available in some other volume. Without space to reclaim from another volume, this guide isnt useful. A [Fedora live CD/USB][3] is also needed. Any file system that needs to shrink must be unmounted. Running from a live image allows all the volumes on the hard-disk to remain unmounted, even important directories like _/_ and _/home_.
![Use gnome-disks to verify free space][4]
### A word of warning
No data should be lost by following this guide, but it does muck around with some very low-level and powerful commands. One mistake could destroy all data on the hard-drive. So backup all the data on the disk first!
### Resizing LVM volumes
To begin, boot the Fedora live image and select _Try Fedora_ at the dialog. Next, use the _Run Command_ to launch the _blivet-gui_ application (accessible by pressing _Alt-F2_, typing _blivet-gui_, then pressing _enter_). Select the volume group on the left under _LVM_. The logical volumes are on the right.
![Explore logical volumes in blivet-gui][5]
The logical volume labels consist of both the volume group name and the logical volume name. In the example, the volume group is “fedora_localhost-live” and there are “home”, “root”, and “swap” logical volumes allocated. To find the full volume, select each one, click on the _gear_ icon, and choose _resize_. The slider in the resize dialog indicates the allowable sizes for the volume. The minimum value on the left is the space already in use within the file system, so this is the minimum possible volume size (without deleting data). The maximum value on the right is the greatest size the volume can have based on available free space in the _volume group_.
![Resize dialog in blivet-gui][6]
A grayed out _resize_ option means the volume is full and there is no free space in the volume group. Its time to change that! Look through all of the volumes to find one with plenty of extra space, like in the screenshot above. Move the slider to the left to set the new size. Free up enough space to be useful for the full volume, but still leave plenty of space for future data growth. Otherwise, this volume will be the next to fill up.
Click _resize_ and note that a new item appears in the volume listing: _free space_. Now select the full volume that started this whole endeavor, and move the slider all the way to the right. Press _resize_ and marvel at the new improved volume layout. However, nothing has changed on the hard drive yet. Click on the _check-mark_ to commit the changes to disk.
![Review changes in blivet-gui][7]
Review the summary of the changes, and if everything looks right, click _Ok_ to proceed. Wait for _blivet-gui_ to finish. Now reboot back into the main Fedora install and enjoy all the new space in the previously full volume.
### Planning for the future
It is challenging to know how much space any particular volume will need in the future. Instead of immediately allocating all available free space, consider leaving it free in the volume group. In fact, Fedora Server reserves space in the volume group by default. Extending a volume is possible while it is online and in use. No live image or reboot needed. When a volume is almost full, easily extend the volume using part of the available free space and keep working. Unfortunately the default disk manager, _gnome-disks_, does not support LVM volume resizing, so install _[blivet-gui][8]_ for a graphical management tool. Alternately, there is a simple terminal command to extend a volume:
```
lvresize -r -L +1G /dev/fedora_localhost-live/root
```
### Wrap-up
Reclaiming hard-drive space with LVM just scratches the surface of LVM capabilities. Most people, especially on the desktop, probably dont need the more advanced features. However, LVM is there when the need arises, though it can get a bit complex to implement. [BTRFS][9] is the default filesystem, without LVM, starting with [Fedora 33][10]. BTRFS can be easier to manage while still flexible enough for most common usages. Check out the recent [Fedora Magazine articles on BTRFS][11] to learn more.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/
作者:[Troy Curtis Jr][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/troycurtisjr/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg
[2]: http://sourceware.org/lvm2/
[3]: https://getfedora.org/en/workstation/download/
[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png
[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png
[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png
[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png
[8]: https://fedoraproject.org/wiki/Blivet-gui
[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/
[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/
[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/

View File

@ -1,275 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (frogOAO)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing])
[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]
======
If you are curious about Fedora Linux, there are several ways to try it.
The easiest way that wont affect your current operating system is to [create a live USB of Fedora.][1]
An alternative way to try Fedora, is to get advantage of virtualization technology through an installation in VirtualBox. This way, you use Fedora like an application on your current operating system.
This way, you can perform more thorough testing without messing up your current operating system.
You can even copy your virtual setup and re-install it on some other system. Sounds handy? Let me show you how to do it.
### Installing Fedora in VirtualBox
![][2]
Lets see the steps for installing Fedora Linux in Oracle VirtualBox.
#### Step 1: Install VirtualBox
If you havent already installed VirtualBox on your system, you can download it from the official website. You can find instructions for Windows, Mac OS and Linux. [Ubuntu users can refer to this detailed tutorial on installing VirtualBox][3].
![][4]
[Download VirtualBox][5]
#### **Step 2: Download the Fedora ISO**
If you are not familiar with fedora, there are a few images to be aware of.
[Fedora IoT][6] is to be used for scalable infrastructure, [Fedora workstation][7] is an image with a set of tools oriented for a desktop in a vanilla GNOME desktop environment and [Fedora server][8] as its name reveals, is tailored for a server or data center.
If GNOME isnt your first choice, you can download a [spin][9] of Fedora desktop with an alternative desktop environment. For this tutorial, I chose [Fedora 33][10] with the GNOME desktop environment.
[Download Fedora][11]
#### Step 3: Create an empty virtual machine and configure it
Fedora requires a minimum of 20GB disk space &amp; 2GB RAM, to install and run successfully. Although double those amounts is recommended for a smoother user experience. Based on that I will create and configure the virtual machine.
Start Virtual Box and click on New.
![Create a new virtual machine][12]
The most important option to pay attention, is the **type to be set to Linux and the version to Fedora (64-bit)**. If you start typing Fedora at the name prompt, VirtualBox will automatically pick the correct settings for you. Although the name doesnt have to be Fedora, it can be anything you like.
_If you have access to 32-bit version only, you need to enable virtualization technology on BIOS, if you have an AMD CPU it is called SVM. Worst-case scenario is that your CPU doesnt support virtualization technology. If you are not sure, check this first._
Once you have similar settings with me, click on the create button.
![Name your VM and assign it at least 3 GB RAM][13]
As mentioned before, you need at least 20 GB of disk space to be able to install Fedora. I have 32 GB of RAM on my system so I assigned 8 GB here. You should be fine with 3 GB of RAM.
A word about RAM consumption, the RAM will only be consumed by the virtual machine when you are running it. Otherwise, it will be available for regular usage.
Make sure that the rest of the settings match the example and click Create.
![Assign 15-20 GB of disk space in VDI format][14]
Before you click the start button of your virtual machine, you need to load the ISO as shown below [Optical Drive].
![Add the Fedora ISO to optical drive storage][15]
As your virtual hard drive is empty, the virtual machine will boot from this ISO. Think of it as using a live USB or disk for installing Linux.
![Go to Settings and add ISO as optical drive][16]
Then, if you have a multi-core CPU it is recommended to assign 2 or more cores for your virtual machine. You may find the CPU cores under the system tab. When you configure your system click ok and start the virtual machine.
![Optional step: Assign number of CPU cores][17]
Once you have configured everything, click on the start button to begin the installation.
#### Step 4: Install Fedora in VirtualBox
If you have followed the process correctly, when you start the virtual machine you will boot directly from the ISO file. When you see a similar to below screen select Start Fedora, and press the enter key.
![Fedora running in live environment in virtual machine][18]
To start the installation dialog box, click on Install to Hard Drive.
![Click on “install to hard drive”][19]
Before you proceed to the installation, it is essential to define your keyboard layout, your timezone and finally where the operating system will be installed.
![Choose keyboard, time and date and then go to Installation Destination][20]
The partitioning process is straight forward. You made some free space as VDI earlier. It should be automatically recognized.
Select your disk and set the storage configuration to automatic. Click on Done to go to the previous dialog box.
![Disk should be automatically recognized][21]
Once you have configured the above, click on “Begin Installation”.
![Begin installation of Fedora][22]
Now you just need to wait for five-six minutes for installation completion. Click on the “Finish installation” button when installation is finished.
As a last step, you need to power off your system. If you are unfamiliar with the GNOME desktop environment you can do it like so.
![Turn off Fedora live environment after installation][23]
You have to manually unload the ISO file that you loaded at the initial steps.
![Remove Fedora ISO From Optical Drive][24]
The next time you start the virtual machine with Fedora, you will be prompted to create a user account and set your password for Fedora Linux.
### Use VirtualBox guest additions for additional features like clipboard sharing, folder sharing and more
[Guest Additions][25] are designed to be installed inside a virtual machine post installation of the guest operating system. They contain device drivers and system applications that optimize the guest operating system for better performance and usability.
The Guest Additions ISO file is mounted as a virtual CD-ROM in order to be installed.
This is a straightforward process. Simply click on the devices tab and then click on “Insert Guest Additions CD image”
![][26]
You will be prompted to download the guest additions image, when prompt click on Download.
![Install VirtualBox Guest Additions][27]
#### **Shared clipboard**
At some point youll need to move some content between your virtual machine and the host operating system. The shared clipboard/drag and drop support will allow you to copy items on one platform and paste them on the other.
To enable this feature, choose **Settings** on the VirtualBox home page and follow the instructions as below. I find the **Bidirectional** option the most convenient.
![Enable clipboard sharing between guest and host systems][28]
#### **Shared folders**
There are two types of shares:
* Permanent shares, that are saved with the Virtual Machine settings.
* Transient shares, that are disappear when the Virtual Machine is powered off. These can be created using a checkbox in the VirtualBox Manager.
In this tutorial, I will make a permanent shared folder. In the VM settings add the host system folder you want to share and choose the name that you want to appear at your VM.
![][29]
The next time you start the virtual machine, the folder should appear as a network drive.
![][30]
#### **Better video support**
While the virtual graphics card which Oracle VirtualBox provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes, as well as accelerated video performance.
Using Guest Additions, the guest OSs resolution will dynamically resize as you adjust the VirtualBox window on your computer.
Finally, Guest Additions can take advantage of your computers graphics card. If youre a gamer or using productivity software in a WM, this makes a huge difference.
#### USB and Network Devices sharing
With VirtualBox, users have the ability to use a fully-functional operating system, without having to do the setup on different hardware. However, sharing USB and network devices between the host and guest machine is not as straightforward as it should be.
To access USB devices, you will need to install [the VirtualBox extension pack][31].
![Install VirtualBox Extensions pack][32]
_**This is for Linux only**_ because I am using all this in Linux.
In order for VirtualBox to have access to the USB subsystem, the user (on host system) running VirtualBox must belong to the vboxuser group. To do this, open up a terminal and issue the following command:
```
sudo usermod -aG vboxusers 'your username'
```
Once you run the command, you should either log out and log back in, or restart your host machine.
At this step, plug in your USB stick and through your VM settings you should be able to find and add the medium as shown at the example.
![][33]
Your USB will be accessible the next time you start your virtual machine.
![][34]
### Bonus Tip: Save and export the Virtual Machine so that you can use it later on any system
You may want to use your virtual machine to another computer or it is time to build a new machine and you need to keep your virtual machine as it is. You can easily export your current setup and import it to another machine at a few easy steps.
At the VirtualBox home panel, click on file and the export appliance. If you prefer keyboard shortcuts, you can simply click **Ctrl+E**.
![][35]
Choose the virtual machine you want to export and click on next.
![][36]
The Format option needs some attention. There are three different options of Open Virtualization Format 0.9, 1.0 and 2.0, which can be either ovf or ova extensions.
With ovf extension, several files will be written separately, compared to ova extension, which combines all the files into one Open Virtualization Format archive.
The default format, Open Virtualization Format 1.0, should be fine.
![][37]
To finish the process, click next and at the next dialog box click export.
#### Conclusion
By using a virtual machine you cant just test an operating system but deploy a fully functioning system, equally comparable to a physical machine. Nowadays, hardware has become so powerful and affordable that most of its power is not being utilized.
Through virtualization technology, you can use those wasted resources. The need for physical machines is reduced, and consequently the energy consumption is less. You can save money both from hardware and reduced running costs.
On a larger scale, server virtualization is more of a basic requirement than an advanced concept.
I hope you found this tutorial helpful in installing Fedora Linux in VirtualBox. If you face any issues, please let me know in the comments.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-fedora-in-virtualbox/
作者:[Dimitrios Savvopoulos][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/dimitrios/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1
[3]: https://itsfoss.com/install-virtualbox-ubuntu/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1
[5]: https://www.virtualbox.org/
[6]: https://getfedora.org/en/iot/
[7]: https://getfedora.org/en/workstation/
[8]: https://getfedora.org/en/server/
[9]: https://spins.fedoraproject.org/
[10]: https://itsfoss.com/fedora-33/
[11]: https://getfedora.org/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1
[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1
[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1
[25]: https://www.virtualbox.org/manual/ch04.html
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1
[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1
[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1
[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1
[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack
[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1
[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1
[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1
[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1
[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1
[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1

View File

@ -0,0 +1,56 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Day 10: Training an RNN to count to three)
[#]: via: (https://jvns.ca/blog/2020/11/20/day-10--training-an-rnn-to-count-to-three/)
[#]: author: (Julia Evans https://jvns.ca/)
Day 10: Training an RNN to count to three
======
Yesterday I was trying to train an RNN to generate English that sounds kind of like Shakespeare. That was not working, so today I instead tried to do something MUCH simpler: train an RNN to generate sequences like
```
0 1 2 0 1 2 0 1 2 0 1 2
```
and slightly more complicated sequences like
```
0 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0
```
I used (I think) the exact same RNN that I couldnt get to work yesterday to generate English by training it on Shakespeare, so it was cool to see that I could at least use it for this much simpler task (memorize short sequences of numbers).
### the jupyter notebook
Its late so I wont explain all the code in this blog post, but heres the PyTorch code I wrote to train the RNN to count to three.
* Here it is as a [github gist][1]
* and [here it is on Colab][2] if you want to run it yourself
In the gist there are a few experiments with different sequence lengths, like (unsurprisingly) it takes longer to train it to memorize a sequence of length 20 than a sequence of length 5.
### simplifying is nice
Im super happy that I got an RNN to do something that I actually understand! I feel pretty hopeful that on Monday Ill be able to go back to the character RNN problem of trying to get the RNN to generate English words now that I have this simpler thing working.
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2020/11/20/day-10--training-an-rnn-to-count-to-three/
作者:[Julia Evans][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://jvns.ca/
[b]: https://github.com/lujun9972
[1]: https://gist.github.com/jvns/b8804fb9d0672ce147a28d22648b4bd7
[2]: https://colab.research.google.com/gist/jvns/b8804fb9d0672ce147a28d22648b4bd7/rnn-123.ipynb

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,67 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Open source brings musicians together virtually)
[#]: via: (https://opensource.com/article/20/11/open-source-drum-bugle-corps)
[#]: author: (Vicki Walker https://opensource.com/users/vicki-walker)
Open source brings musicians together virtually
======
The open source ethos is embedded in many areas of life, including music
and art.
![Drums ][1]
When the COVID-19 pandemic began canceling live music events in spring 2020, it wasn't just the big arena shows, music festivals, and small, local venues that suffered—the big annual marching band competition leagues, like [Drum Corps International][2] (DCI) and [WGI World Championships][3], were also called off. This was a huge disappointment for the thousands of musicians and band directors who were already preparing for the spring and summer competition season. But the members of the [Drumcorps subreddit][4] saw it as an opportunity to take drum corps virtual.
The [Open Source Drum and Bugle Corps][5] (OSDBC) is one such organization bringing open source to drum corps. The group was founded on the principles of openness, inclusiveness, and collaboration. And, like most things in open source, OSDBC was created to solve a problem.
OSDBC launched in early April 2020, in the early weeks of US pandemic-related shutdowns, and immediately had 100 members in the group's Discord; within half a year, its membership approached 400 brass and percussion players across the United States. To date, the organization has released two performances and is working on its third.
All of the content OSDBC produces—including guides, documentation, sheet music, clicktracks, and virtual performances—is released under [Creative Commons][6] licenses so that other groups can replicate the project if they wish.
### Who's involved?
Most OSDBC members are professional musicians, teachers, and high school and college students. Because the drum corps community is relatively small, there's a strong possibility that students and their teachers might be participating together on the same project, leading to uncomfortableness or even potential legal issues relating to students and teachers being in the same group chats. Therefore, OSDBC members work anonymously, wearing hats and sunglasses in their performance videos, and many use pseudonyms within the group. It's an imperfect solution, but it does provide "plausible deniability" about someone's identity, says one member, a high school senior who serves on the project's all-volunteer staff.
Anonymity also levels the playing field among musicians with different levels of experience, which helps open up collaboration and personal growth opportunities, including the ability to ask for help without fear of embarrassment or judgment.
Members come from multiple disciplines—musicians, artists, composers, and audio engineers—volunteering their time and talent to produce multimedia content. Because everyone is a volunteer, there is no cost to be involved in the project.
### How it works
Unlike a typical drum corps, OSDBC can't perform together in person, first, because of the pandemic, and second because of the members' geographical distribution. Selecting a composition is a community effort, with votes taken both to pick a public domain musical piece to play and then to choose a composer (based on members' original compositions of the selected piece). The winner of the composition contest distributes sheet music, clicktracks, and advice for playing the piece, and the audio and video editors share [submission guidelines][7] about how to record and submit videos for inclusion in the project. Approximately a fifth of the members have submitted performances for each of the first three projects.
Once the submission deadline has passed and all the performances are collected, the design team begins to mix the individual videos into a cohesive performance.
Because editing a performance is a significant amount of work that requires specialized audio and video production knowledge and tools, the work is distributed among section leaders (e.g., trumpets, low brass, percussion, etc.). They use a mix of open source and proprietary software, chiefly [Audacity][8], Reaper, and FL Studios, to produce the videos; while open source is the preference, the members must use the applications that they are familiar with and have access to at their universities or jobs.
### Get involved
OSDBC plans to continue working together even after the COVID-19 pandemic. Given the uncertainty around the 2021 drum corps season, with WGI planning a virtual season and DCI weighing the feasibility of an abbreviated season, OSDBC provides a valuable option for the tight-knit community to collaborate and make music together.
The project eagerly welcomes new performers, organizers, arrangers, and others. If you would like to get involved, visit the [website][5] and join the project's [Discord][9] for updated information and opportunities to participate in the next project.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/open-source-drum-bugle-corps
作者:[Vicki Walker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/vicki-walker
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/drums-beat.png?itok=vhr6E_f1 (Drums )
[2]: https://www.dci.org/
[3]: https://www.wgi.org/
[4]: https://www.reddit.com/r/drumcorps/
[5]: https://opensourcedbc.org/
[6]: https://creativecommons.org/
[7]: https://opensourcedbc.org/info-for-members/
[8]: https://opensource.com/education/16/9/audacity-classroom
[9]: https://discord.gg/6QmCSK3

View File

@ -0,0 +1,114 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Save the Output of a Command to a File in Linux Terminal [Beginners Tip])
[#]: via: (https://itsfoss.com/save-command-output-to-file-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Save the Output of a Command to a File in Linux Terminal [Beginners Tip]
======
When you run a command or script in the Linux terminal, it prints the output on the screen for your immediate viewing.
There will be times when you need to save the output to a file for future references. Now, [you can surely copy and paste in Linux terminal][1] but there are better ways to save the output of a shell script or command in Linux command line. Let me show them to you.
### Method 1: Use redirection to save command output to file in Linux
You can [use redirection in Linux for this purpose][2]. With redirection operator, instead of showing the output on the screen, it goes to the provided file.
* The &gt; redirects the command output to a file replacing any existing content on the file.
* The &gt;&gt; redirects adds the command output at the end of the existing content (if any) of the file.
Use the STDOUT redirection operator &gt; for redirecting the output to a file like this:
```
command > file.txt
```
If the file.txt doesnt exist, it will be created automatically. If you use the &gt; redirect again with the same file, the file content is replaced by the new output.
The example below demonstrates it better. It first saves the output of _ls -l_ command. And then later, it replaces the content of the file with the output of _ls *.c_ command.
![Redirecting command output to file][3]
If you dont want to lose the content of the existing file while saving the output of a script or command, use the redirection operation in append mode with &gt;&gt;.
```
command >> file.txt
```
This example demonstrates it better:
![Redirecting command output to file in append mode][4]
Even here if the file doesnt exist, it is created automatically.
Bonus Tip: Save Linux command output as well as error to a file
If your Linux command returns an error, it doesnt get saved in the file. You can save both the command output and command error in the same file using 2&gt;&amp;1 like this:
**command &gt; file.txt 2&gt;&amp;1**
Basically, 0 stands for standard input, 1 for standard output and 2 for standard error. Here, you are redirecting (&gt;) standard error (2) to same address (&amp;) as standard output (1).
### Method 2: Use tee command to display the output and save it to a file as well
By the way, did you notice that when you send the command output to a file, you cannot see it anymore on the display? The [tee command in Linux][5] solves this problem for you.
Like a tee pipe that sends water stream into two directions, the tee command send the output to the display as well as to a file (or as input to another command). You can use it like this:
```
command | tee file.txt
```
Again, the file will be created automatically, if it doesnt exist already.
You may also use the tee command in append mode with option -a in this manner:
```
command | tee -a file.txt
```
Let me demonstrate it with some easy to follow examples:
![][6]
I have used simple Linux commands in my examples. But rest assured, you can use these methods to save the output of bash scripts as well.
### Note: Avoid pipe pitfall while saving command output to file
You probably are familiar with pipe redirection. You may use it to combine Linux commands but you cannot pipe the output to a file. It will result in error that filename command not found:
![][7]
This is because pipe redirects the output of one command to input of another command. And in this case, you give it a file name while it was expecting a command.
If you are new to Linux command line, I hope this quick tutorial added to your Linux knowledge a bit. [I/O redirection][8] is an essential concept that one should be aware of.
As always, questions and suggestions are always welcome.
--------------------------------------------------------------------------------
via: https://itsfoss.com/save-command-output-to-file-linux/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/copy-paste-linux-terminal/
[2]: https://linuxhandbook.com/redirection-linux/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/redirecting_command_output_to_file_in_linux.png?resize=741%2C456&ssl=1
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/redirecting_command_output_to_file.png?resize=741%2C494&ssl=1
[5]: https://linuxhandbook.com/tee-command/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/display-and-save-linux-command-output.png?resize=741%2C494&ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/pipe-output-to-file-linux.png?resize=687%2C266&ssl=1
[8]: https://tldp.org/LDP/abs/html/io-redirection.html#FTN.AEN17894

View File

@ -0,0 +1,90 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Reclaim hard-drive space with LVM)
[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/)
[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/)
使用 LVM 回收硬盘空间
======
![Hard drive image][1]
照片Frank R @ Unsplash.com
LVM 是一个逻辑卷管理工具,包括分配磁盘、区代化、镜像和调整逻辑卷的大小。它在 Fedora 安装中被普遍使用(在 BTRFS 作为默认之前是 LVM+Ext4。但是你是否曾经遇到过启动系统时Gnome 提示主卷几乎没有空间了!幸运的是,很有可能有一些空间在另一个卷中,而未被使用,并准备重新分配。下面就来看看如何用 LVM 回收硬盘空间。
在卷之间轻松重新分配空间的关键是[逻辑卷管理器 LVM][2]。Fedora 32 及以前的系统默认使用 LVM 来划分磁盘空间。这种技术类似于标准的硬盘分区,但 LVM 更加灵活。LVM 不仅可以实现灵活的卷大小管理,还可以实现一些高级功能,比如读写快照、在多个硬盘上进行数据区带化或镜像、将高速硬盘作为慢速硬盘的缓存等等。所有这些高级选项可能会让人有点不知所措,但调整卷的大小很直接的。
### LVM 基础
_卷组_作为 LVM 系统中的主要容器。默认情况下Fedora 只定义了一个卷组,但你可以根据需要定义多个卷组。实际的硬盘和硬盘分区被添加到 _卷组_中作为_物理卷_。_物理卷_会将可用的空间添加到_卷组_中。一个典型的 Fedora 安装有一个格式化的启动分区,其余的硬盘是一个配置为 LVM _物理卷_的分区。
从这个可用空间池中_卷组_分配了一个或多个_逻辑卷_。这些卷类似于硬盘分区但没有磁盘上连续空间的限制。LVM 的_逻辑卷_甚至可以跨越多个设备就像硬盘分区一样_逻辑卷_有一个定义的大小可以包含任何文件系统然后可以挂载到特定的目录。
### 需要什么
在 gnome-disks 应用中确认系统使用 LVM ,并确保其他卷中有可用的空间。如果没有从另一个卷中回收的空间,这个指南就没有用。还需要一个 [Fedora live CD/USB][3]。任何需要收缩的文件系统都必须卸载。从 Live 镜像运行可以让硬盘上的所有卷保持未挂载状态,甚至包括像 _/__/home_ 这样的重要目录。
![Use gnome-disks to verify free space][4]
### 一句话警告
按照这个指南,应该不会丢失任何数据,但它确实会使用一些非常底层和强大的命令。一个错误可能会破坏硬盘上的所有数据。所以要先备份磁盘上的所有数据!
### 调整 LVM 卷的大小
开始时,启动 Fedora Live 镜像并在对话框中选择 _Try Fedora_。接下来,使用 _Run Command_ 启动 _blivet-gui_ 应用(按 _Alt-F2_,输入 _blivet-gui_然后按_回车_。选择左侧 _LVM_ 下的卷组。逻辑卷在右边。
![Explore logical volumes in blivet-gui][5]
逻辑卷标签由卷组名称和逻辑卷名称组成。在本例中,卷组是 “fedora_localhost-live”分配了 “home”、“root” 和 “swap” 逻辑卷。要找到完整的卷选择每一个卷点击_齿轮_图标然后选择 _resize_。调整大小对话框中的滑块表示卷的允许大小。左边的最小值是文件系统中已经使用的空间所以这是最小可能的体积大小不删除数据。右边的最大值是基于_卷组_中的最大可用空间。
![Resize dialog in blivet-gui][6]
灰色的 _resize_ 选项意味着该卷已经满了,而且卷组中没有可用空间。现在可以更改大小了!查看所有的卷,就像上面的截图那样,找到一个有足够空间的卷。并像上面的截图那样,在所有的卷中找到一个有大量额外空间的卷。向左移动滑块来设置新的大小。腾出足够的空间对整个卷有用,但仍然为未来的数据增长留出足够的空间。否则,这个卷将是下一个被填满的卷。
点击 _resize_注意卷列表中出现了一个新项目_空闲空间_。现在选择这次要调整的卷并将滑块一直向右移动。按 _resize_并查看新改进的卷的布局。然而硬盘驱动器上的任何东西都还没有改变。点击_勾选按钮_将更改提交到磁盘。
![Review changes in blivet-gui][7]
查看更改的摘要,如果一切看起来都是正确的,点击 _Ok_ 继续。等待 _blivet-gui_ 完成。现在重新启动回到 Fedora ,享受之前被充满的卷上的新空间。
### 为未来计划
要知道任何特定卷在未来需要多少空间是很困难的。与其立即分配所有可用的空闲空间不如考虑在卷组中留出空闲空间。事实上Fedora Server 默认在卷组中保留空间。当一个卷处于在线和使用中时,扩展卷是可能的。不需要 Live 镜像或重启。当一个卷几乎满的时候,可以使用部分可用空间轻松扩展卷并继续工作。遗憾的是,默认的磁盘管理器 _gnome-disks_ 不支持 LVM 卷的大小调整,所以安装 _[blivet-gui][8]_ 作为图形化管理工具。另外,还有一个简单的终端命令来扩展卷。
```
lvresize -r -L +1G /dev/fedora_localhost-live/root
```
### 总结
用 LVM 回收硬盘空间只是 LVM 功能的表面。大多数人特别是在桌面中可能不需要更高级的功能。然而当需要的时候LVM 就在那里,尽管它的实现可能会变得有点复杂。从 [Fedora 33][10] 开始,[BTRFS][9] 是默认的文件系统,没有 LVM。BTRFS 可以更容易管理,同时对于大多数常见的使用来说也足够灵活。查看最近 [Fedora Magazine 关于 BTRFS 的文章][11]了解更多。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/
作者:[Troy Curtis Jr][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/troycurtisjr/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg
[2]: http://sourceware.org/lvm2/
[3]: https://getfedora.org/en/workstation/download/
[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png
[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png
[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png
[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png
[8]: https://fedoraproject.org/wiki/Blivet-gui
[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/
[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/
[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/

View File

@ -0,0 +1,281 @@
[#]: collector: (lujun9972)
[#]: translator: (frogOAO)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing])
[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
如何在 Fedora 中安装 VirtualBox 【附带 USB剪切板文件夹共享教程】
======
如果您对 Fedora Linux 感兴趣,这有几种方式可以尝试它。
最简单还不影响您操作系统的方式是 [制作 Fedora 的 USB 启动盘][1]
另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样你可以在你的操作系统上像使用应用程序一样使用 Fedora。
通过这种方式,您可以执行更彻底的测试,而不会搞乱当前的操作系统。
您甚至可以复制您的虚拟安装程序,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。
### 在 Fedora 上安装 Fedora
![][2]
让我们分步在 Oracle VirtualBox 上安装 Fedora。
#### 步骤一:安装 VirtualBox
如果您的系统还没有安装 VirtualBox您可以从官方网站下载。您可以找到 WindowsMacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3].
![][4]
[下载 VirtualBox][5]
#### **步骤二: 下载 Fedora ISO**
如果您不熟悉 Fedora那么这些镜像您需要知道。
[Fedora IoT][6] 是用于可扩展基础设施的, [Fedora workstation][7] 是一个镜像带有一组面向普通GNOME桌面环境中的桌面的工具。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。
如果GNOME不是您的首选您可以下载一个带有替代桌面环境的[定制版][9]Fedora桌面。 对于本教程我选择了带有GNOME桌面环境的[Fedora 33][10]。
[下载 Fedora][11]
#### 步骤三: 创建一个空虚拟机并对其进行配置
要成功安装和运行 Fedora至少需要 20GB 磁盘空间和 2GB RAM。不过为了获得更流畅的用户体验建议增加一倍。在此基础上我将创建并配置虚拟机。
开启 Virtual Box 点击 New。
![创建一个新的虚拟机][12]
需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 FedoraVirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora它可以是任何你喜欢的。
_如果您只能访问 32 位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定先检查这个。_
如果您的设置和我一样,点击 create 按钮。
![Name your VM and assign it at least 3 GB RAM][13]
如前所述,至少需要 20gb 的磁盘空间才能安装 Fedora。我的系统上有 32gb 的内存,所以我分配了 8gb。3 GB 的内存应该没问题。
顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。
确保其余设置与示例匹配,并点击 Create。
![Assign 15-20 GB of disk space in VDI format][14]
在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。
![Add the Fedora ISO to optical drive storage][15]
因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用 live USB 或磁盘安装 Linux。
![Go to Settings and add ISO as optical drive][16]
然后如果您有一个多核CPU建议为虚拟机分配 2 个或更多的核。您可以在 system 选项卡下找到 CPU 核心。配置系统时,单击 ok 并启动虚拟机。
![Optional step: Assign number of CPU cores][17]
配置好所有内容后,单击 start 按钮开始安装。
#### 步骤四:在 VirtualBox 中安装 Fedora。
如果您正确地遵循了这个过程,那么当您启动虚拟机时,您将直接从 ISO 文件启动。当您看到类似下面的屏幕时,选择 Start Fedora并按 enter 键。
![Fedora running in live environment in virtual machine][18]
要启动安装对话框,单击 Install To Hard Drive。
![Click on “install to hard drive”][19]
在您继续安装之前,有必要定义您的键盘布局、您的时区以及最终安装操作系统的位置。
![Choose keyboard, time and date and then go to Installation Destination][20]
划分过程很简单。您像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。
选择您的磁盘并将存储配置设置为 automatic。单击 Done 进入上一个对话框。
![Disk should be automatically recognized][21]
一旦你配置了上面的,点击 “Begin Installation”。
![Begin installation of Fedora][22]
现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。
最后一步,需要关闭系统的电源。如果您不熟悉 GNOME 桌面环境,您可以这样做。
![Turn off Fedora live environment after installation][23]
您必须手动卸载在初始步骤中加载的 ISO 文件。
![Remove Fedora ISO From Optical Drive][24]
下一次使用 Fedora 启动虚拟机时,系统将提示您为 Fedora Linux 创建用户帐户并设置密码。
### 使用 VirtualBox 客户添加的附加功能,如剪贴板共享,文件夹共享等
[增强功能包][25] 客户附加程序设计为在客户操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。
客户添加 ISO 文件被安装为虚拟 CD-ROM 以便安装。
这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。
![][26]
当提示符单击 download 时,系统将弹出您下载增强功能包界面。
![Install VirtualBox Guest Additions][27]
#### **共享剪贴板**
有时候,您需要在虚拟机和主机操作系统之间移动一些内容。共享剪贴板/拖放支持将允许您在一个平台上复制项目,并将它们粘贴到另一个平台上。
要启用此功能请在VirtualBox主页上选择 **Settings**,并按照下面的说明操作。**双向** 的选项是最方便的。
![Enable clipboard sharing between guest and host systems][28]
#### **共享文件夹**
有两种类型的分享:
* 永久共享,与虚拟机设置一起保存。
* 暂态共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂态共享。
在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加您想要共享的主机系统文件夹,并选择您想要在 VM 中出现的名称。
![][29]
下次启动虚拟机时,该文件夹应该显示为网络驱动器。
![][30]
#### **更好的视频支持**
虽然 Oracle VirtualBox 提供了所有基本功能的虚拟显卡,但客户添加的自定义视频驱动程序为您提供了超高和非标准的视频模式,以及加速的视频性能。
使用增强安装包,操作系统的分辨率将随着您调整计算机上的 VirtualBox 窗口而动态调整大小。
最后,增强安装包可以利用您的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。
#### USB 和网络设备共享
有了 VirtualBox用户就可以使用一个功能齐全的操作系统而不必在不同的硬件上进行设置。然而在主机和客户机器之间共享USB和网络设备并不像想的那样简单。
要访问USB设备您将需要安装 [VirtualBox 扩展包][31].
![Install VirtualBox Extensions pack][32]
_**下面这些仅对 Linux**_因为我使用的是 Linux。
为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在主机系统上)必须属于 vboxuser 组。为此,打开一个终端并发出以下命令:
```
sudo usermod -aG vboxusers 'your username'
```
运行该命令后,您应该注销并重新登录,或者重新启动主机。
在这一步,插入你的 u 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。
![][33]
当您下次启动虚拟机您的USB将是可访问的。
![][34]
### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它
您可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且您需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。
在 VirtualBox 主面板上,单击 file 和 export 工具。如果你喜欢键盘快捷键,你可以简单地点击 **Ctrl+E**
![][35]
选择要导出的虚拟机,然后单击 next。
![][36]
格式选项需要注意一下。开放虚拟化格式 0.9、1.0 和 2.0 有三种不同的选项,可以是 ovf 或 ova 扩展。
使用 ovf 扩展名,可以分别编写几个文件,而 ova 扩展名则将所有文件合并到一个开放的虚拟化格式归档文件中。
默认格式 Open Virtualization format 1.0 应该没问题。
![][37]
要完成该过程,单击 next然后在下一个对话框中单击 export。
#### 总结
通过使用虚拟机,您不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。
通过虚拟化技术,您可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。您可以从硬件和降低运行成本两方面省钱。
在更大的范围内,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。
我希望本教程对您在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-fedora-in-virtualbox/
作者:[Dimitrios Savvopoulos][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/frogOAO)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/dimitrios/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1
[3]: https://itsfoss.com/install-virtualbox-ubuntu/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1
[5]: https://www.virtualbox.org/
[6]: https://getfedora.org/en/iot/
[7]: https://getfedora.org/en/workstation/
[8]: https://getfedora.org/en/server/
[9]: https://spins.fedoraproject.org/
[10]: https://itsfoss.com/fedora-33/
[11]: https://getfedora.org/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1
[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1
[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1
[25]: https://www.virtualbox.org/manual/ch04.html
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1
[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1
[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1
[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1
[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack
[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1
[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1
[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1
[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1
[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1
[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1