Sign in
Log inSign up
Make your Custom Linux distribution

Make your Custom Linux distribution

Mehdi YAHIA CHERIF's photo
Mehdi YAHIA CHERIF
·Feb 14, 2022·

5 min read

Instead of having to wait til someone creates the perfect Linux distro for you, maybe you want to customize your own!

Generally, for this, people may take KDE and start tweaking it, like I was doing, and I enjoyed it a lot, but I wasn't completely satisfied. I wanted something more unique, something where I understand how it is working (at least most of what's running) and then I decided to make my own distro, starting from the Ubuntu Server that comes with no desktop environment, just the TTY

TTY

First, we have to complete the installation of the basic ubuntu server

ubuntu server installer

this will take about 10 to 12 minutes

this is a video I found on youtube if someone is interested

Installing essential tools

most of the commands now are typed in the tty

To draw anything on the screen, you need a display server. the most common one is Xorg or X server

to install it you can just to enter this command:

sudo apt install xorg

for ubuntu maybe you need to edd the --no-install-recommends flag else, ubuntu will automatically install gnome with it

for this we want also to have some additional packages that we need later

sudo apt install xorg alsa build-essential libx11-dev libxinerama-dev libxft-dev git wget --no-install-recommends

Instead of using a regular desktop env, I decided to try a window manager, so I used DWM which stands for dynamic window manager.

created by a team called "suckless" that aims to create Linux tools that are minimal and fully functional (and they are doing it in my opinion)

Installing the window manager,the terminal & the menu

DWM this is a link to their website if you want more informations about DWM to install it we can simpely run

sudo apt install dwm

in my case, I wanted to modify it later so, we have to clone it's repository :

git clone https:git.suckless.org/st
cd dmenu
sudo make clean install

after choosing a window manager, I started looking for a menu system and a terminal emulator, I ended up using tools created by the same team

dmenu

git clone https:git.suckless.org/dmenu
cd dmenu
sudo make clean install

and stterm

git clone https:git.suckless.org/st
cd dmenu
sudo make clean install

Now we have almost all the programs to start seeing something on our screen but !

now we need a file to tell our computer to start Xorg every time we log in

this config file (also named a dotfile) is under /home/your-username/.bash_profile

Xorg does not do anything without configuration file /home/your-username/.xinitrc and this file basically tells it what to start aafter we started it with the .bash_profile

xinitrc.png

for the moment, we need just the last line : exec dwm to start our window manager

now, when you reboot your pc, and enter your user & password in the tty, this is what you log into :

basedwm.PNG

if you want to bring the stterm, you have to press Shift + Alt + Enter

dwmbash.PNG and for our Dmenu Alt+p

Using DWM blocks

to make my life easier customising the top panel, I used also dwmblocks. dwmblocks

git clone https:git.suckless.org/dwmblocks
cd dmenu
sudo make clean install

all those tools can be configured (if you know some coding with C) by modifying the config.h for every folder

dwm0.png dwm1.png

We have to use scripts to get te value that we want

blockscripts.png

here is the script to get the date

date '+%B %d %I:%M%p'

the battery level (for laptops)

upower -i (upower -e | grep BAT) | grep --color=never -E "state|to\ full|to\ empty|percentage" | awk 'END{print $2}'

and the ram usage

free -h | awk '/^Mem/ { print $3 / $2} '| sed s/i//g

to get the icons, I used font awesome

sudo apt install fonts-font-awesome

to configure my background I used feh

sudo apt install feh

simple usage

feh --bg-scale <your image.png>

Each time you run this, you update a file /home/username/.fehbg and you need to call it when you start your session

recheck my .xinitrc script

At this point everything is up and running

I needed just a text editor : vim to configure it, you need to create a .vimrc file in the user directory (maybe I will need to create a separate blog about it) vim.png

a web browser : falkon ( or firefox)

and a file manager : pcmanfm (or thuar)

to spice my desktop a littlebit, I added a compsitor that lets me add transparency to my st terminal emulator for this I used compton

this is the final result

desktop1.png

desktop2.png

desktop3.png

desktop4.png

the beauty of this is that all this is working with only 200-ish mb of ram and all of the rest is for you to run your programs

htop2.png

if you want my own build of the dwm you can download all the tools from my github

git clone https:github.com/SAVE-POlNT/fdwm

and for my config (dot files)

git clone https:github.com/SAVE-POlNT/newdistroscripts

Conslusion

I did not do this just for getting a minimalist and good looking distro, i did it to lear more about Linux

and i ended up learning a lot especially about how to connect to wifi & ethernet without any packages or gui tool

it is a little bit harder than what it sould be imo, bit its good to know (take a look at wpa_supplicant and wpa_passphrase)

I ended up using nmcli and nmtui for connecting to the wifi ( comes in the network-manager package)

nmcli.png

nmtui1.png

and learned more about what packages manage the sound, basically you need alsa and pulseaudio in your system

alsamixer commad :

alsa.png

But still, all the efforts of the biggest desktop environment are considerable and worth trying and I will list them:

  • KDE
  • XFCE
  • Gnome
  • LXQT
  • and other smaller ones

Contact me

Linked-in : linkedin.com/in/yahia-cherif-mehdi-43199821a

E-mail :

Github : github.com/SAVE-POlNT

or check our Youtube channel : youtube.com/channel/UC2NSYYh4RUippMzfFjs7QlA