scripts/afu/README.md

166 lines
3.8 KiB
Markdown
Raw Normal View History

# Python Script for Downloading the Latest Amateur Radio Callbook of Austria
(c) KW4NZ since 2024
- Guide is based on Debian 12.5, and Arch Linux
- Last modified 2024-06-12
## Prerequisites
1. A running Linux system, e.g. Debian, Arch, etc.
2024-06-12 19:41:16 +02:00
0. User has administrative access via sudo
0. Python Version >3
0. Chromium Web browser (headless)
2024-06-12 19:41:16 +02:00
0. Selenium for Python via Webdriver Manager
0. Optional: User has an ssh key pair
0. Optional: git, ? wget, ? curl
## Installation of Python, Selenium, Chromium
### Debian Linux
#### Check Version
$ cat /etc/debian_version
12.5
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Upgrade your Debian installation if the version is lower than the above value.
#### Update/Upgrade Debian
$ sudo apt update
$ sudo apt upgrade
2024-06-12 19:41:16 +02:00
If this does not work, then the user \<username\> must be added to the sudo group with :
$ su -
Password:
root@debian:~# usermod -aG sudo <username>
For the group membership to take effect, the user must log out and log in again or the system must be restarted.
#### Python3
2024-06-12 19:41:16 +02:00
Check if Python is already installed in Debian:
$ python3 --version
Python 3.11.2
If it is not already installed, then:
$ sudo apt install python3
#### Chromium Browser
$ sudo apt install chromium
2024-06-12 19:41:16 +02:00
#### Manager (selenium)
Afterwards, selenium is installed:
$ sudo apt install python3-selenium
#### SSH key generation
The program `openssh` is preinstalled on Debian systems. But there is no private/public key installed yet. Best practices generating the key pair:
$ ssh-keygen -t ed25519 -C "your_email@example.com"
Personally, I don't use a different name for the keys, I just click through the process.
The same applies to the passphrase.
Now go to the website https://git.kuschel.at and copy the content of the public key from ~/.ssh/id__ed25519.pub to the "Manage SSH keys" -- via "Add Key".
$ cat .ssh/id_ed25519.pub
#### Git installation and clone the scripts from git.kuschel.at
$ sudo apt install git
You have to globally configure your `git` with:
$ git config --global user.name "John Doe"
$ git config --global user.email your_email@example.com
Checking the git configuration with:
$ git config -l
user.name=<your name>
user.email=<your e-mail>
etc.
Now create a folder and cd into it
$ mkdir gitea
$ cd gitea
Clone the repository `script` to your site with:
~/gitea$ git clone ssh://git@kuschel.at:21861/public/scripts.git
Ensure you can run `pip` from command line
$ python3 -m pip --version
If pip isnt already installed ("No module named pip"), then first try to bootstrap it from the standard library
$ python3 -m ensurepip --default-pip
If this does not work, install the package
$ sudo apt install python3-pip
Also `sudo apt install pip` should work.
$ pip install webdriver-manager
### Arch Linux (@todo)
#### Check Version
$ cat /etc/lsb-release
DISTRIB_ID="Arch"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="Arch Linux"
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
#### Update Arch Linux
Because Arch linux is a rolling distribution, simply update the version to the latest version with:
$ sudo pacman -Syuv
sudo pacman -S python
Alternative when `yay` is installed:
yay -S python