Joseph Zikusooka ~ Zik

A software engineer specializing in open source technologies | Very experienced in building and configuring UNIX/Linux systems and servers. Passionate about developing software applications and hardware for the smart home | Currently serving as the CEO of Jambula Labs and the project leader at JambulaTV, a smart home automation and entertainment platform - https://jambulatv.com | This blog focuses on the following areas: Linux How-Tos and Tutorials ::: IT Security News ::: Free and Libre Open Source Software ::: Smart Home Software ::: Digital Innovations in East Africa https://mastodon.social/@jzik | https://github.com/zikusooka

Year: 2023

Linux, Python, Security, and Open Source Software TIPS

  • šŸ’” Use the following command to find out which key has been pressed in Linux#ZikTIPS #CLI #Fedora #Opensourcesudo showkey
  • Alternatives to popular CLI tools: uptime #CLI #opensource https://www.linuxlinks.com/alternatives-popular-cli-tools-uptime/
  • The upstream xz repository and the xz tarballs have been backdoored. Red Hat issues urgent security alert for @fedora Linux 40 & Fedora Rawhide users #security #cybersecurity #infosec #xz #Fedora #opensourcehttps://www.openwall.com/lists/oss-security/2024/03/29/4
  • šŸ’”Use the command line in Linux to mount & un-mount partitions located in an image generated by a tool such as dd #ZikTIPS #Fedora #Debian #CLI #Embedded #opensource sudo losetup -fP –show JambulaOS.imgsudo mount -o loop /dev/loop21pX /mnt(where X = 1, 2 …)sudo umount /mntsudo losetup -D JambulaOS.img
  • Happy to release the latest version of Jambula OS, a custom Linux distribution used primarily on embedded and SoC devices such as the Raspberry Pi. Download it at: https://github.com/zikusooka/Jambula-OS#JambulaOS #JambulaTV #RaspberryPi #OpenSource
  • šŸ’”ļøFind the version of a Linux kernel source tree that you have unpacked#ZikTIPS #CLI #Fedora cd [linux-source-tree]make kernelversion
  • Use the Linux command line to get the number of days left before that all important day e.g. an upcoming conference @fedora @climagic @Linux @debian #ZikTIPS #CLI #Fedora #OpensourceFUTURE_DATE="2024-03-31"; echo $(( ($(date -d $FUTURE_DATE +'%s')-$(date +'%s')) / 86400))NOTE: You can also use it in reverse e.g. calculate number of days you have been on earth
  • šŸ’”Use the Linux command line to calculate the number of days left before that important & upcoming day @fedora #ZikTIPS #CLI #Fedora #LinuxDAY="2024-03-31"; echo $(( ($(date -d $DAY +'%s')-$(date +'%s')) / 86400))
  • In case you missed my talk at the Creative Freedom Summit 2024, you can watch it at:https://www.youtube.com/watch?v=7CyM5fWq7bQ@fedora @fedora_design @jambula #fedora #jambulaTV
  • My presentation at the Creative Freedom Summit is available at:https://www.youtube.com/watch?v=7CyM5fWq7bQ
  • Join me shortly as I present at the Creative Freedom Summit 2024 @fedora @fedora_design @jambula @jambulatv The live stream starts shortly at: https://www.youtube.com/live/Vob6ZmXE68c?si=E4P_P83M6ilAg42LFor an interactive chat, join us at: https://matrix.to/#/#creativefreedom:fedora.im#creativefreedomsummit #fedora #jambulaTV #smarthome
  • It's the 3rd & final day of the Creative Freedom Summit 2024! Join me today as I speak & share my experiences on using Fedora Linux to create a private & locally based smart home hubhttps://sched.co/1Xzv4@fedora @icinga @homeassistant @jambulatv @jambula#creativefreedomsummit#fedora #opensource #JambulaTV #smarthome #privacy #privacymatters
  • It's Day 2 of the Creative Freedom Summit 2024! Don't miss out on great sessions about open source creative tools @fedora @fedora_design The live stream starts shortly at: https://youtube.com/@fedora/streamsFor an interactive chat, join in using element: https://matrix.to/#/#creativefreedom:fedora.im#CreativeFreedomSummit #opensource
  • Also add '-p mpv ….' to use MPV or another video player instead of VLCYou can select different resolutions depending on your bandwidth. Available streams: 144p (worst), 240p, 360p, 480p, 720p (best)
  • šŸ’”Use the Linux command line to launch a live Youtube stream e.g. To watch the on-going @fedora @fedora_design #CreativeFreedomSummit streamlink https://www.youtube.com/watch?v=sUrTAyksmHA best#ZikTIPS #CLI #Fedora
  • The Creative Freedom Summit 2024 starts today! It's all about open source creative tools and why they're important. Watch live at: https://www.youtube.com/@fedora/streamsAnd for the best experience, join in via Fedora Element: https://matrix.to/#/#creativefreedom:fedora.im#CreativeFreedomSummit #opensource
  • šŸ’”In GNOME, quickly open or switch to an application in your Dash using hot keys e.g. Press WIN+1 to switch to the first app, WIN+2 to the second app, etc.. .#ZikTIPS #GNOME #Fedora #Ubuntu
  • I'm excited to attend the Creative Freedom Summit 2024 which begins in 1 day!#creativefreedomsummit #fedora #Linuxhttps://creativefreedomsummit2024.sched.com/directory/speakers @fedora
  • Join me this week at the Creative Freedom Summit 2024 where I will be speaking and sharing my experiences on using Fedora Linux to create a private and locally based smart home hub @fedora @icinga @homeassistant @jambulatv @jambula #creativefreedomsummit#fedora #jambulaTV #smarthome #privacy #privacymatters https://sched.co/1Xzv4
  • I'll be speaking at the Creative Freedom Summit 2024! Join me as I share my experiences using Fedora Linux to create a private & locally based smart home hub@fedora @creativefreedom @jambulatv #creativefreedomsummit #fedora #jambulaTV https://sched.co/1Xzv4

How to install the latest Python 3 version on Linux using sources

Introduction

Python 3.11.0 was officially released on October 24 2022. However, most Linux distributions have not yet upgraded to the latest Python version i.e. Python 3.11.2 (released on February 8 2023). Please visit this page to see the most recent versions.

The jump from versions 3.10.X to 3.11.X brought with it significant changes and improvements to Python code. Among the improvements is that Python is now 10 – 60% faster than before. Thatā€™s a big and noticeable speed boost. So beyond the usual reasons for upgrades i.e. security etc, I really wanted this version on my Linux desktop as soon as the final release was made publicly available.

If you are like me and donā€™t like waiting for your favourite open-source program to be supported on your Linux distribution, here is how to install the latest Python 3 version on Linux using sources.

Before you begin, check the current version on your Linux system:

python  --version

Currently the version of Python on my Linux system is three (3) releases behind. So it is time for me to upgrade to the most recent version.

CAUTION: Due to the many dependencies on the currently installed Python common package, I highly recommend that you do not remove the existing version. Instead, we will install the latest version in an alternate location e.g. /usr/local

Prerequisites

Please ensure that your Linux system has the following packages installed:

On Ubuntu or Debian:

sudo apt-get install build-essential

sudo apt-get install autoconf automake gdb libffi-dev zlib1g-dev libssl-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libsqlite3-dev

On Fedora or Rocky Linux:

sudo dnf groupinstall “Development Toolsā€

sudo dnf install openssl-devel libffi-devel bzip2-devel sqlite-devel

* You will also need wget which is generally included by default on most Linux distributions

Visit the Python downloads page for sources to get the direct link to latest Python source package. In this tutorial I will be using the XZ compressed source tarball i.e. Python-3.11.2.tar.xz

Download the latest Python package to a temporary directory:

wget  -c  -P /tmp  https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tar.xz

Unpack the Python 3 tarball:

tar xvf /tmp/Python-3.11.2.tar.xz -C /usr/src

Compile and build Python:

cd  /usr/src/Python-3.11.2

./configure  --prefix=/usr/local  --enable-shared  --enable-optimizations  --with-system-expat  --with-system-ffi

IMPORTANT: Ensure the prefix i.e. ā€˜/usr/localā€™ you use is different from that used by your Linux distribution otherwise you will overwrite the default Python 3 installation!

Optional: You can make some of your modules a permanent part of the Python interpreter. To do so, simply modify the file: Modules/Setup.local before running make. To see my my local setup, see the appendix.

sudo  make

TIP: you can add ā€œ– j $(getconf _NPROCESSORS_ONLN)ā€ to the make command in order to speed things up i.e. sudo make -j $(getconf _NPROCESSORS_ONLN)

sudo  make  altinstall

Add the following export command to your shell initialization file:

Using Bash shell:

echo  ā€œexport  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/libā€  >>  ~/.bashrc

Then source the file for now:

source  ~/.bashrc

To verify if you now have the latest Python 3 (including pip installer) versions:

/usr/local/bin/python3.11 ā€“version

/usr/local/bin/pip3.11 ā€“version

Congratulations! You now have the latest Python 3 version on your Linux system.

NOTE: When your distribution eventually catches up, you can remove this installation by issuing the ‘make uninstall‘ command in the installation directory i.e. /usr/src/Python3.11

Appendix

Here’s my sample ./Modules/Setup.local file:

array -DPy_BUILD_CORE_MODULE arraymodule.c
_contextvars _contextvarsmodule.c
_struct -DPy_BUILD_CORE_MODULE _struct.c
_random _randommodule.c -DPy_BUILD_CORE_MODULE
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c
_pickle -DPy_BUILD_CORE_MODULE _pickle.c
_datetime _datetimemodule.c
_zoneinfo _zoneinfo.c -DPy_BUILD_CORE_MODULE
_bisect _bisectmodule.c
_asyncio _asynciomodule.c
_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c
unicodedata unicodedata.c -DPy_BUILD_CORE_BUILTIN
fcntl fcntlmodule.c
spwd spwdmodule.c
grp grpmodule.c
select selectmodule.c
mmap mmapmodule.c
_csv _csv.c
_socket socketmodule.c
termios termios.c
resource resource.c
_posixsubprocess  -DPy_BUILD_CORE_BUILTIN _posixsubprocess.c
audioop audioop.c
_md5 md5module.c
_sha1 sha1module.c
_sha256 sha256module.c -DPy_BUILD_CORE_BUILTIN
_sha512 sha512module.c -DPy_BUILD_CORE_BUILTIN
_sha3 _sha3/sha3module.c
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
syslog syslogmodule.c
binascii binascii.c
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DXML_POOR_ENTROPY -DUSE_PYEXPAT_CAPI
_multibytecodec cjkcodecs/multibytecodec.c
Scroll to top