diff options
Diffstat (limited to '_posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md')
| -rw-r--r-- | _posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md | 277 |
1 files changed, 0 insertions, 277 deletions
diff --git a/_posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md b/_posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md deleted file mode 100644 index 4f9bc09..0000000 --- a/_posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md +++ /dev/null | |||
| @@ -1,277 +0,0 @@ | |||
| 1 | --- | ||
| 2 | title: Debian based riced up distribution for Developers and DevOps folks | ||
| 3 | permalink: /debian-based-riced-up-distribution-for-developers-and-devops-folks.html | ||
| 4 | date: 2021-12-03T12:00:00+02:00 | ||
| 5 | layout: post | ||
| 6 | type: post | ||
| 7 | draft: false | ||
| 8 | --- | ||
| 9 | |||
| 10 | ## Introduction | ||
| 11 | |||
| 12 | I have been using [Ubuntu](https://ubuntu.com/) for quite a longtime now. I have | ||
| 13 | used [Debian](https://www.debian.org/) in the past and | ||
| 14 | [Manjaro](https://manjaro.org/). Also had [Arch](https://archlinux.org/) for | ||
| 15 | some time and even ran [Gentoo](https://www.gentoo.org/) way back. | ||
| 16 | |||
| 17 | What I learned from all this is that I prefer running a bit older versions and | ||
| 18 | having them be stable than run bleeding edge rolling release. For that reason, I | ||
| 19 | stuck with Ubuntu for a couple of years now. I am also at a point in my life | ||
| 20 | where I just don't care what is cool or hip anymore. I just want a stable system | ||
| 21 | that doesn't get in my way. | ||
| 22 | |||
| 23 | During all this, I noticed that these distributions were getting very bloated | ||
| 24 | and a lot of software got included that I usually uninstall on fresh | ||
| 25 | installation. Maybe this is my OCD speaking, but why do I have to give fresh | ||
| 26 | installation min 1 GB of ram out of the box just to have a blank screen in front | ||
| 27 | of me? I get it, there are many things included in the distro to make my life | ||
| 28 | easier. I understand. But at this point I have a feeling that modern Linux | ||
| 29 | distributions are becoming similar to [Node.js project with | ||
| 30 | node_modules](https://devhumor.com/content/uploads/images/August2017/node-modules.jpg). | ||
| 31 | Just a crazy number of packages serving very little or no purpose, just | ||
| 32 | supporting other software. | ||
| 33 | |||
| 34 | I felt I needed a fresh start. To start over with something minimal and clean. | ||
| 35 | Something that would put a little more joy into using a computer again. | ||
| 36 | |||
| 37 | For the first version, I wanted to target the following machines I have at home | ||
| 38 | that I want this thing to work on. | ||
| 39 | |||
| 40 | ```yaml | ||
| 41 | # My main stationary work machine | ||
| 42 | Resolution: 3840x1080 (Super Ultrawide Monitor 32:9) | ||
| 43 | CPU: Intel i7-8700 (12) @ 4.600GHz | ||
| 44 | GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590 | ||
| 45 | Memory: 32020MiB | ||
| 46 | ``` | ||
| 47 | |||
| 48 | ```yaml | ||
| 49 | # Thinkpad x220 for testing things and goofing around | ||
| 50 | Resolution: 1366x768 | ||
| 51 | CPU: Intel i5-2520M (4) @ 3.200GHz | ||
| 52 | GPU: Intel 2nd Generation Core Processor Family | ||
| 53 | Memory: 15891MiB | ||
| 54 | ``` | ||
| 55 | |||
| 56 | ## How should I approach this? | ||
| 57 | |||
| 58 | I knew I wanted to use [minimal Debian netinst | ||
| 59 | ](https://www.debian.org/CD/netinst/) for the base to give myself a head | ||
| 60 | start. No reason to go through changing the installer and also testing all that | ||
| 61 | behemoth of a thing. So, some sort of ricing was the only logical option to get | ||
| 62 | this thing of the grounds somewhat quickly. | ||
| 63 | |||
| 64 | > **What is ricing anyway?** | ||
| 65 | > The term “RICE” stands for Race Inspired Cosmetic Enhancement. A group of | ||
| 66 | > people (could be one, idk) decided to see if they could tweak their own | ||
| 67 | > distros like they/others did their cars. This gave rise to a community of | ||
| 68 | > Linux/Unix enthusiasts trying to make their distros look cooler and better | ||
| 69 | > than others... For more information, read this article | ||
| 70 | > [What in the world is ricing!?](https://pesos.github.io/2020/07/14/what-is-ricing.html). | ||
| 71 | |||
| 72 | I didn't want this to just be a set of config files for theming purpose. I | ||
| 73 | wanted this to include a set of pre-installed tools and services that are being | ||
| 74 | used all the time by a modern developer. Theming is just a tiny part of it. | ||
| 75 | Fonts being applied across the distro and things like that. | ||
| 76 | |||
| 77 | First, I choose terminal installer and left it to load additional components. | ||
| 78 | Avoid using graphical installer in this case. | ||
| 79 | |||
| 80 | {:loading="lazy"} | ||
| 81 | |||
| 82 | After that I selected hostname and created a normal user and set password for | ||
| 83 | that user and root user and choose guided mode for disk partitioning. | ||
| 84 | |||
| 85 | {:loading="lazy"} | ||
| 86 | |||
| 87 | I left it run to install all the things required for the base system and opted | ||
| 88 | out of scanning additional media for use by the package manager. Those will be | ||
| 89 | downloaded from the internet during installation. | ||
| 90 | |||
| 91 | {:loading="lazy"} | ||
| 92 | |||
| 93 | I opted out of the popularity contest, and **now comes the important part**. | ||
| 94 | Uncheck all the boxes in Software selection and only leave 'standard system | ||
| 95 | utilities'. I also left an SSH server, so I was able to log in to the machine | ||
| 96 | from my main PC. | ||
| 97 | |||
| 98 | {:loading="lazy"} | ||
| 99 | |||
| 100 | At this point, I installed GRUB bootloader on the disk where I installed the | ||
| 101 | system. | ||
| 102 | |||
| 103 | {:loading="lazy"} | ||
| 104 | |||
| 105 | That concluded the installation of base Debian and after restarting the computer | ||
| 106 | I was prompted with the login screen. | ||
| 107 | |||
| 108 | {:loading="lazy"} | ||
| 109 | |||
| 110 | Now that I had the base installation, it was time to choose what software do I | ||
| 111 | want to include in this so-called distribution. I wanted out of the box | ||
| 112 | developer experience, so I had plenty to choose. | ||
| 113 | |||
| 114 | Let's not waste time and go through the list. | ||
| 115 | |||
| 116 | ## Desktop environments | ||
| 117 | |||
| 118 | I have been using [Gnome](https://www.gnome.org/) for my whole Linux life. From | ||
| 119 | version 2 forward. It's been quite a ride. I hated version 3 when it came out | ||
| 120 | and replaced version 2. But I got used to it. And now with version 40+ they also | ||
| 121 | made couple of changes which I found both frustrating and presently surprised. | ||
| 122 | |||
| 123 | The amount of vertical space you loose because of the beefy title bars on | ||
| 124 | windows is ridiculous. And then in case of | ||
| 125 | [Tilix](https://gnunn1.github.io/tilix-web/) you also have tabs, and you are | ||
| 126 | 100px deep. Vertical space is one of the most important things for a | ||
| 127 | developer. The more real estate you have, the more code you can have in a | ||
| 128 | viewport. | ||
| 129 | |||
| 130 | But on the other hand, I still love how Gnome feels and looks. I gotta give them | ||
| 131 | that. They really are trying to make Gnome feel unified and modern. | ||
| 132 | |||
| 133 | Regardless of all the nice things Gnome has, I was looking at the tiling window | ||
| 134 | managers for some time, but never had the nerve to actually go with it. But now | ||
| 135 | was the ideal time to give it a go. No guts, no glory kind of a thing. | ||
| 136 | |||
| 137 | One of the requirements for me was easy custom layouts because I use a really | ||
| 138 | strange monitor with aspect ratio of 32:9. So relying on included layouts most | ||
| 139 | of them have is a non-starter. | ||
| 140 | |||
| 141 | What I was doing in Gnome was having windows in a layout like the diagram | ||
| 142 | below. This is my common practice. And if you look at it you can clearly see I | ||
| 143 | was replicating tiling window manager setup in Gnome. | ||
| 144 | |||
| 145 | {:loading="lazy"} | ||
| 146 | |||
| 147 | That made me look into a bunch of tiling window managers and then tested them | ||
| 148 | out. Candidates I was looking at were: | ||
| 149 | |||
| 150 | - [i3](https://i3wm.org/) | ||
| 151 | - [bspwm](https://github.com/baskerville/bspwm) | ||
| 152 | - [awesome](https://awesomewm.org/index.html) | ||
| 153 | - [XMonad](https://xmonad.org/) | ||
| 154 | - [sway](https://swaywm.org/) | ||
| 155 | - [Qtile](http://www.qtile.org/) | ||
| 156 | - [dwm](https://dwm.suckless.org/) | ||
| 157 | |||
| 158 | You can also check article [13 Best Tiling Window Managers for | ||
| 159 | Linux](https://www.tecmint.com/best-tiling-window-managers-for-linux/) I was | ||
| 160 | referencing while testing them out. | ||
| 161 | |||
| 162 | While all of them provided what I needed, I liked i3 the most. What particular | ||
| 163 | caught my eye was the ease to use and tree based layouts which allows flexible | ||
| 164 | layouts. I know others can be set up also to have custom layouts other than | ||
| 165 | spiral, dwindle etc. I think i3 is a good entry-level window manager for | ||
| 166 | somebody like me. | ||
| 167 | |||
| 168 | ## Batteries included | ||
| 169 | |||
| 170 | The source for the whole thing is located on Github | ||
| 171 | https://github.com/mitjafelicijan/dfd-rice. | ||
| 172 | |||
| 173 | Currenly included: | ||
| 174 | |||
| 175 | - `non-free` (enables non-free packages in apt) | ||
| 176 | - `sudo` (adds sudo and adds user to sudo group) | ||
| 177 | - `essentials` (gcc, htop, zip, curl, etc...) | ||
| 178 | - `wifi` (network manager nmtui) | ||
| 179 | - `desktop` (i3, dmenu, fonts, configurations) | ||
| 180 | - `pulseaudio` (pulseaudio with pavucontrol) | ||
| 181 | - `code-editors` (vim, micro, vscode) | ||
| 182 | - `ohmybash` (make bash pretty) | ||
| 183 | - `file-managers` (mc) | ||
| 184 | - `git-ui` (terminal git gui) | ||
| 185 | - `meld` (diff tool) | ||
| 186 | - `profiling` (kcachegrind, valgrind, strace, ltrace) | ||
| 187 | - `browsers` (brave, firefox, chromium) | ||
| 188 | - programming languages: | ||
| 189 | - `python` | ||
| 190 | - `golang` | ||
| 191 | - `nodejs` | ||
| 192 | - `rust` | ||
| 193 | - `nim` | ||
| 194 | - `php` | ||
| 195 | - `ruby` | ||
| 196 | - `docker` (with docker-compose) | ||
| 197 | - `ansible` | ||
| 198 | |||
| 199 | Install script also allows you to install only specific packages (example for: | ||
| 200 | essentials ohmybash docker rust). | ||
| 201 | |||
| 202 | ```sh | ||
| 203 | su - root \ | ||
| 204 | bash -c "$(wget -q https://raw.github.com/mitjafelicijan/dfd-rice/master/tools/install.sh -O -)" -- \ | ||
| 205 | essentials ohmybash docker rust | ||
| 206 | ``` | ||
| 207 | |||
| 208 | Currently, most of these recipes use what Debian and this is totally fine with | ||
| 209 | me since I never use bleeding edge features of a package. But if something major | ||
| 210 | would come to light, I will replace it with a possible compilation script or | ||
| 211 | something similar. | ||
| 212 | |||
| 213 | This is some of the output from the installation script. | ||
| 214 | |||
| 215 | {:loading="lazy"} | ||
| 216 | |||
| 217 | Let's take a look at some examples in the installation script. | ||
| 218 | |||
| 219 | ### Docker recipe | ||
| 220 | |||
| 221 | ```sh | ||
| 222 | # docker | ||
| 223 | print_header "Installing Docker" | ||
| 224 | curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --yes --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | ||
| 225 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
| 226 | apt update | ||
| 227 | apt -y install docker-ce docker-ce-cli containerd.io docker-compose | ||
| 228 | |||
| 229 | systemctl start docker | ||
| 230 | systemctl enable docker | ||
| 231 | systemctl status docker --no-pager | ||
| 232 | |||
| 233 | /sbin/usermod -aG docker $USERNAME | ||
| 234 | ``` | ||
| 235 | |||
| 236 | ### Making bash pretty | ||
| 237 | |||
| 238 | I really like [Oh My Zsh](https://ohmyz.sh/), but I don't like zsh shell. When | ||
| 239 | I used it, I constantly needed to be aware of it and running bash scripts was a | ||
| 240 | pain. So, I was really delighted when I found out that a version for bash | ||
| 241 | existed called [Oh My Bash](https://ohmybash.nntoan.com/). Let's take a look at | ||
| 242 | the recipe for installing it. | ||
| 243 | |||
| 244 | ```sh | ||
| 245 | # ohmybash | ||
| 246 | print_header "Enabling OhMyBash" | ||
| 247 | sudo -u $USERNAME sh -c "$(curl -fsSL https://raw.github.com/ohmybash/oh-my-bash/master/tools/install.sh)" & | ||
| 248 | T1=${!} | ||
| 249 | wait ${T1} | ||
| 250 | ``` | ||
| 251 | |||
| 252 | Because OhMyBash does `exec bash` at the end, this traps our script inside | ||
| 253 | another shell and our script cannot continue. For that reason, I executed this | ||
| 254 | in background. But that presents a new problem. Because this is executed in | ||
| 255 | background, we lose track of progress naturally. And that strange trick with | ||
| 256 | `T1=${!}` and `wait ${T1}` waits for the background process to finish before | ||
| 257 | continuing to another task in bash script. | ||
| 258 | |||
| 259 | Check [Multi-Threaded Processing in Bash Scripts](https://www.cloudsavvyit.com/12277/how-to-use-multi-threaded-processing-in-bash-scripts/) | ||
| 260 | for more details. | ||
| 261 | |||
| 262 | ## Conclusion | ||
| 263 | |||
| 264 | Take a look at | ||
| 265 | https://github.com/mitjafelicijan/dfd-rice/blob/develop/tools/install.sh script | ||
| 266 | to get familiar with it. This is just a first iteration and I will continue to | ||
| 267 | update it because I need this in my life. | ||
| 268 | |||
| 269 | The current version boots in 4s to the login prompt, and after you log in, the | ||
| 270 | desktop environment loads in 2s. So, its fast, very fast. And on clean boot, I | ||
| 271 | measured ~230 MB of RAM usage. | ||
| 272 | |||
| 273 | And this is how it looks with two terminals side by side. I really like the | ||
| 274 | simplicity and clean interface. I will polish the colors and stuff like that, | ||
| 275 | but I really do like the results. | ||
| 276 | |||
| 277 | {:loading="lazy"} | ||
