I was recently gifted a CPU and motherboard from a friend, so I am going to resurrect a dedicated Linux box. Because I like to experiment and experience different distributions, I will be setting this one up to keep up-to-date on various *nix OSes. I also prefer to develop on Linux, as well as limiting how many processing cycles I lose to drawing pretty graphics.
So to accomplish this, I am going to start with a base Arch Linux install, install fluxbox and QEMU, then setup several VMs to test and explore the various flavors of UNIX/BSD. I will also setup some dev tools, including Godot, my game engine of choice.
Why Arch Linux?
Arch Linux is a “rolling distribution” which means that there are not really “versions” of Arch. You need to keep your install up to date; at least periodically, like every few weeks. The upshot of this is that you are getting the latest “stable” versions of the software you are using. Also, when you are looking for a LEAN OS, it is hard to beat Arch to have only what you NEED to run the PC. You then add on what you want, including desktop environment, leaving a crud-free system.
The other reason I personally like Arch Linux is the feeling of “building it by hand.” Being a DIY type person, I enjoy building, fixing, and maintaining. While all Linux distros are highly customizable, the DIY nature of Arch means you get to make the choices of how to put together your Linux box. So now that I have explained the whys, let’s get into the hows.
Installing Arch Linux
The “rolling” nature of Arch means that you are not provided with an “installer” as much as you given a bootstrap live environment to build the system with. This hands-on experience gives you the unique opportunity to really understand the workings of the system.
Even though you are responsible for doing most of the tasks that a traditional installer would do, Arch is well-documented; so much so that I have used the Arch Wiki pages to solve issues in other distributions. For the purposes of getting initial system set up, we will be following along with the install guide found at: https://wiki.archlinux.org/index.php/Installation_guide I will explain the choices I made at the various forks.
The first thing we need to decide is how we are going to partition the physical storage device. The options here are GPT (GUID Partition Table) or MBR (Master Boot Record). MBR is the older way of doing things. You are limited to four primary partitions and then you have to use extended partitions to split the disk up more. GPT is the newer method, it supports disks larger than 2TB, virtually unlimited partitions, and has the ability to detect (and attempt to correct) corrupt data.
I choose to go the GPT route. I like the advances that are offered, also I may want to exceed 4 partitions per disk. Also, in technology, it is often best to stay at least at trailing-edge. Leading-edge tech can be unstable and unknown, but trailing-edge has usually had some time and eyeballs on it. This makes it robust and current. Setting up something with tech that is already essentially outdated just seems silly to me.
My motherboard is EFI (Extensible Firmware Interface) so I will be setting up an ESP as directed by: https://wiki.archlinux.org/index.php/EFI_system_partition#GPT_partitioned_disks
I will also setup the rest of my partitions. I strongly recommend using separate partitions for the OS root directory and your /home directory. This has been my standard when setting up a PC for at least 20 years. What you get is the ability to keep your personal data if/when you format the OS data.
Your needs and disk size are going to dictate how you split things up, but there are a few general guidelines. Your /boot or /efi partition should be between 512 MB and 1024, I opted for the later. Your root / directory should be between 50 and 100 GB. Again, I went for the bigger. I usually set up a swap partition that is twice the size of the amount of RAM I have on the system. I give the rest of the drive to my /home directory.
This specific PC actually has two drives. I use the 1 TB split up roughly as described above. I also have a 2 TB drive that I use for my Virtual Machine data, as well as a network share drive.
Now that we have set up our partitions we are ready to mount them in the live environment, and get ready to setup the base system via chroot. Follow the Arch Linux guide from the “Mount” heading.
The next thing we need to decide is which boot loader we want to use. The boot loader is what is used to load the OS from the disk. I am preferential to GRUB (GRand Unified Boot loader). https://wiki.archlinux.org/index.php/GRUB#Installation_2
Once the boot loader is configured, it is time to test it all out and reboot the system. With some luck, you will be greeted by your new Arch install. If something didn’t go as planned, don’t fret; you will now get to troubleshoot it. If the system doesn’t boot, you can either reformat everything and do it again (probably paying a little closer attention to the guide), or you can use the live USB to boot the system and chroot into your new install and attempt to fix the issue. As a quick aside, the first time I setup Arch I had to go through the process about 3 times. Now I can set it up in less than an hour.
But it is all text based at the moment…
Now that we have successfully booted into the new Arch, you will be greeted with a login prompt and your mouse isn’t going to work yet. This is because we have not yet installed the GUI elements. We will do a little bit of maintenance and install the Desktop Environment.
First, we need to set up a non root user. You SHOULD NEVER use the root user for your day to day. This is a security issue as root as complete power to do anything on the system. So the very first thing you should do is add a non-root user and add them to the “sudo”er’s group.
To add a user, use the
#useradd -m masonjoyers (replacing masonjoyers with whatever username you want). Then set the password with #passwd masonjoyers.
Then we need to set up sudo and the “wheel” group. To install the “sudo” package we will use pacman.
#pacman -Sy sudo
The rest of the sudo setup process is described at: https://wiki.archlinux.org/index.php/Sudo#Configuration The explanation is better and more complete than I could offer. You can verify your new user and sudo abilities with the following commands:
masonjoyers$ sudo ls -la
You should be prompted for the password set with passwd, and get a listing of the current directory. Now that we have an unprivileged user, we should log out as root by using “exit” until we are at the login screen again. Log in as your newly created user.
Here comes the GUI
Alright… so now we have a brand new Arch install with an unprivileged user that is a member of the sudoers group, we can now get to installing our minimal GUI. I like fluxbox, which is a current fork of the old blackbox Window Manager. This is a lightweight, minimal frills GUI that gets the job done and is easy to use.
We will need to install xorg, fluxbox and xterm. xorg provides the X11 Window System, and xterm is a terminal app for X11. I also am going to install mousepad (a super lightweight graphical text editor) on my system. To install these packages issue the following command:
$sudo pacman -Sy xorg xorg-xinit fluxbox xterm mousepad
While installing these, pacman is going to ask what you want install for the xorg and xorg-apps groups, with the default being all. I usually let it install all of the packages in these groups. You are also given the option to select between libglvnd and nvidia-340xx-utils for the libGL , I selected the nvidia option, as this sets us up to use the Nvidia GPU I have installed.
The last thing needed to complete the base install is to configure the .xinitrc file in your home directory. This can be accomplished by using nano to create and edit the file.
It should read:
exec fluxbox. Now we can launch
$startx and start the Xorg server. Now we have a thrills free (and CPU cheap) GUI that is easy to use.
So there we have it, a minimal install of Arch Linux with GUI. As you can see from the
df command in the terminal, total OS install is only 2.2 Gigs. There is still a lot of customization that can be done, but this will be enough to get you trouble. Over the next few weeks I will also be covering how to set up a minimum GUI on other distros of Linux, like CentOS (RedHat) and Debian. I will also be covering installing Cura (slicer for 3D printing), development tools, and KVM with libvirt (Virtual Machines). Let me know what you think, and what you would like to see covered. Thanks for reading along, and have a great day!