arch linux安装_安装Arch Linux如何使我的旧笔记本电脑重获新生

news/2024/11/13 2:13:30/

arch linux安装

by Jonathan Baldie

乔纳森·巴尔迪(Jonathan Baldie)

安装Arch Linux如何使我的旧笔记本电脑重获新生 (How installing Arch Linux brought my old laptop back to life)

Got an old computer that is too slow to run Windows? Don’t throw it away or sell it. Install Linux on it.

拥有一台速度太慢而无法运行Windows的旧计算机? 不要扔掉它或出售它。 在其上安装Linux。

Never used Linux? It’s a lot of fun, as long as you’re willing to learn and to tinker.

没用过Linux? 只要您愿意学习和修修补补,它就很有趣。

Note that if you do not enjoy tinkering, desktop Linux might not be the best operating system for you.

请注意,如果您不喜欢修补程序,则桌面Linux可能不是您的最佳操作系统。

The Windows and macOS operating systems make systems run slower over time. Apps get more complex as they adapt to the demands for more user-friendly features.

Windows和macOS操作系统使系统随着时间的推移运行速度变慢。 应用随着适应对更多用户友好功能的需求而变得更加复杂。

Windows 10 has been better on this front. Microsoft’s goal to have a universal OS across desktops, tablets, and mobile devices has encouraged them to cater to machines with lower specs.

Windows 10在这方面表现更好。 微软的目标是在台式机,平板电脑和移动设备上拥有通用操作系统,这鼓励它们迎合规格较低的计算机。

But I’m not sure if Apple has that same goal. The new MacBook Pros are slower than many machines that are a third of the price. Many users have complained that El Capitan and Sierra drain more resources after they have upgraded their Mac’s operating systems.

但是我不确定苹果是否有同样的目标。 新款MacBook Pro的速度比许多价格低三分之一的机器要慢。 许多用户抱怨El Capitan和Sierra在升级Mac操作系统后会消耗更多资源。

That’s not inherently a bad thing. I love the care taken to enhance the usability of my Mac. And I love how fast my Windows 10 machine operates, and I’ve used Windows since I was seven years old. I consider myself a Windows power user.

从本质上来说,这不是一件坏事。 我喜欢为增强Mac可用性而采取的措施。 我喜欢Windows 10机器的运行速度,而且我从7岁开始就使用Windows。 我认为自己是Windows的高级用户。

Beware of fanboyhood. Always stay open-minded. It’s foolish to stick to either of these operating systems. There’s more to life than the computer you use.

当心幻想。 始终保持胸襟开阔。 坚持使用这两种操作系统是愚蠢的。 生活不仅仅是您使用的计算机。

But the planned obsolescence means that people needlessly throw away old Macs and Windows machines. They are too slow to use and new software cannot be installed on them.

但是计划中的淘汰意味着人们不必要地丢弃了旧的Mac和Windows计算机。 它们使用起来太慢,因此无法安装新软件。

I booted up my 2008 MacBook a few weeks ago, and it refused to install Chrome. Wouldn’t even touch it with a barge pole. Not cool!

几周前,我启动了2008 MacBook,但它拒绝安装Chrome。 甚至都不会用驳船竿碰它。 不酷!

However, I’m now writing with a 2009 Acer Aspire 5735. It has a Core 2 Duo processor, with two cores at 2.0GHz. It has 4GB of DDR2 RAM, and a 500GB HDD. I’ve installed a brand new battery, but so far that’s the only hardware upgrade.

但是,我现在使用的是2009 Acer Aspire5735。它具有Core 2 Duo处理器和两个2.0GHz的内核。 它具有4GB DDR2 RAM和500GB HDD。 我已经安装了全新的电池,但是到目前为止,这是唯一的硬件升级。

I’m using the latest version of Google Chrome. Currently, I have six tabs open, and I have yet to experience any major slowdown to date. It also has the latest versions of PhpStorm and DataGrip.

我正在使用最新版本的Google Chrome。 目前,我有六个选项卡在打开,到目前为止,我还没有遇到任何重大的问题。 它还具有PhpStorm和DataGrip的最新版本。

At the time when my dad bought me this laptop, it was very popular. I loved it. It was a high-spec machine, and it ran very well. I had just started university, and this machine helped me with my studying habits. And in my my free time, it served well for browsing and consuming media. It was a fantastic portable work machine for five years.

当我父亲给我买这台笔记本电脑时,它很受欢迎。 我爱它。 这是一台高规格的机器,并且运行得非常好。 我刚上大学,这台机器帮助我养成了学习习惯。 在我的业余时间里,它非常适合浏览和消费媒体。 这是五年来出色的便携式工作机。

It doesn’t make any sense to me that it just died. I didn’t do any demanding gaming on it, I just wanted to be productive on it.

对我来说,它死了没有任何意义。 我没有对它进行任何苛刻的游戏,我只是想提高效率。

I want email, I want browsing, I want PhpStorm and DataGrip on my laptop. With Linux, I can do all of those things with ease.

我想要电子邮件,我想要浏览,我想要笔记本电脑上的PhpStorm和DataGrip。 使用Linux,我可以轻松完成所有这些事情。

Even better, my activity isn’t being monitored by a corporation. My operating system isn’t listening through the microphone 24/7 and storing data in a data warehouse outside of the country.

更好的是,我的活动不受公司的监视。 我的操作系统不是通过24/7麦克风监听,也不是在国外的数据仓库中存储数据。

With Linux, I have as much freedom and privacy as I want.

使用Linux,我可以拥有尽可能多的自由和私密性。

Installing Linux on your laptop is insanely easy, too. I’ll show you how to do that in just a second.

在笔记本电脑上安装Linux也非常容易。 我将在几秒钟内告诉您如何执行此操作。

Remember that Linux powers the biggest servers, the most popular applications, and the most important services in the world.

请记住,Linux为世界上最大的服务器,最流行的应用程序和最重要的服务提供动力。

But it also powers all Android smartphones. While mobiles are getting more powerful every year, they’re not as powerful as modern computers. And Android runs very smoothly on most modern phones.

但这也为所有Android智能手机提供动力。 尽管移动电话每年都在变得越来越强大,但它们却不如现代计算机强大。 Android在大多数现代手机上都可以非常流畅地运行。

That’s because Linux is simple. It uses less resources and has a rich community of developers who are keen to help each other out.

那是因为Linux很简单。 它使用较少的资源,并拥有一群乐于助人的开发人员社区。

If Linux is good enough to power the most important services in the world, it’s good enough to use to browse your Facebook news feed.

如果Linux足以支持世界上最重要的服务,那么它足以用来浏览您的Facebook新闻提要。

Arch Linux (Arch Linux)

For my installation, I chose Arch Linux. This isn’t a distribution for the faint of heart.

对于我的安装,我选择了Arch Linux。 这不是为胆小的人分配的。

The barebones installer for Arch isn’t GUI-based or even text-based. It purely uses the command line.

Arch的准系统安装程序不是基于GUI的,甚至不是基于文本的。 它仅使用命令行。

I like that, though. Installing an OS in this way helps me to understand its inner workings.

不过我喜欢。 以这种方式安装操作系统有助于我了解其内部工作原理。

I have Ubuntu 16.10 “Yakkety” on my desktop, and it was a breeze to install. I downloaded the ISO, burned it to a USB, plugged it into my PC, booted from the USB, and followed the easy instructions.

我的桌面上安装了Ubuntu 16.10“ Yakkety”,安装起来很轻松。 我下载了ISO,将其刻录到USB,将其插入PC,从USB启动,然后按照简单的说明进行操作。

Ubuntu is by far the softest introduction to Linux. I recommend it to people with no experience outside of Windows or even macOS, because it’ll be the most familiar to people.

到目前为止,Ubuntu是最软的Linux入门。 我向没有Windows甚至macOS经验的人推荐它,因为它将是人们最熟悉的。

When you dive deeper into Linux, try different things, and get used to the terminal. You’ll understand why I like the Arch installer.

当您深入研究Linux时,请尝试不同的方法,并习惯于终端。 您将了解为什么我喜欢Arch安装程序。

I didn’t use the text-based Arch “Anywhere” installer. I just used the command line.

我没有使用基于文本的Arch“ Anywhere”安装程序。 我只是使用命令行。

And although Arch has been frequently called a “text-based horror game” by some, the reality is that it’s incredibly simple to install. You will learn more about how the internals actually work later in this article.

尽管有些人经常将Arch称为“基于文本的恐怖游戏” ,但事实是它的安装极其简单。 您将在本文后面的内容中详细了解内部原理。

You don’t get a desktop environment by default. It’s purely command line. This is by design. Arch is intended to be a simple barebones Linux system.

默认情况下,您没有桌面环境。 纯粹是命令行。 这是设计使然。 Arch旨在成为一个简单的准系统Linux系统。

Arch is addictive. You start with nothing and install software as needed.

拱是上瘾的。 您一无所有,然后根据需要安装软件。

By contrast, Ubuntu is subtractive. You start with everything you could possibly need, and trim down until you have a lighter system.

相比之下,Ubuntu是减法。 您从可能需要的一切开始,然后进行精简,直到您拥有更轻的系统。

Neither of them is “right.” Each just fits different people and use cases. The only “right” OS is the OS that best helps you to work and play.

他们俩都不是“正确的”。 每个都适合不同的人和用例。 唯一“正确”的操作系统是最能帮助您工作和娱乐的操作系统。

Once again, though, it is incredibly easy to install a desktop environment to Arch. It literally takes two commands and a reboot to install an operating desktop.

再一次,将桌面环境安装到Arch变得非常容易。 从字面上看,需要两个命令并重新启动才能安装运行中的桌面。

And because we want a system that we can use, we’ll definitely want a desktop environment. In my installation, I chose Gnome 3. I like the look of it. Although it’s known to be resource heavy, I relish the challenge. I think my laptop is up to it.

而且因为我们需要一个可以使用的系统,所以我们肯定需要一个桌面环境。 在我的安装中,我选择了Gnome 3 。 我喜欢它的外观。 尽管众所周知这会占用大量资源,但我还是乐于接受挑战。 我认为我的笔记本电脑可以满足要求。

Let’s get started.

让我们开始吧。

我如何在笔记本电脑上安装Arch Linux (How I installed Arch Linux on my laptop)

I will now explain how I installed Arch Linux on my laptop.

现在,我将解释如何在笔记本电脑上安装Arch Linux。

You can follow along if you like. Just beware that this will erase all the data on your computer’s hard drive. Only do this if you’re absolutely sure you want to do this, so back up your important data onto another machine. Definitely don’t erase the data on a machine that isn’t yours!

如果愿意,可以跟着。 请注意,这将删除计算机硬盘上的所有数据。 仅在绝对确定要这样做时才这样做,因此请将重要数据备份到另一台计算机上。 绝对不要在不是您的机器上擦除数据!

1.创建USB安装程序 (1. Create the USB installer)

First, I downloaded the official Arch Linux ISO from their website. I decided on the 64-bit version.

首先,我从他们的网站下载了官方的Arch Linux ISO。 我决定使用64位版本。

On my Windows 8 tablet, I used a program called Rufus. It allowed me to burn the ISO to a USB stick.

在Windows 8平板电脑上,我使用了名为Rufus的程序。 它使我可以将ISO刻录到USB记忆棒。

If you want to try this, you’ll need a USB stick with enough memory to hold the OS at least. You can buy an 8GB USB stick, which is more than enough space, at a very cheap price nowadays.

如果要尝试此操作,则需要具有足够内存的USB记忆棒以至少容纳操作系统。 如今,您可以以非常便宜的价格购买8GB的USB记忆棒,其容量已足够。

And if you’re on a Mac, you won’t be able to use Rufus, but you can use UNetbootin, which is highly rated.

而且,如果您使用的是Mac,则将无法使用Rufus,但可以使用获得高度评价的UNetbootin 。

Then once inside Rufus, I chose the USB stick from the list of drives. I chose the ISO image from my downloads folder, and selected Start to begin the burning process.

然后进入Rufus,我从驱动器列表中选择了USB记忆棒。 我从下载文件夹中选择了ISO映像,然后选择“ 开始”开始刻录过程。

Warning: If you do this, it will delete everything on the USB stick.

警告: 如果这样做,它将删除USB记忆棒上的所有内容。

When the process finished, I had a bootable USB stick.

该过程完成后,我有了一个可启动的USB记忆棒。

2.从USB记忆棒启动 (2. Boot from the USB stick)

I rebooted the laptop, plugged in the USB stick, and entered the BIOS. I changed the boot priority so that the USB drive controller is at the top. Then I exited the BIOS and the computer rebooted.

我重新启动了笔记本电脑,插入了USB记忆棒,然后进入BIOS。 我更改了启动优先级,以使USB驱动器控制器位于顶部。 然后我退出BIOS,计算机重新启动。

I was greeted by the GRUB boot loader, which took me to the Arch Linux terminal. It’s a weird, limbo-like place where you’re using the USB stick as the OS and the main filesystem. Many people actually plug the USB stick into their computer to have a portable operating system.

GRUB引导加载程序向我表示欢迎,它使我进入了Arch Linux终端。 这是一个使用USB记忆棒作为操作系统和主文件系统的怪异,混乱的地方。 实际上,许多人将USB随身碟插入他们的计算机以拥有便携式操作系统。

3.检查网络 (3. Check the network)

Plugging in an Ethernet cable to my router allowed me to have internet access. I checked that the internet was up, with the code

将以太网电缆插入路由器可以使我能够访问互联网。 我用代码检查了互联网是否正常

ping google.com

This resulted in successful pings that returned a response.

这导致ping成功并返回了响应。

The internet was a-OK!

互联网还不错!

The Ethernet is the simplest and most secure way to connect to your internet source provider. Most old laptops have an Ethernet port. I chose not to configure Wi-Fi until I had installed the Gnome desktop environment because it would be easier.

以太网是连接到互联网来源提供商的最简单,最安全的方法。 大多数旧笔记本电脑都有以太网端口。 在安装Gnome桌面环境之前,我选择不配置Wi-Fi,因为这样会更容易。

4.分区硬盘 (4. Partition the hard drive)

At that time, I still had Windows Vista installed on the laptop’s main hard drive. To install Linux, I had to format the hard drive.

那时,笔记本电脑的主硬盘上仍然安装了Windows Vista。 要安装Linux,我必须格式化硬盘。

But first, I needed to set up the partition table. This, among other things, tells the boot loader which part of the hard drive is bootable.

但是首先,我需要设置分区表。 除其他事项外,这还告诉引导加载程序可引导硬盘的哪一部分。

To view the partition table, type

要查看分区表,请键入

fdisk -l

I wanted two partitions on the main hard drive:

我想要主硬盘上有两个分区:

  • /dev/sda1, the primary bootable with 457GB of space

    /dev/sda1 ,主启动空间为457GB

  • /dev/sda2, the primary swap space with 8GB, or double the RAM

    /dev/sda2 ,主交换空间为8GB或RAM的两倍

Allocating double the RAM to swap space is a good idea for older machines with less RAM. Linux will put unused memory into the swap space to free up RAM for more immediate tasks.

对于RAM较少的旧计算机,分配两倍的RAM来交换空间是一个好主意。 Linux将未使用的内存放入交换空间,以释放RAM来执行更多直接任务。

I typed this into the terminal to action the partition:

我在终端中输入以下内容来操作分区:

cfdisk

This program provides a user interface for creating and managing partitions.

该程序提供了用于创建和管理分区的用户界面。

It should look something like this:

它看起来应该像这样:

I highlighted the existing partitions and selected DELETE. Then I selected NEW and entered 457G as the space, marking it as primary.

我突出显示了现有分区并选择了DELETE 。 然后,我选择“ NEW并输入457G作为空间,将其标记为“主要”。

Next, I selected BOOTABLE on that partition.

接下来,我在该分区上选择了BOOTABLE

Then I selected the FREE SPACE in the line below, clicked NEW again, and created the swap partition with 8G of space. This was double the laptop’s RAM, marking it as primary. Linux should automatically recognize this as swap space.

然后,在下面的行中选择“ FREE SPACE ”,再次单击“ NEW ,然后创建具有8G空间的交换分区。 这是笔记本电脑的RAM的两倍,将其标记为主要。 Linux应该自动将其识别为交换空间。

I then selected WRITE and typed yes to confirm. This installed the new partitions.

然后,我选择WRITE并键入yes进行确认。 这将安装新的分区。

Warning: Beware if you do this yourself. This might erase data and will definitely mess up your existing installation. So only follow this if you’re committed to trying out Arch Linux.

警告:当心自己做。 这可能会擦除数据,并且肯定会破坏您现有的安装。 因此,只有在您致力于试用Arch Linux时,才应遵循此步骤。

To verify the partitions, type

要验证分区,请键入

fdisk -l

5.格式化分区 (5. Format the partitions)

I created the primary partitions, but they weren’t formatted yet. I used this command to format the main partition as EXT4:

我创建了主分区,但尚未格式化。 我使用以下命令将主分区格式化为EXT4:

mkfs.ext4 /dev/sda1

Then to format and activate the swap partition:

然后格式化并激活交换分区:

mkswap /dev/sda2swapon /dev/sda2

The hard drive has been completely formatted, and the swap partition activated.

硬盘驱动器已完全格式化,并且交换分区已激活。

6.安装基本的Arch Linux系统 (6. Installing the base Arch Linux system)

To install the Arch Linux base system, I mounted the laptop’s new primary /dev/sda1 partition onto my USB’s filesystem.

要安装Arch Linux基本系统,我将笔记本电脑的新主/dev/sda1分区安装到了USB的文件系统上。

Remember that the USB is acting as “the computer” in this situation. Unix system have one tree for the filesystem. It doesn’t matter if it’s running off a USB stick or an RPi or a powerful server, all Unix systems are like this.

请记住,在这种情况下,USB充当“计算机”。 Unix系统有一棵文件系统树。 无论它是在USB记忆棒,RPi还是功能强大的服务器上运行,所有的Unix系统都是这样。

Mounting a drive into the filesystem is sort of like docking a filesystem onto the main one. We’re temporarily “plugging” the hard drive’s primary partition’s filesystem into the USB’s filesystem.

将驱动器装入文件系统有点像将文件系统停靠在主系统上。 我们暂时将硬盘驱动器的主分区的文件系统“插入” USB的文件系统。

mount /dev/sda1 /mntpacstrap /mnt base base-devel

This didn’t take too long, but I did have time to make myself a cup of tea and check my emails on my tablet.

没花太长时间,但我确实有时间给自己泡杯茶,然后在平板电脑上查看电子邮件。

When it was done I patted myself on the back, and ran the next command to create the fstab. This is a file which contains information about the system’s partitions.

完成后,我拍了拍自己的背,然后运行下一个命令来创建fstab。 这是一个文件,其中包含有关系统分区的信息。

genfstab /mnt >> /mnt/etc/fstab

The file can be read to verify:

可以读取该文件以验证:

cat /mnt/etc/fstab

7.配置Arch Linux (7. Configure Arch Linux)

I needed to log into the new Arch Linux install to configure a few things. I needed to set the root password and time zone, and create my user account.

我需要登录到新的Arch Linux安装中,以配置一些东西。 我需要设置root密码和时区,并创建我的用户帐户。

arch-chroot /mnt /bin/bash

Then I edited the locale file:

然后,我编辑了语言环境文件:

vi /etc/locale.gen

I found my locale en_GB.UTF-8 and uncommented it. Then I pressed ESCAPE and typed :x to write and exit the file.

我找到了语言环境en_GB.UTF-8并取消了注释。 然后,我按ESCAPE并键入:x来写入和退出文件。

To activate the locale, I entered:

要激活语言环境,我输入:

locale-gen

Next, I created another locale file:

接下来,我创建了另一个语言环境文件:

vi /etc/locale.conf

I added the following line and saved the file as above.

我添加了以下行,并如上所述保存了文件。

LANG=en_GB.UTF-8

Then I set the correct time zone.

然后,我设置了正确的时区。

In the UK we have a variable time zone. In the summer we use British Summer Time (BST), which is one hour ahead of UTC. The rest of the time we’re on Greenwich Mean Time (GMT), which is the same as UTC. It will probably be simpler for you if you’re elsewhere in the world.

在英国,我们有可变的时区。 在夏季,我们使用英国夏令时(BST),该时间比UTC提前一小时。 其余时间使用格林威治标准时间(GMT),与世界标准时间相同。 如果您位于世界其他地方,对您来说可能会更简单。

To find the right time zone, I entered:

为了找到正确的时区,我输入:

ls /usr/share/zoneinfo/

I saw GB and knew that was the right one. The system will automatically adjust to BST/GMT when necessary. So to set this as the system’s time zone, I entered:

我看到GB,知道那是正确的。 必要时,系统将自动调整为BST / GMT。 因此,要将其设置为系统的时区,我输入:

ln -s /usr/share/zoneinfo/GB /etc/localtime

8.配置密码和用户帐户 (8. Configure passwords and user account)

The system logged me in as root. To enter the root password for later logins, I typed:

系统以root用户身份登录。 要输入root密码以供以后登录,请输入:

passwd

It then prompted me to type my password and to confirm it.

然后,它提示我输入密码并进行确认。

Then it prompted me to create my user account:

然后它提示我创建我的用户帐户:

useradd jonmkdir /home/jonchown -R jon:jon /home/jon

Then I typed:

然后我输入:

passwd jon

I typed my password for my account as I did with root.

我用root用户输入密码。

My account was created, but I couldn’t do very much. I had no permissions. I had to create the “sudo” group and add my user to it.

我的帐户已创建,但是不能做很多。 我没有权限。 我必须创建“ sudo”组并将我的用户添加到其中。

groupadd sudousermod -aG sudo jon

To ensure the sudo-ers group had the right permissions:

为确保sudo-ers组具有正确的权限:

vi /etc/sudoers

Then I uncommented this line and saved the file:

然后我取消注释此行并保存文件:

# %sudo        ALL=(ALL)       ALL

Now I was able to use the sudo (pronouned “soo-doo,” short for “super user do”) command as my user, so I could install new packages and access restricted parts of the filesystem.

现在,我可以使用sudo (代名词为“ soo-doo”,是“超级用户”的缩写)命令,因此我可以安装新软件包并访问文件系统的受限部分。

9.配置网络 (9. Configure the network)

Now I needed to set the laptop’s hostname in two files: /etc/hostname and /etc/hosts. So I ran the next command and typed laptop:

现在,我需要在两个文件中设置便携式计算机的主机名: /etc/hostname/etc/hosts 。 所以我运行了下一个命令并输入了laptop

vi /etc/hostname

Then I entered the host’s file:

然后我输入了主机的文件:

vi /etc/hosts

At the bottom I typed the following line:

在底部,我输入以下行:

127.0.0.1 laptop

This told my system to route all requests for the hostname laptop to itself.

这告诉我的系统将对主机名便携式计算机的所有请求路由到其自身。

The network still didn’t work as planned, so I needed to activate it. I did this by typing:

网络仍然无法按计划工作,因此我需要激活它。 我通过键入以下内容来完成此操作:

systemctl enable dhcpcd

10.将GRUB引导加载程序安装到硬盘驱动器上 (10. Install GRUB bootloader onto the hard drive)

We’re almost done! Now I needed to install GRUB loader onto the new Arch Linux system, so that it could boot from the hard drive.

我们快完成了! 现在,我需要将GRUB loader安装到新的Arch Linux系统上,以便可以从硬盘启动。

To do that, I ran these commands:

为此,我运行了以下命令:

pacman -S grub os-probergrub-install /dev/sdagrub-mkconfig -o /boot/grub/grub.cfg

If the first pacman command doesn’t work, try this command to synchronize the system’s core database:

如果第一个pacman命令不起作用,请尝试使用以下命令来同步系统的核心数据库:

pacman -Ssy

I then exited from the hard drive’s system and back into the USB:

然后,我退出了硬盘驱动器的系统,然后回到USB:

exit

And then I unmounted the hard drive’s filesystem from the USB:

然后从USB卸载硬盘驱动器的文件系统:

umount /mnt

And that’s it!

就是这样!

The hard drive had a fresh Arch Linux install ready to use. So I rebooted the laptop and unplugged the USB stick.

硬盘驱动器上有一个全新的Arch Linux安装可供使用。 因此,我重新启动了笔记本电脑并拔下了USB记忆棒。

This then booted successfully into the terminal, but this time it was on the hard drive’s new Arch system, not on the USB stick.

然后,它成功引导到终端,但是这次是在硬盘驱动器的新Arch系统上,而不是USB记忆棒上。

11.安装Gnome桌面环境 (11. Install the Gnome desktop environment)

We have the new operating system, but it was still 100% terminal. I want a desktop environment to interact with my laptop, so I can browse web pages, read documents, and use modern apps.

我们拥有新的操作系统,但仍然是100%的终端。 我希望台式机环境可以与笔记本电脑进行交互,因此我可以浏览网页,阅读文档并使用现代应用程序。

There are many desktop environments for Linux. I chose Gnome because I like it, but if I wanted to, Linux allows the installation of more than one desktop environment.

Linux有许多桌面环境。 我之所以选择Gnome是因为我喜欢它,但是如果愿意的话,Linux允许安装多个桌面环境。

Luckily, it only takes one command to install the Gnome desktop ennvironment:

幸运的是,只需一个命令即可安装Gnome桌面环境:

pacman -S gnome

It prompted me a few times to check which versions of extra packages I want. I just clicked ENTER to select the defaults.

它多次提示我检查我想要哪个版本的额外软件包。 我只是单击ENTER选择默认值。

So the Gnome desktop environment is installed, but the system doesn’t know to load it at the boot. So I typed this to ensure it did:

因此已经安装了Gnome桌面环境,但是系统不知道在引导时加载它。 因此,我输入了此内容以确保它可以:

systemctl enable gdm.service

This sets up the symlink, and we’re ready to reboot the laptop into Gnome!

这样就设置了符号链接,我们准备将笔记本电脑重新启动到Gnome中!

reboot

Then when the laptop booted, it loaded Gnome, and I was able to log in with my new user account.

然后,当笔记本电脑启动时,它加载了Gnome,并且我能够使用新的用户帐户登录。

The system was now ready for me to use. It was far from complete though, because I wanted to install some of my favourite programs:

现在该系统可供我使用。 但是,这还远未完成,因为我想安装一些我喜欢的程序:

  • Fish shell, it makes the terminal much faster and easier to use

    鱼壳 ,使终端更快,更易于使用

  • htop, for system activity monitoring

    htop,用于系统活动监视
  • Git, for installing packages via the AUR and for work

    Git ,用于通过AUR安装软件包和工作

  • Google Chrome, it’s my favourite browser

    谷歌浏览器 ,这是我最喜欢的浏览器

  • Spotify, so I can listen to my favourite tunes!

    Spotify ,所以我可以听我喜欢的音乐!

  • PhpStorm, so I can work

    PhpStorm ,所以我可以工作

  • DataGrip, so I can access my databases

    DataGrip ,因此我可以访问我的数据库

With Linux, and especially Arch, we can’t just download an installer or a .dmg file like we can on Windows or macOS. We need to use both of Arch’s installer programs to install them. So let’s learn how to do that!

使用Linux,尤其是Arch,我们不能像在Windows或macOS上那样仅下载安装程序或.dmg文件。 我们需要使用Arch的两个安装程序来安装它们。 因此,让我们学习如何做到这一点!

如何使用pacman和AUR在Arch Linux上安装程序 (How to install programs on Arch Linux using pacman and the AUR)

Installing programs on Arch Linux might seem tricky at first. It was tricky for me the first time too, even though I had experience with Ubuntu Linux.

首先,在Arch Linux上安装程序似乎很棘手。 即使我有使用Ubuntu Linux的经验,这也是我第一次感到棘手。

Arch uses pacman, short for package manager, and the Arch User Repository (AUR) to install programs.

Arch使用pacman(包管理器的缩写)和Arch用户系统信息库(AUR)来安装程序。

Installing packages via pacman is super easy. To install the fish shell, htop, and Git, I just used:

通过pacman安装软件包非常容易。 要安装鱼壳,htop和Git,我只使用了:

sudo pacman -S fish htop git

Installing via the AUR is trickier, especially if you’re newer to Unix-like systems.

通过AUR进行安装比较麻烦,特别是如果您刚接触Unix类系统。

We’ll install the Google Chrome browser and Spotify to show you how to do this.

我们将安装Google Chrome浏览器和Spotify,向您展示如何执行此操作。

First, make sure that build essentials are installed:

首先,确保已安装构建要点:

sudo pacman -S file base-devel abs

Go into your user’s downloads folder:

进入用户的下载文件夹:

cd ~/Downloads

Go here and copy the Git Clone URL.

转到此处并复制Git克隆URL。

Then run the following command:

然后运行以下命令:

git clone [the Git Clone URL]

Then entercd into the google-chrome directory that it just created, and run the following command:

然后将cd输入到刚刚创建的google-chrome目录中,然后运行以下命令:

makepkg -Acs

This may take a while, depending on your system.

这可能需要一段时间,具体取决于您的系统。

Time for another cup of tea!

是时候再喝杯茶了!

Once that’s done, install the package. The makepkg command should create a file with the file type pkg.tar.xz. Install this package by using the -U option with pacman.

完成后,安装软件包。 makepkg命令应创建一个文件类型为pkg.tar.xz的文件。 通过在pacman中使用-U选项来安装此软件包。

sudo pacman -U x.pkg.tar.xz

Replace x.pkg.tar.xz with the name of the actual file. It will be a long, scary filename. Just copy and paste it into the command above.

x.pkg.tar.xz替换为实际文件的名称。 这将是一个很长的可怕文件名。 只需将其复制并粘贴到上面的命令中即可。

That’s it!

而已!

Now in Gnome, if you hit the super key (Windows key on a Windows machine), type Chrome and the Chrome app icon should appear on the screen. Super easy!

现在在Gnome中,如果您按下super键(Windows计算机上的Windows键),请输入Chrome ,然后Chrome应用图标将出现在屏幕上。 超级容易!

We can use the same commands for every other AUR package we want to install. We can certainly do the same for Spotify by using the URL here.

我们可以对要安装的所有其他AUR软件包使用相同的命令。 当然,我们可以使用此处的URL对Spotify进行相同的操作。

Remember, these are the steps to install programs from the AUR:

请记住,以下是从AUR安装程序的步骤:

  • Find the package’s Git clone URL here.

    在此处找到软件包的Git克隆URL 。

  • git clone [the URL]

    git clone [the URL]

  • cd [package name]

    cd [package name]

  • makepkg -Acs

    makepkg -Acs

  • sudo pacman -U x.pkg.tar.xz

    sudo pacman -U x.pkg.tar.xz

Yaourt (Yaourt)

An easier way to install AUR packages is using Yaourt. It allows you to automatically install from the AUR with one line, much like pacman.

使用Yaourt是安装AUR软件包的更简单方法。 它允许您使用一根线从AUR自动安装,就像pacman一样。

Open up /etc/pacman.conf and add the following lines of code to the bottom:

打开/etc/pacman.conf并将以下代码行添加到底部:

[archlinuxfr]SigLevel = NeverServer = http://repo.archlinux.fr/$arch

Then, in the terminal run this:

然后,在终端中运行以下命令:

sudo pacman -Sy yaourt

Now you can install any package using Yaourt. The usage is similar to pacman:

现在,您可以使用Yaourt安装任何软件包。 用法类似于pacman:

yaourt <operation> [options] [packages]yaourt <search pattern|package file>
yaourt -Syu # Updates the Arch systemyaourt -S <package> # Install a packageyaourt -U <package> # Upgrade a packageyaourt -R <package> # Remove a packageyaourt -P <directory> # Install from a PKGBUILD in the directoryyaourt --stats # Show stats on all your packages

I hope I have shown that it’s easier than it looks to use the AUR. It’s super easy to install with pacman too.

我希望我已经证明使用AUR比看起来容易。 pacman也非常容易安装。

I thought it was important to share Arch’s core skills, because with Arch, very few programs are pre-installed. So you’ll need to use these core skills a lot if you want to install the programs you need.

我认为分享Arch的核心技能很重要,因为使用Arch时,几乎没有预装任何程序。 因此,如果要安装所需的程序,则需要大量使用这些核心技能。

That is what I like about Arch Linux. You can create the computer you want, instead of just being given a bloated system that has more than you could possibly want or use.

那就是我喜欢Arch Linux的原因。 您可以创建所需的计算机,而不仅仅是获得一个a肿的系统,该系统拥有的容量超出了您可能想要或使用的数量。

That is also why Arch Linux is perfect for older laptops and PCs. It is so lightweight that it runs below 5% CPU with multiple programs on at the same time. Here’s a screenshot of my laptop’s desktop with htop:

这也是为什么Arch Linux非常适合较旧的笔记本电脑和PC的原因。 它非常轻巧,可以同时在多个程序下运行低于5%的CPU。 这是带有htop的笔记本电脑台式机的屏幕截图:

Yes, I love 90s music. Sue me! It was one of the best decades for music!

是的,我喜欢90年代的音乐。 告我! 那是音乐最好的十年之一!

I chose the Gnome desktop environment as well, which many experienced readers will notice is quite heavy as far as desktop environments go.

我还选择了Gnome桌面环境,就桌面环境而言,许多经验丰富的读者都会注意到,它非常繁琐。

That’s true. I took a gamble by using it over a lighter DE like XFCE4.

确实如此。 我在XFCE4之类的较轻的DE上使用它来赌博。

But I’m used to the Ubuntu Unity desktop environment, which is similar to Gnome. I like that it is so user-friendly. It does come with a lot of packages that XFCE leaves out.

但是我已经习惯了与Gnome相似的Ubuntu Unity桌面环境。 我喜欢它非常用户友好。 它确实带有XFCE遗漏的许多软件包。

And as you can see from the screenshot above, it didn’t take a toll on my 2009 laptop.

从上面的屏幕截图中可以看到,这对我的2009年笔记本电脑并没有造成什么损失。

I’d call this project a success.

我将这个项目称为成功。

Those are all the steps I used to install Arch Linux on my laptop. I hope it helps if you’re thinking of installing a new OS on your old laptop or old PC.

这些就是我用来在笔记本电脑上安装Arch Linux的所有步骤。 如果您想在旧笔记本电脑或旧PC上安装新操作系统,希望对您有所帮助。

现在我有一个问题要问你。 (Now I have one question for you.)

What do you think of this post? I’d like to hear your thoughts.

你怎么看这个帖子? 我想听听你的想法。

Did you try to do this install? Awesome. I’d love to hear about your experience.

您是否尝试执行此安装? 太棒了 我希望知道您的经历。

Hit the comment button below, and write your thoughts so I can read them.

点击下面的评论按钮,写下您的想法,以便我阅读。

I have another quick question for you, since you’re probably a developer if you’re reading this.

我还有一个快速的问题要问,因为如果您正在阅读本文,那么您可能是一名开发人员。

Are you making the most common mistakes that most developers make in SQL queries? Want my 2-step algorithm on the perfect index?

您是否正在犯大多数开发人员在SQL查询中犯的最常见错误? 想要我的两步算法在完美索引上吗?

Download my free report, MySQL Worst Practices.

下载我的免费报告MySQL最差实践 。

翻译自: https://www.freecodecamp.org/news/how-installing-arch-linux-brought-my-old-laptop-back-to-life-1c1c76dd688e/

arch linux安装


http://www.ppmy.cn/news/160047.html

相关文章

如何采购一台计算机,如何配置/购买一台心爱的电脑/笔记本?让普通人也成为装机大师...

2000年以后感觉中国进步最大的就是电脑越来越便宜&#xff0c;以前的万元大件&#xff0c;到现在几千就能配出来一台。但是也出来了新的问题&#xff0c;普通人如何去搭配自己想要的电脑&#xff1f;如何做到不浪费钱&#xff0c;又够用&#xff1f; 土豪请忽略下面的内容&…

Wikibon:英伟达如何通过人工智能抢夺数据中心市场?

英伟达&#xff08;NVIDIA&#xff09;希望通过使数据中心以1/10的成本运行10倍的速度&#xff0c;从而彻底改变企业计算。英伟达CEO黄仁勋&#xff08;Jensen Huang&#xff09;正在制定一项战略&#xff0c;其愿景是利用英伟达在人工智能架构中的强大地位&#xff0c;以重新构…

“M1芯片”电脑杀手:Windows笔记本电脑目前岌岌可危

全文共2384字&#xff0c;预计学习时长6分钟 图源&#xff1a;Google 苹果的发布会结束时&#xff0c;约翰霍吉曼以特朗普输掉选举以来我们从未见过的挑衅方式携“PC”凯旋&#xff0c;PC到底有何优越之处&#xff1f; 从某种程度上说&#xff0c;约翰是对的&#xff0c;这是…

一个故意不通过图灵测试的人工智能

***********路漫漫其修远&#xff0c;吾将上下而求索************** 转载 一个故意不通过图灵测试的人工智能 人工智能很可能导致人类的永生或者灭绝&#xff0c;而这一切很可能在我们的有生之年发生。 上面这句话不是危言耸听&#xff0c;请耐心的看完本文再发表意见。这篇翻译…

人工智能革命:人类将永生或者灭绝

我们正站在变革的边缘&#xff0c;而这次变革将和人类的出现一般意义重大 – Vernor Vinge 如果你站在这里&#xff0c;你会是什么感觉&#xff1f; 看上去非常刺激吧&#xff1f;但是你要记住&#xff0c;当你真的站在时间的图表中的时候&#xff0c;你是看不到曲线的右边的&…

人人都用 Retina 屏幕的 MacBook Pro 笔记本电脑

自从今年年初 Apple 官网产品降价我立即买了 13 寸的 Retina 屏 MacBook Pro(rMBP)之后, 这款苹果的笔记本电脑就成了我在公司和家里的唯一电脑(就是这一款). 使用苹果的笔记本电脑真是一种非常自然舒适的体验! 以我使用苹果笔记本的经验, 我认为人人都应该使用带 Retina 屏的 …

7 款最佳动画笔记本电脑(适用于所有 VFX 软件)

最好的动画笔记本电脑应该可以让您以流畅的帧速率浏览任何场景&#xff0c;并且还可以将 3d 模型渲染时间缩短一半。 动画软件 3D 动画&#xff1a;视觉效果软件 (VFX) 或 3D 动画软件&#xff0c;如 Maya、Blender 和 3DS Max&#xff0c;以及 3D 游戏开发软件。 中央处理器…

现如今,我们应该如何去定义人工智能

#现如今,我们应该如何去定义人工智能 文章目录 今天的能力和局限走向一般智能(通用智能)训练还是不训练智能的意义人类的助手还是主宰&#xff1f;为什么人们对人工智能的兴趣激增构建知识数据库产生的结果道德与期货永远在未来 人工智能的概念随着影响力正在不断的扩大,似乎身…