DEV Community

Cover image for Build your own system with ArchLinux
Samuel-Zacharie FAURE
Samuel-Zacharie FAURE

Posted on • Updated on

Build your own system with ArchLinux

Original of this post on my blog.

I wrote a comment on dev.to recently that gathered quite some attention; It was about my custom Arch system. I felt like it would be useful to give a 101 how-to guide so people that are interested can enjoy the process of building their own system as well.

Why building your own system ?

Knowledge

Building your own system forces you to know everything about it, therefore becoming a way better linux user (or even computer user). The knowledge I got this way was (and still is) extremely useful in my daily job.

Productivity

You will design the system according to your needs. Instead of adapting your workflow to the software, you will design the software to adapt to your workflow.

And armed with your new knowledge of Linux, you will be able to better deal with any bug or issue that inevitably arise when one use an operating system.

The joy of creation

It's rare to find such a great opportunity to build something that can be both beautiful, and useful. This will be a great opportunity to train your designing skills, both for the aesthetic and the UX/UI.

And the best part: you get to use this system everyday, all day, while you work or chill on your computer !

Why Arch Linux ?

Arch Linux is amazing. A lot of linux distributions have a goal to be more accessible to the mainstream user, and they succeed more or less at this.

Arch linux goes in the opposite direction. The philosophy of Arch can be summed up as such :

  • Minimalism: Nothing is assumed of the user's needs.
  • Not User-Friendly, but User-Centric: Things should not be made easy for beginners, things should be simple.
  • Pragmatism: you don't want a system designed around an ideology, you want a system that works.

What does it look like ?

When you boot Arch Linux for the first time, you'll be greeted by this :
Alt Text

A simple command line. If you want more, you'll have to build it yourself.

What CAN it look like ?

There's the good part: since you start from nothing, nothing is stopping you from doing whatever you want with your computer. The only limit is your imagination. Here's the same system some time after:

Alt Text

Prettier, right ?

And I'm by no mean talented. If you want to see some true masterpieces, go check out the unixporn subreddit (Safe for work !)

What do I need to start ?

The only thing you need for this project is TIME. The worst thing that can happen (as far as I know) is that you end up stuck with a non-completely usable computer, which can be a problem if you need this computer for work. I personally spent about 2 weeks on my system before it was 100% functional (this amount of time will depend on your current linux skill).

If this is an impossibility, consider starting this project on a computer that you don't need for a while, on a dual boot, or on a virtual machine.

Your time will mostly be spent reading the Arch wiki, one of the most acclaimed resource on the whole web. It will tell you more or less everything you need to know.

But I don't want to dive right in, can I take some preparatory steps first ?

Sure ! Some things that can help you learn before :

  • Switch to a user-friendly linux distribution. Some good choices are Linux Mint, or Manjaro (Manjaro is actually based on Arch !).
  • Read books ! I would advise you to read "How Linux Works" (Brian Ward), an extremely interesting and detailed book about unix and linux. This will help you tremendously !

What are the steps for building my own system ?

I won't go into the details, I trust you to RTFM; however it will be useful to explain the general steps:

1/ Install Arch Linux on your computer, be greeted by the Command Line©
2/ Decide on which packages you want; Install them; Configure them.
3/ Configure the Arch Linux system itself, and voilà.

It's as "simple" as that. It all boils down to picking what you want for your system, and learning how to configure everything correctly.

For the configuration, you will obviously spend some time reading the documentation for Arch and for your packages (always check if your package have a page on the amazing Arch wiki).

For the choice of packages, I can give you some pointers (pun intended).

Alt Text

Some packages that might interest you

This list is just some of my personal's favorites. If you want to find other cool ideas, don't hesitate to check out the unixporn subreddit.

Which shell to use ?

The usual choices are Bash or Zsh. My personal choice is Zsh with oh-my-zsh installed, for an amazing shell experience.

A graphical server

The command line is nice and all, but it can't display Netflix ! So you will probably want more.
Most applications require that you install a graphical server.

I would advise to check out the X.Org window system. A possible alternative is Wayland, but it seems a bit too new and unpolished for a beginner user.

How to launch the graphical server ?

The Arch Wiki will tell you more about this, but basically you can configure your shell profile (.bash_profile or .zprofile) to launch the X server at startup.

Then you can configure xinit (in the .xinitrc file) to launch any programs you want at the start of the X graphical server. I use this for example to configure my laptop's touchpad.

Desktop environment or Tile window manager ?

Something great with building your own system: you get to ask yourself questions that few people do.

If you ever used a computer, you probably used a Desktop environment, where you click on a folder icon to open the folder window, and such.
A Tile window manager is a whole other paradigm, where each program simply opens a new tile on your screen. Most of your navigation on the computer's file system will be made through the command line.

This made much more sense to me and seemed way more practical. It will require some time to adapt for a beginner, but it's worth it. I'd recommend i3 (or even i3-gaps, that I find more aesthetically pleasing).

Alt Text

Some great desktop environments are available if you want a more classic user experience (KDE, GNOME...).

A compositor

Not needed, but nice-to-have.

A compositor is an extra layer between the graphical server and your programs. Instead of having your programs directly draw unto the screen, they draw into memory on the compositor, which will then draw unto the screen. This allows for some better user experience and better effects (such as windows transparency).

I personally use picom (ex-compton).

The right terminal

This is especially important if you're spending a lot of time on the shell, either for work, or because you find it more convenient (and in that case you probably went with a Tile window manager !)

Some great choices exist here, to name a few : kiTTY, Terminator, URxvt, st...

In the end I went with Termite for the great VIM-like bindings that allows me to navigate easily with the keyboard.

Amazing packages to explore

  • You will probably want a wallpaper ! Check out "feh".
  • "Rofi" is an amazing program launcher, highly customisable.
  • "Dunst" will allow you to build your desktop notifications.

For more packages, I'll advise you to check out the amazing pieces at unixporn subreddit

Alt Text

How to save my precious work ?

You will spend quite some time configuring your system and your packages. This can be hard work and it would be a shame to lose any of it.

The easiest way to save your work would be to copy your configuration files (usually nicknamed dotfiles) along with any configuration of interest on a git repository. However, that's not a very sustainable approach, since you'll probably be tweaking your system there and there for months (and even years: workflow improvement is a continuous process !). Copying your files manually every time can be very tedious !

You will probably need a more sustainable approach. You can, for example, symlink your dotfiles (and any other file of interest) from your git repository towards your system. That way, any change you make to the configuration file will be saved on your repository. Maybe you can use a CRON job to regularly push that repository on github.

I would advise to go even further and just learn to use Ansible. This is a wonderful IT automation tool, and very simple to use. You just list tasks in playbooks written in YAML and execute them. If you're working in IT, that's also a very marketable skill.

If your computer breaks or gets stolen tomorrow, and you have a well-written ansible playbook, you can reinstall your own system with a single command.

Isn't it a very satisfying thought ?

In conclusion

Building your own system takes time, dedication, and a lot of reading... But this experience is incredibly enriching !
And as always, if you're stuck or you still don't know where to start, you can ask me right there or via mail. Me and countless enthusiasts will gladly give you a hand.

Happy building !

Edit in 2021: Termite is now deprecated. I would advise Alacritty as an amazing terminal emulator. Also migrated to Zimfv from Oh-my-zsh.

Edit in 2023: Wayland/sway are amazing. Ditch Xorg/i3.

Top comments (30)

Collapse
 
tateronaut profile image
tate shepherd

This an excellent article. I'm a very novice linux user, and always considered ArchLinux way too time consuming and sort of like "whats the point?"... But you make it look fun and appealing! I think your synth-wave looking UI is beautiful!

Collapse
 
gwutama profile image
Galuh Utama

Real men use Gentoo and build it from stage 1.

Collapse
 
freezmeinster profile image
Bramandityo Prabowo

Real man use three pedals and Slackware :D

Collapse
 
danielkun profile image
Daniel Albuschat

You mean Linux from scratch?

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

My social life took a big enough toll from Arch :D

Collapse
 
johnfajardo profile image
John Fajardo • Edited

Shameless plug: I wrote a similar series about Arch. Part 1 is an intro, part 2 is a very opinionated walk through the installation process and part 3 is common post-install stuff, check it out if you want to try Arch but are intimidated by the wiki!

Collapse
 
navarroaxel profile image
Axel Navarro

I can't even think about go back to Ubuntu, I love the flexibility of Arch and the decision that what I want to install and what not.
I use KDE Plasma, is light and I enjoy my UX. I don't like Gnome.
It's so easy to create, and install your own packages using pacman (or aurman, yay, etc.) like your own widgets/plasmoids.
Or even, I fixed an annoying bug in the built-in Konsole package, including a fix in my package build process using the patch command, building it from source, and is so easy. Because I based all of this in the PKGBUILD of the offical repositories and AUR.
Also I can switch between the latest commit in Konsole and the latest stable version with a low effort.

Collapse
 
pgronkievitz profile image
Patryk Gronkiewicz • Edited

Why Arch Linux ?

AUR, EOT

Collapse
 
davidtcharris profile image
David T. Harris

I've been using Arch for years and am not familiar with EOT. The only thing I could find when searching for this was
aur.archlinux.org/packages/eot-uti...
and as something you use in a heredoc instead of EOF ( end of file ) which I also don't understand. End of ___ ?

What is EOT?

Collapse
 
pgronkievitz profile image
Patryk Gronkiewicz

End of thread

Thread Thread
 
davidtcharris profile image
David T. Harris

Ah gotcha. Thanks!

Collapse
 
psiho profile image
Mirko Vukušić

Ah, so long on my list to do this. But time is a luxury, and I'm also scared to fall into that rabbithole of endless tweaking (mental issue as someone said, not Arch problem). Mint serves me so well for years, it's hard to leave.

Collapse
 
psiho profile image
Mirko Vukušić

Update... Thank you for "wasting" last two days for me :) Accidentally I deleted my Mint root partition so it seemed a perfect timing to install Arch. Actually installation was a breeze. Configuring it (still) as much fun as I thought it will be. Installed both Cinnamon and i3, side by side, to test tiling WMs (really like i3 so far).

Only problem I see right now are AURs. Some stuff I'm used to is not available for pacman. And manual AUR installs for many is a nightmare with huge dependency trees. So far I'm avoiding those, but am afraid if I will be forced to do it in the future. AUR helpers seem great but not sure that's the point of Arch. I need to carefully check what I'm installing anyway, then upgrade process is different. Not sure. Still keeping Mint partition for emmergencies :)

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

"Yay" is a great package manager !

Collapse
 
tomfern profile image
Tomas Fernandez

I love Arch, I went the full custom DE route some years ago, I loved i3 to death. But in the end, it just took too much time to maintain and switched to KDE, and now everything works out of the box.

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

I don't understand what there is to maintain, actually ? Once my configuration was done I never needed to touch it again ?

Collapse
 
zejnilovic profile image
Saša Zejnilović

I think I can answer from my experience. It isn't that there is something to maintain, it is a mindset (mental illness) that you are never done, you always have to tinker, etc.

I had this problem with my Linux installations. Always thinking about ways to upgrade /update something that has no need for them.

Collapse
 
tomfern profile image
Tomas Fernandez

Software is never still. Things change. One day, PulseAudio stops working. Another, the automount/udev script doesn't pick up a flashdrive any longer. There's always some little thing that needs attention, and attention is a scarse resource this these days.

Thread Thread
 
samuelfaure profile image
Samuel-Zacharie FAURE

This is true, but I noticed those issues :

1/ can happen on just any system;
2/ have been dramatically decreasing the longer I use Arch

I remember a lot of issues like this happening in my first 6 months of Arch, but today I'm unable to remember when or what was my last problem !

Collapse
 
scardracs profile image
ScardracS

Actually, if someone wants to try arch so bad but feared about commands line, he can zen installer. It's a graphical installer for arch Linux

Collapse
 
romaixn profile image
Romain

Great article, I love so much Arch !
Do you have any example of configuration for Ansible ? I'm very curious of this tech !

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE • Edited

Sure ! Here's an example from my actual config. What it does is simply :

  • deletes a list of configuration files on my system (if they exist) with a loop (the list itself is on another file)
  • Creates the config folders I'll need to copy my configuration
  • Symlink the configuration files from my playbook to the system (so we replace the files we deleted before with the proper version, that is the version saved on the playbook)
---
- name: Delete existing Dotfiles
  file:
    path: '~/{{ item }}'
    state: absent
  loop: "{{ Dotfiles }}"

- name: Create .config folder
  file:
    path: '~/.config'
    state: directory

- name: Create .config/Code - OSS folder
  file:
    path: '~/.config/Code - OSS'
    state: directory

- name: Link Dotfiles into home
  file:
    src: "{{ playbook_dir }}/roles/dotfiles/files/{{ item }}"
    dest: '~/.{{ item }}'
    state: link
    force: yes
  loop: "{{ Dotfiles }}"

Note this is all done with the same ansible module, "file". Here's another task somewhere else that uses the module "package", which is used to install my list of packages :

- name: Install packages with pacman
  become_user: root
  package:
    state: present
    name: "{{ item }}"
  loop: "{{ packages }}"
  tags: packages-list
Collapse
 
vinksz profile image
vinksz

A lot of text, but not actually how to build your own.

I recommend this -> linuxfromscratch.org
will learn on the way as well how internals work. Or if it's too much reading and want to take the easy route...

On an existing arch system

Prepare ->

  1. su && pacman -S devtools git make --needed
  2. mkarchroot /tmp/chroot base (Create a chroot with base-packages)
  3. git clone git://projects.archlinux.org/archiso.git
  4. make -C archiso/archiso DESTDIR=/tmp/chroot install
  5. mkarchroot -r bash /tmp/chroot

Customize the ISO & Packages ->

  1. mknod /dev/loop0 b 7 0 (Create a loopback interface)
  2. echo 'Server = ftp.osuosl.org/pub/archlinux/$repo...' >> /etc/pacman.d/mirrorlist
  3. pacman -S devtools libisoburn squashfs-tools (required pkgs)
  4. xorg , firefox , neovim perhaps? the rest is up to you...
  5. Next, we can create our user and change any configuration files that we want. /boot/grub/menu.lst , .bashrc , /etc/rc.conf , /etc/hosts/allow ... etc

Build the iso ->

  1. cp -r /usr/share/archiso/configs/baseline /tmp
  2. cd /tmp/baseline
  3. ./build.sh
  4. exit

Now, you will be out of your chroot... with the built ISO at the file path ->

/tmp/chroot/tmp/baseline/out/

gz , you now have your custom arch iso

Collapse
 
mcsh profile image
Sajjad Heydari

A good post, might I suggest a small modification? It should be desktop environment and tiling window manager.

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

Indeed ! Ill correct ASAP

Collapse
 
johnea profile image
johnea

Hi, I did enjoy the post. I've run arch for about 20 years and have customized it for many embedded projects.

I'm not sure what was in the post prior to "desktop environment" and "tiling window manager", but I would suggest that "desktop environment" and "window manager" are not exactly comparable things.

The desktop environment is much more than a window manager, providing automount and other user services.

The window managers may also be "floating" as well as "tiling". The "floating window manager" is much like what most desktop environments provide, but it's only the window manager, none of that automount, or other stuff.

Personally I've been using fluxbox for many years, and love it.

In keeping with the "build your own" nature of this post, all of the config files are in the home directory in .fluxbox/. So everytime I upgrade, or move to a new machine, by copying my home directory I'm presented with the exact same desktop. No modifications to my workflow!

Thread Thread
 
samuelfaure profile image
Samuel-Zacharie FAURE

Thanks for this interesting addition

Collapse
 
ismail0852 profile image
ismail0852

Hi, actually I'm a newbie. Well I've been a project in school to build a custom arch linux based system but I don't know how to start with it. So could you please recommend me something maybe like a video or text to get on with it

Collapse
 
samuelfaure profile image
Samuel-Zacharie FAURE

This article is supposed to be exactly what you want.

For an easy installer try Anarchy

Collapse
 
lva profile image
José Angel Leyva Portilla

Thanks, I chose to dual boot with a KDE neon as a working fallback, I'm trying to setup my workflow with openbox, I'm not in a hurry and I'm learning stuff, hopefully my distrohopping will end