Cómo la instalación de Arch Linux le devolvió la vida a mi vieja computadora portátil

¿Tiene una computadora vieja que es demasiado lenta para ejecutar Windows? No lo tire ni lo venda. Instale Linux en él.

¿Nunca usaste Linux? Es muy divertido, siempre y cuando estés dispuesto a aprender y jugar.

Tenga en cuenta que si no le gusta jugar, es posible que Linux de escritorio no sea el mejor sistema operativo para usted.

Los sistemas operativos Windows y macOS hacen que los sistemas funcionen más lentamente con el tiempo. Las aplicaciones se vuelven más complejas a medida que se adaptan a las demandas de funciones más fáciles de usar.

Windows 10 ha sido mejor en este frente. El objetivo de Microsoft de tener un sistema operativo universal en computadoras de escritorio, tabletas y dispositivos móviles los ha alentado a atender a máquinas con especificaciones más bajas.

Pero no estoy seguro de si Apple tiene el mismo objetivo. Los nuevos MacBook Pros son más lentos que muchas máquinas que cuestan un tercio del precio. Muchos usuarios se han quejado de que El Capitán y Sierra consumen más recursos después de actualizar los sistemas operativos de su Mac.

Eso no es inherentemente malo. Me encanta el cuidado que se pone en mejorar la usabilidad de mi Mac. Y me encanta lo rápido que funciona mi máquina con Windows 10, y he usado Windows desde que tenía siete años. Me considero un usuario avanzado de Windows.

Cuidado con la fanboyhood. Mantén siempre la mente abierta. Es una tontería ceñirse a cualquiera de estos sistemas operativos. Hay más en la vida que la computadora que usa.

Pero la obsolescencia programada significa que la gente desecha innecesariamente las viejas Mac y Windows. Son demasiado lentos para usar y no se puede instalar software nuevo en ellos.

Arranqué mi MacBook 2008 hace unas semanas y se negó a instalar Chrome. Ni siquiera lo tocaría con un poste de barcaza. ¡No es genial!

Sin embargo, ahora estoy escribiendo con un Acer Aspire 5735 de 2009. Tiene un procesador Core 2 Duo, con dos núcleos a 2.0GHz. Tiene 4 GB de RAM DDR2 y un disco duro de 500 GB. He instalado una batería nueva, pero hasta ahora esa es la única actualización de hardware.

Estoy usando la última versión de Google Chrome. Actualmente, tengo seis pestañas abiertas y aún no he experimentado ninguna desaceleración importante hasta la fecha. También tiene las últimas versiones de PhpStorm y DataGrip.

En el momento en que mi papá me compró esta computadora portátil, era muy popular. Me encantó. Era una máquina de alta especificación y funcionaba muy bien. Acababa de empezar la universidad y esta máquina me ayudó con mis hábitos de estudio. Y en mi tiempo libre, me sirvió bien para navegar y consumir medios. Fue una fantástica máquina de trabajo portátil durante cinco años.

No tiene ningún sentido para mí que acaba de morir. No hice ningún juego exigente con él, solo quería ser productivo en él.

Quiero correo electrónico, quiero navegar, quiero PhpStorm y DataGrip en mi computadora portátil. Con Linux, puedo hacer todas esas cosas con facilidad.

Aún mejor, mi actividad no está siendo monitoreada por una corporación. Mi sistema operativo no escucha a través del micrófono las 24 horas del día, los 7 días de la semana y no almacena datos en un almacén de datos fuera del país.

Con Linux, tengo tanta libertad y privacidad como quiero.

La instalación de Linux en su computadora portátil también es increíblemente fácil. Te mostraré cómo hacer eso en solo un segundo.

Recuerde que Linux impulsa los servidores más grandes, las aplicaciones más populares y los servicios más importantes del mundo.

Pero también funciona con todos los teléfonos inteligentes Android. Si bien los móviles son cada año más potentes, no son tan potentes como las computadoras modernas. Y Android funciona sin problemas en la mayoría de los teléfonos modernos.

Eso es porque Linux es simple. Utiliza menos recursos y tiene una rica comunidad de desarrolladores que están deseosos de ayudarse unos a otros.

Si Linux es lo suficientemente bueno para impulsar los servicios más importantes del mundo, es lo suficientemente bueno para usarlo para navegar por las noticias de Facebook.

Arch Linux

Para mi instalación, elegí Arch Linux. Esta no es una distribución para los débiles de corazón.

El instalador barebones para Arch no está basado en GUI o incluso en texto. Utiliza puramente la línea de comandos.

Aunque eso me gusta. Instalar un sistema operativo de esta manera me ayuda a comprender su funcionamiento interno.

Tengo Ubuntu 16.10 “Yakkety” en mi escritorio, y fue muy fácil de instalar. Descargué la ISO, la quemé en un USB, la conecté a mi PC, arranqué desde el USB y seguí las sencillas instrucciones.

Ubuntu es, con mucho, la introducción más suave a Linux. Se lo recomiendo a personas sin experiencia fuera de Windows o incluso macOS, porque será el más familiar para la gente.

Cuando profundice en Linux, pruebe cosas diferentes y acostúmbrese a la terminal. Entenderás por qué me gusta el instalador de Arch.

No utilicé el instalador Arch "Anywhere" basado en texto. Solo usé la línea de comando.

Y aunque algunos han llamado a Arch con frecuencia un "juego de terror basado en texto", la realidad es que es increíblemente sencillo de instalar. Aprenderá más sobre cómo funcionan realmente los componentes internos más adelante en este artículo.

No obtienes un entorno de escritorio de forma predeterminada. Es puramente línea de comandos. Esto es por diseño. Arch está destinado a ser un sistema Linux básico y sencillo.

Arch es adictivo. Empieza sin nada e instala el software según sea necesario.

Por el contrario, Ubuntu es sustractivo. Empiece con todo lo que pueda necesitar y vaya recortando hasta que tenga un sistema más ligero.

Ninguno de ellos tiene "razón". Cada uno solo se adapta a diferentes personas y casos de uso. El único sistema operativo "correcto" es el que mejor le ayuda a trabajar y jugar.

Una vez más, sin embargo, es increíblemente fácil instalar un entorno de escritorio en Arch. Literalmente, se necesitan dos comandos y un reinicio para instalar un escritorio operativo.

Y como queremos un sistema que podamos usar, definitivamente queremos un entorno de escritorio. En mi instalación, elegí Gnome 3. Me gusta su apariencia. Aunque se sabe que consume muchos recursos, disfruto el desafío. Creo que mi computadora portátil está a la altura.

Empecemos.

Cómo instalé Arch Linux en mi computadora portátil

Ahora explicaré cómo instalé Arch Linux en mi computadora portátil.

Puede seguirlo si lo desea. Solo tenga en cuenta que esto borrará todos los datos del disco duro de su computadora. Solo haga esto si está absolutamente seguro de que desea hacerlo, así que haga una copia de seguridad de sus datos importantes en otra máquina. ¡Definitivamente no borre los datos en una máquina que no es suya!

1. Cree el instalador USB

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

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

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.

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

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.

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

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

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.

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.

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.

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.

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.

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/sda2, the primary swap space with 8GB, or double the 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.

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.

Next, I selected BOOTABLE on that partition.

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.

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

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.

To verify the partitions, type

fdisk -l

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:

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. 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.

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.

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.

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.

genfstab /mnt >> /mnt/etc/fstab

The file can be read to verify:

cat /mnt/etc/fstab

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-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.

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.

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:

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

8. Configure passwords and user account

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

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.

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.

groupadd sudousermod -aG sudo jon

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

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.

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:

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. 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.

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 -Ssy

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

exit

And then I unmounted the hard drive’s filesystem from the 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.

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.

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.

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.

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

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.

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:

systemctl enable gdm.service

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

reboot

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

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
  • Git, for installing packages via the AUR and for work
  • Google Chrome, it’s my favourite browser
  • Spotify, so I can listen to my favourite tunes!
  • PhpStorm, so I can work
  • DataGrip, so I can access my databases

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!

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 uses pacman, short for package manager, and the Arch User Repository (AUR) to install programs.

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

sudo pacman -S fish htop git

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

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

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.

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:

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.

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.

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!

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.

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

  • Find the package’s Git clone URL here.
  • git clone [the URL]
  • cd [package name]
  • makepkg -Acs
  • sudo pacman -U x.pkg.tar.xz

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.

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

[archlinuxfr]SigLevel = NeverServer = //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  [options] [packages]yaourt 
yaourt -Syu # Updates the Arch systemyaourt -S  # Install a packageyaourt -U  # Upgrade a packageyaourt -R  # Remove a packageyaourt -P  # 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.

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.

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.

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:

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

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

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

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.

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

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.

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?

Download my free report, MySQL Worst Practices.