Skip to content

Commit dbe5953

Browse files
draft: clojure dev tools on Debian Linux
1 parent 249db16 commit dbe5953

File tree

1 file changed

+338
-0
lines changed

1 file changed

+338
-0
lines changed
Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
---
2+
title: Clojure Development on Debian Linux
3+
date:
4+
created: 2024-03-02
5+
updated: 2024-03-02
6+
authors:
7+
- practicalli
8+
categories:
9+
- linux
10+
tags:
11+
- clojure
12+
- debian-linux
13+
draft: true
14+
---
15+
16+
17+
18+
![Practicalli Debian Linux Logo](https://github.com/practicalli/graphic-design/blob/live/topic-images/debian-linux-logo-name.png?raw=true){align=right loading=lazy style="width:240px"}
19+
20+
Debian Linux is one of the original and longest running Linux distributions, in large part due to the excellent `deb` package management system and the openness of the contribution process.
21+
22+
Debian has inspired a large number of other Linux distributions, most notably Ubuntu.
23+
24+
Debian provides a highly flexible and stable operating system to build a Clojure development environment upon. Start with a minimal install that uses very few resources and use meta-packages to quickly add major pieces, including a desktop environment of your choice.
25+
26+
> Practicalli Clojure book details more options for [:fontawesome-solid-book-open: Clojure Install](https://practical.li/clojure/install/){target=_blank} and supporting tools
27+
28+
<!-- more -->
29+
30+
## Install Debian
31+
32+
![Practicalli Debian Linux Logo](https://github.com/practicalli/graphic-design/blob/live/topic-images/debian-linux-logo-name.png?raw=true){align=right loading=lazy style="width:120px"}
33+
34+
[:globe_with_meridians: Download the Debian Net install](https://www.debian.org/) minimal ISO image and write to a USB memory stick (flash drive).
35+
36+
> Debian Net install ISO contains the essential debian packages to run a minimal Linux system. Additional packages are installed via an internet connection to a local mirror.
37+
38+
Insert a USB memory stick and use `df -h` to see its location, e.g. `/dev/sda`
39+
40+
Copy the debian image to the USB stick
41+
42+
```shell
43+
cp debian-12.9.0-amd64-netinst.iso /dev/sda
44+
```
45+
46+
Restart the computer, selecting the USB memory stick to boot from.
47+
48+
Follow the Debian Install Wizard to configure the name of the computer & user accounts, how to connect to the internet an selecting additional software collections as required. Specific packages and collections can be added at any time after the install has completed.
49+
50+
Select one of the suggested desktop environments, or skip and install [:globe_with_meridians: Regolith Desktop](#regolith-desktop) for an excellent tiling window manager.
51+
52+
??? INFO "Debian Install - Software Selection"
53+
![Debian Install - Software selection](https://github.com/practicalli/graphic-design/blob/live/os/debian/debian-install-software-selection.png?raw=true)
54+
55+
The `tasksel` allows selection of collections at any time after the install has completed.
56+
57+
![Debian Install - Software selection](https://github.com/practicalli/graphic-design/blob/live/os/debian/debian-install-tasksel-software-collections.png?raw=true)
58+
59+
### Accounts & passwords
60+
61+
The install will prompt for a root user password and ask for a user account name and password. Ensure these are securely saved as they are created, e.g. in a password manager.
62+
63+
!!! INFO "A good password approach"
64+
Passwords should be simple for the user to remember but very hard for people and computer algorithms to guess.
65+
66+
Using 4 unrelated words that have meaning to only the user provides a convienence password for the user that is very hard to crack, e.g. `crab potato wallpaper spinach`
67+
68+
69+
[Debian Installation Guide](https://www.debian.org/releases/stable/installmanual){target=_blank .md-button}
70+
71+
72+
## Administration commands
73+
74+
![Practicalli Debian Linux Logo](https://github.com/practicalli/graphic-design/blob/live/topic-images/debian-linux-logo-name.png?raw=true){align=right loading=lazy style="width:120px"}
75+
76+
Debian requires administrative tasks such as installing software to be carried out by the root user.
77+
78+
??? INFO "Sudo considered less secure"
79+
Debian maintainers decided using the `sudo` command to temporarily elevate a user permissions added more of a security risk than using a dedicated root administration account. If sudo is ever hacked then it opens up the system.
80+
81+
Using `su -` instead does require remembering two different passwords, although significantly improves security.
82+
83+
The `sudo` package is in the Debian repository should that approach be preferred. Once the `sudo` package is installed, add the account name(s) to the sudo group using `adduser`.
84+
85+
```shell
86+
su --login && \
87+
apt install sudo && \
88+
adduser account-name sudo
89+
```
90+
91+
92+
`su -` switches to the root user account (first prompting for the root password).
93+
94+
`apt` is the advance package tool that manages the install (and removal) of debian packages.
95+
96+
`apt install package-name` installs the specified package along with any packages it depends upon. Recommended packages are also suggested (documentation or related packages).
97+
98+
`apt update` will update the list of available packages from all repositories.
99+
100+
`apt upgrade` installs the latest versions of packages and is typically run after `apt update`.
101+
102+
`apt dist-upgrade` safely updated packages when there is a new major release of Debian.
103+
104+
`apt search package-name` will search for the package-name provided.
105+
106+
`apt show package-name` displays details of the package, including the available version and any dependant packages
107+
108+
[:globe_with_meridians: Debian package search](https://www.debian.org/distrib/packages){target=_blank .md-button}
109+
110+
111+
## Additional Software
112+
113+
Contrib and nonfree repositories provide additional packages, such as fonts, codecs, etc.
114+
115+
Open **Software & Updates** and unlock the wizzard using the root account password.
116+
117+
Add contrib and non-free repositories, then **Close** and select **Refresh** to update the list of available packages.
118+
119+
![Debian Linux - software repositories contrib and nonfree](https://github.com/practicalli/graphic-design/blob/live/os/debian/debian-software-updates-repositories-contrib-nonfree.png?raw=true)
120+
121+
122+
## FreeDesktop XDG config standard
123+
124+
Using the XDG standard for simplifies maintenance and backup for configuration files and local caches.
125+
126+
All configuration files and directories reside under a `$HOME/.config` directory and do not need to be hidden dot files (or directories).
127+
128+
For example, Clojure configuration is in `$HOME/.config/clojure/` rather than `$HOME/.clojure/`
129+
130+
[:fontawesome-solid-book-open: Debian Linux - XDG FreeDesktop Configuration](https://practical.li/engineering-playbook/os/debian-linux/#root-vs-sudo){target=_blank .md-button}
131+
132+
[:fontawesome-solid-book-open: Adopting FreeDesktop XDG standard for configuration files](https://practical.li/blog/freedesktoporg-xdg-standard-for-clojure-development-tools/){target=_blank .md-button}
133+
134+
135+
## Regolith Desktop
136+
137+
[Regolith Desktop](https://regolith-desktop.com/) is a tiling desktop that is keyboard driven and has minimal resource use.
138+
139+
![Regolith Desktop - example with Chrome and Neovim editor](https://github.com/practicalli/graphic-design/blob/live/os/regolith/regolith-desktop-example-chrome-astronvim.png?raw=true){loading=lazy}
140+
141+
Install Regolith Desktop using the following commands as root user, i.e `su -`.
142+
143+
Register the Regolith public key
144+
145+
```shell
146+
wget -qO - https://regolith-desktop.org/regolith.key | \
147+
gpg --dearmor | sudo tee /usr/share/keyrings/regolith-archive-keyring.gpg > /dev/null
148+
```
149+
150+
Add the regolith package repository to install packages from
151+
152+
```shell
153+
echo deb "[arch=amd64 signed-by=/usr/share/keyrings/regolith-archive-keyring.gpg] \
154+
https://regolith-desktop.org/release-3_1-debian-bookworm-amd64 bookworm main" | \
155+
tee /etc/apt/sources.list.d/regolith.list
156+
```
157+
158+
Update available packages list and install regolith desktop along with a theme, e.g. Gruvbox.
159+
160+
```shell
161+
apt update && \
162+
apt install regolith-desktop regolith-session-flashback regolith-look-gruvbox
163+
```
164+
165+
This command will install a significant number of supporting packages to run a graphical desktop.
166+
167+
`reboot` command to restart Debian Linux once all packages are installed. A graphical login will display once Debian has rebooted.
168+
169+
[Regolith Desktop - Debian install options](https://github.com/practicalli/graphic-design/blob/live/os/debian/debian-install-software-selection.png?raw=true){target=_blank .md-button}
170+
171+
172+
## Kitty terminal
173+
174+
![Kitty Terminal Logo](https://github.com/practicalli/graphic-design/blob/live/logos/kitty-light.png?raw=true){align=right loading=lazy style="height:120px"}
175+
176+
[Kitty terminal](https://sw.kovidgoyal.net/kitty/) provides a fast and easy to configure terminal application, providing an excellent way to run Neovim or Emacs in a terminal.
177+
178+
Open **Terminal** and `su -` to change to the root user account.
179+
180+
```shell
181+
apt install kitty
182+
```
183+
184+
Kitty terminal includes NerdFonts to provide a rich terminal experience, especially when using Neovim.
185+
186+
!!! TIP "Configure & use Kitty"
187+
[Practicalli Dotfiles - Kitty](https://github.com/practicalli/dotfiles/tree/main/kitty) contains a recommended configuration for kitty.
188+
189+
[Practicalli Engineering Playbook](https://practical.li/engineering-playbook/command-line/kitty-terminal/) covers Kitty configuration and usage in more detail
190+
191+
## Java
192+
193+
![Java Logo](https://github.com/practicalli/graphic-design/blob/live/logos/java-logo.png?raw=true){align=right loading=lazy style="height:120px"}
194+
195+
Clojure is a hosted language and required the Java Virtual Machine to run.
196+
197+
Install OpenJDK package for the latest stable version, e.g. Java 21
198+
199+
```shell
200+
apt install openjdk-21-sdk
201+
```
202+
203+
> Use `update-alternatives --config java` if multiple Java versions are installed.
204+
205+
206+
## Clojure
207+
208+
![Clojure Logo](https://github.com/practicalli/graphic-design/blob/live/logos/Clojure_logo.svg.png?raw=true){align=right loading=lazy style="width:120px"}
209+
210+
The Linux install script for Clojure CLI will add the `clojure` binary and `clj` wrapper to `/usr/local/bin`, making it available to all users.
211+
212+
Open a **Terminal** and copy/paste these commands to download and run the Clojure CLI installer.
213+
214+
```shell
215+
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh && \
216+
chmod +x linux-install.sh && \
217+
sudo ./linux-install.sh
218+
```
219+
220+
### Practicalli Clojure CLI Config
221+
222+
The `deps.edn` file in Clojure CLI Config defines `:aliases` for a wide range of community tools which extend the features of Clojure CLI.
223+
224+
Add Practicalli Clojure CLI Config as the user wide configuration to use these tools across all projects.
225+
226+
```shell
227+
git clone [email protected]:practicalli/clojure-cli-config.git $XDG_CONFIG_HOME/clojure
228+
```
229+
230+
The `clojure` command runs clojure code. Using one or more aliases extends the features of the `clojure` command.
231+
232+
List the available aliases on the command line or review the [Practicalli Config guide](https://practical.li/clojure/clojure-cli/practicalli-config/).
233+
234+
```shell
235+
clojure -X:deps aliases
236+
```
237+
238+
!!! TIP "Creating Clojure projects"
239+
`:project/create` alias defined in the Practicalli Clojure Config uses deps-new with the Practicalli Project Templates to create production ready project structures with common development and CI tooling support.
240+
241+
## Neovim
242+
243+
![Neovim Logo](https://github.com/practicalli/graphic-design/blob/live/topic-images/neovim-logo-name.png?raw=true){align=right loading=lazy style="width:120px"}
244+
245+
Debian 12 includes Neovim 0.7.2, although Practicalli recommends downloading the [latest Neovim release from GitHub](https://github.com/neovim/neovim/releases/tag/stable).
246+
247+
Move the `nvim.appimage` file to the local bin directory, adding it to the operating system execution path.
248+
249+
```shell
250+
mv nvim.appimage ~/.local/bin/nvim.appimage
251+
```
252+
253+
Create a symbolic link to allow neovim to be run using the command `nvim`
254+
255+
```shell
256+
ln -s ~/.local/bin/nvim.appimage ~/.local/bin/nvim
257+
```
258+
259+
260+
### Treesitter parsers
261+
262+
Install a suitable compiler for the language parsers used by Treesitter in Neovim.
263+
264+
The `cpp` package is installed by default, however it seems `g++` package is also required
265+
266+
```shell
267+
apt install g++
268+
```
269+
270+
### Lint and format tools
271+
272+
Many lint and format tools are available as NPM packages, so `node` and `npm` are required.
273+
274+
Although nodejs and npm are available as debian packages, the `npm` package has a huge amount of dependencies.
275+
276+
Practicalli recommends the [Linux release from the nodejs website](https://nodejs.org/), installing in the local apps directory for the user account for Clojure development (your normal login account).
277+
278+
Extract the downloaded nodejs archive
279+
280+
```shell
281+
tar Jvxf node-v18.17.1-linux-x64.tar.xz
282+
```
283+
284+
Create a local app directory and move the extracted directory there, creating a symbolic link called current (which can be easily changed if a different version of node is required)
285+
286+
```shell
287+
mkdir ~/.local/apps/nodejs/ && \
288+
mv ~/Downloads/node-v18.17.1-linux-x64/ ~/.local/apps/nodejs/ && \
289+
ln -s ~/.local/apps/nodejs/node-v18.17.1-linux-x64 ~/.local/apps/nodejs/current
290+
```
291+
292+
Create symbolic links to the `node` and `npm` binaries within the `~/.local/bin/` directory, placing the binaries on the path. Using `current` in the link ensures these symbolic links do not need to be updated when switching to another nodejs version.
293+
294+
```shell
295+
ln -s ~/.local/apps/nodejs/current/bin/node ~/.local/bin/node && \
296+
ln -s ~/.local/apps/nodejs/current/bin/npm ~/.local/bin/npm
297+
```
298+
299+
300+
Install neovim npm package to support Neovim nodejs provider.
301+
302+
```shell
303+
npm install neovim
304+
```
305+
306+
307+
## Emacs
308+
309+
![Emacs Logo](https://github.com/practicalli/graphic-design/blob/live/topic-images/emacs-logo-name.png?raw=true){align=right loading=lazy style="width:120px"}
310+
311+
Debian 12 packages Emacs version 28.2, although Emacs 29.1 is the latest stable release.
312+
313+
Practicalli recommends [building Emacs from source](https://practical.li/blog/posts/build-emacs-from-source-on-ubuntu-linux/) as it is a relatively easy task although will take a little time to compile.
314+
315+
316+
## Slack
317+
318+
[Download the .deb file](https://slack.com/intl/en-gb/downloads/linux) from Slack website
319+
320+
`su -` in a terminal to change to the root user account
321+
322+
```shell
323+
apt install /home/practicalli/Downloads/slack-desktop-4.33.90-amd64.deb
324+
```
325+
326+
Slack can be run from the Desktop launcher, e.g. pressing ++super++ and typing `slack`.
327+
328+
329+
---
330+
Thank you.
331+
332+
[:globe_with_meridians: Practical.li Website](https://practical.li){target=_blank .md-button}
333+
334+
[:fontawesome-brands-github: Practical.li GitHub Org](https://github.com/practicalli){target=_blank .md-button}
335+
[:fontawesome-brands-github: practicalli-johnny profile](https://github.com/practicalli-johnny){target=_blank .md-button}
336+
337+
[:fontawesome-brands-mastodon: @practicalli@clj.social](https://clj.social/@practicalli){target=_blank .md-button}
338+
[:fontawesome-brands-twitter: @practical_li](https://twitter.com/practcial_li){target=_blank .md-button}

0 commit comments

Comments
 (0)