Skip to content

Development & Programming

Overview

How do I run DietPi-Software and install optimised software items?

To install any of the DietPi optimised software items listed below run from the command line:

dietpi-software

Choose Browse Software and select one or more items. Finally select Install.
DietPi will do all the necessary steps to install and start these software items.

DietPi-Software menu screenshot

To see all the DietPi configurations options, review the DietPi Tools section.

Return to the Optimised Software list

Python 3

Python is a text based interpreted programming language with object oriented programming options for general purpose applications.

Python logo

Source: By www.python.org, GPL

You can find Python everywhere in the world of computer programming. For example, Python is the foundation of some of the world’s most popular websites 3, including Reddit, Dropbox, and YouTube, to name a few. The Python web framework Django powers both Instagram and Pinterest.

Currently, Python is 3rd most popular of programming language 4.

The install option explicitly installs only Python 3.
The pip/pip3 Python package manager and development headers are included. To use the pip package manager, a typical usage will be pip3 install -U <module>.

There are many Python IDE packages available. Following is a short list of well known and widely good accepted IDE packages (alphabetical order):

NameURL
Atomhttps://atom.io
Eclipse + Pydevhttps://www.eclipse.org and http://pydev.org
IDLEhttps://docs.python.org/3/library/idle.html
Pycharmhttps://www.jetbrains.com/pycharm
Spyderspyder-ide/spyder
Thonnyhttps://thonny.org
VSCodiumVSCodium below

Website: https://www.python.org
Official documentation, from beginner to advanced: https://www.python.org/doc/
How to Use Python: Your First Steps https://realpython.com/python-first-steps/ Wikipedia: https://wikipedia.org/wiki/Python_(programming_language)

Go

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

DietPi Go open source programming language

Source: By https://golang.org, Creative Commons Attribution 3.0

Go is a compiled, fast and high-performance language intended to be simple and is designed to be easy to read and understand. Go was created at Google by Rob Pike, Robert Griesemer, and Ken Thompson, and it first appeared in Nov 2009.

Go is used by some of the big organizations such as Google, BBC, Uber, Soundcloud, Twitch, Medium, Daily Motion2. Uber has reported better throughput, high performance, latency, and uptime. BBC, the house name in broadcasting the world news, uses it for backend, including crawlers and web scrapers. The build and deployment system of Soundcloud is in Go.

To edit the code you can use an editor of your choice, or use VSCodium. The Go extension available in VSCodium provides rich language support for the Go programming language.

Just to have a taste of it, you could run some commands in Go playground

Checkout also the official tutorial Get started with Go.

  • We switched to automatic Go version detection. Here is an example:

    root@DietPi3:~# go version
    go version go1.16.3 linux/arm
    
  • When the Go package gets uninstalled, the folder /mnt/dietpi_userdata/go is still kept.
    This is the place where packages are installed, custom compilations are run, sources are downloaded etc.

    It is especially important to keep /mnt/dietpi_userdata/go as long as we don’t have a good dependency system that blocks uninstalls of dependencies. Otherwise it would be possible to uninstall Go while OpenBazaar is still installed.
    As a side effect, removing /mnt/dietpi_userdata/go would mean also removing OpenBazaar.

  • /mnt/dietpi_userdata/go: This is the place where packages are installed, custom compilations are run, sources are downloaded etc.
    This path is what is given in the environment variable GOPATH.

    GOPATH is a global setting

    In normal Go installations, GOPATH is a user specific environment variable. In DietPi it is global, i.e. all users have the same module cache and all see the same binaries below GOPATH/bin.

  • /usr/local/go: This is the place where the Go package is installed.

  • /mnt/dietpi_userdata/go/pkg/mod: This is the path for 3rd party Go packages. The environment variable GOMODCACHE directs to this.

Some common Go commands are:

  • go version: Prints the installed Go version
  • go env: Prints the Go internal environment variables (e.g. GOPATH). Can also be used e.g. like $(go env GOPATH)/bin
  • go mod tidy <MODULNAME>: Generate a Go module
  • go help: Start the Go internal help in general, details for commands e.g. via go help build
dietpi-software reinstall 188

To check the installation, run go version.

See also https://golang.org/doc/install or
https://gist.github.com/nikhita/432436d570b89cab172dcf2894465753.


Website: https://golang.org
Official documentation, references and guided tours of Go programs : https://golang.org/doc
One example source to grub for Go libraries: avelino/awesome-go
Wikipedia: https://en.wikipedia.org/wiki/Go_(programming_language)

Docker

In 2013, Docker introduced containers. These are a standardized unit of software that allows developers to isolate their application from the environment. Docker is de facto standard to build and share containerized apps - from single board computers (SBC), to desktop or cloud.

A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Docker functional block diagram

Source: User:Maklaan - Based on a Docker blog post

Docker logs can be accessed using next command:

journalctl -u docker -u containerd

The location of the Docker configuration files:

  • Docker: /etc/docker/daemon.json
  • containerd: /etc/containerd/config.toml

Official documentation: https://docs.docker.com/get-started/overview
Configuration file: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
Logging: https://docs.docker.com/config/containers/logging/configure
Wikipedia: https://wikipedia.org/wiki/Docker_(software)

For a quick intro, see DietPi Docker Setup on Raspberry Pi 3 B Plus:

Docker Compose

Docker Compose is a Docker tool used to define and run multi-container applications. With Compose, you use a YAML file to create and configure your application’s services from this configuration file.

docker-compose is an excellent tool for development, testing, continuous integration (CI) workflows, and staging environments.

docker compose

Docker (individual container) vs. Docker-Compose (several containers) - source: A beginner’s guide to Docker

The tool is available soon after the installation. In case you need to upgrade it, here is the command:

sudo pip3 install docker-compose --upgrade

Official documentation: https://docs.docker.com/compose
Getting started: https://docs.docker.com/compose/gettingstarted
Sample apps with Compose: https://docs.docker.com/compose/samples-for-compose/
Release notes: https://docs.docker.com/compose/release-notes/
Wikipedia: https://wikipedia.org/wiki/Docker_(software)

Portainer

Portainer simplifies your Docker container management via Portainer web interface. It enables faster deploy of the applications and it gives real time visibility.

Portainer screenshot

The web interface is accessible via port 90021:

  • URL = http://<your.IP>:9002

To update Portainer, simply reinstall it:

dietpi-software reinstall 185

Official documentation: https://documentation.portainer.io
Beginners guide: https://codeopolis.com/posts/beginners-guide-to-portainer/ Source code: portainer/portainer
Open-source license: zlib

VSCodium

VSCodium is a FLOSS version of Microsoft’s Visual Studio code, built directly from the source on GitHub, without branding, tracking, or telemetry.

VSCodium screenshot

VSCodium is installed as APT package, hence you can update it by running the following commands:

apt update
apt install codium

Documentation (Visual Studio Code): https://code.visualstudio.com/docs
Documentation (VSCodium): https://github.com/VSCodium/vscodium/blob/master/DOCS.md
Source code: VSCodium/vscodium
License: MIT

Return to the Optimised Software list


  1. Logitech Media Server already listened to port 9000, and this is why Portainer has been configured to start using port 9002. For more details on the implementation Portainer in DietPi see the GitHub task: MichaIng/DietPi!3933 

  2. 7 Most Famous Companies That Use Golang 

  3. 8 World-Class Software Companies That Use Python 

  4. TIOBE Programming Community index