2.1.2. Python Package for macOS/Linux/Windows
2.1.2.1. Generate SSH Key
AN/LT Utility requires an SSH key pair to run as a SSH service. To generate a SSH key pair, please open Command Prompt/PowerShell (Windows) or Terminal (macOS/Linux)
> ssh-keygen -t rsa
You will be prompted to save and name the key.
> Generating public/private rsa key pair. Enter file in which to save the key (/Users/USER/.ssh/id_rsa):
Press Enter to use the default name id_rsa
.
Important
The filename of the key should be id_rsa
. Please don’t use other filenames otherwise the application won’t be able to run.
Next you will be asked to create and confirm a passphrase for the key:
> Enter passphrase (empty for no passphrase):
Press Enter to skip passphrase.
> Enter same passphrase again:
Press Enter again to confirm passphrase.
This will generate two files, by default called id_rsa
and id_rsa.pub
in /Users/USER/.ssh
See also
You can read more about Generating SSH Key
2.1.2.2. Python Package for Win/macOS/Linux
Note
Skip this section, if you are a Windows (x64) user and don’t want to install AN/LT Utility as a Python package but simply want the .exe application,
AN/LT Utility is available to install via the Python Package Index. You can also install from the source file. The steps below will guide you through
2.1.2.2.1. Prerequisites
Before installing AN/LT Utility, please make sure your environment has installed:
Install Python (requires Python >= 3.8)
2.1.2.2.1.1. Install Python
Important
AN/LT Utility requires Python >= 3.8.
AN/LT Utility requires that you download and install Python3 on your system.
After installation, open Command Prompt (Windows) or Terminal (macOS/Linux) and type python
to verify your Python installation.
> python
Python 3.10.10 (tags/v3.10.10:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3
Python 3.10.10 (v3.10.10:a58ebcc701, Feb 7 2023, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Note
🧐 If you are stuck with Python installation, seek help in Python 3 Installation & Setup Guide
2.1.2.2.1.2. Install PIP
Make sure pip
is installed on your system. pip
is the package installer for Python . You can use it to install packages from the Python Package Index and other indexes.
Usually, pip
is automatically installed if you are:
working in a virtual Python environment (virtualenv or venv ). It is not necessary to use
sudo pip
inside a virtual Python environment.using Python downloaded from python.org
If you don’t have pip
installed, you can:
Download the script, from https://bootstrap.pypa.io/get-pip.py.
Open a terminal/command prompt,
cd
to the folder containing theget-pip.py
file and run:
> py get-pip.py
$ python3 get-pip.py
See also
Read more details about this script in pypa/get-pip.
Read more about installation of pip
in pip installation.
2.1.2.2.2. Install From PyPi Repository
pip
is the recommended installer for AN/LT Utility. The most common usage of pip
is to install from the Python Package Index using Requirement Specifiers.
Note
If you install AN/LT Utility using pip install xoa-utils
, XOA Python API (PyPI package name xoa_driver) will be automatically installed.
Important
You can either install xoa-utils in your global Python namespace/package inventory or you can create a virtual Python environment to prevent polluting your global Python package inventory
2.1.2.2.2.1. If Install To Global Namespace
> pip install xoa-utils # latest version
> pip install xoa-utils==1.0.0 # specific version
> pip install xoa-utils>=1.0.0 # minimum version
$ pip install xoa-utils # latest version
$ pip install xoa-utils==1.0.0 # specific version
$ pip install xoa-utils>=1.0.0 # minimum version
2.1.2.2.2.2. If Install To Virtual Environment
Install AN/LT Utility in a virtual environment, so it does not pollute your global namespace.
For example, your project folder is called /my_xoa_project
.
[my_xoa_project]> python -m venv .\env
[my_xoa_project]> .env\Scripts\activate
(env) [my_xoa_project]> pip install xoa-utils # latest version
(env) [my_xoa_project]> pip install xoa-utils==1.0.0 # specific version
(env) [my_xoa_project]> pip install xoa-utils>=1.0.0 # minimum version
[my_xoa_project]$ python3 -m venv ./env
[my_xoa_project]$ source ./env/bin/activate
(env) [my_xoa_project]$ pip install xoa-utils # latest version
(env) [my_xoa_project]$ pip install xoa-utils==1.0.0 # specific version
(env) [my_xoa_project]$ pip install xoa-utile>=1.0.0 # minimum version
Afterwards, your project folder will be:
/my_xoa_project
|
|- env
See also
2.1.2.2.3. Upgrade From PyPi Repository
To upgrade AN/LT Utility package from PyPI:
> pip install xoa-utils --upgrade
$ pip install xoa-utils --upgrade
Note
If you upgrade AN/LT Utility using pip install --upgrade xoa-utils
, XOA Python API (PyPI package name xoa_driver) will be automatically upgraded.
2.1.2.2.4. Install Manually From Source
If you don’t have internet access, you can install AN/LT Utility manually from source, the steps are:
Step 1, make sure Python packages wheel and setuptools are installed on your system. Install wheel
and setuptools
using pip
:
wheel
and setuptools
in Windows environment.> pip install wheel setuptools
wheel
and setuptools
in macOS/Linux environment.$ pip install wheel setuptools
Step 2, download the AN/LT Utility source distribution from AN/LT Utility Releases. Unzip the archive and run the setup.py
script to install the package:
[xoa_core]> python setup.py install
[xoa_core]$ python3 setup.py install
Step 3, if you want to distribute, you can build .whl
file for distribution from the source:
[xoa_core]> python setup.py bdist_wheel
[xoa_core]$ python3 setup.py bdist_wheel
Important
If you install AN/LT Utility from the source code, you need to install XOA Python API (PyPI package name xoa_driver) separately. This is because XOA Python API is treated as a 3rd-party dependency of AN/LT Utility. You can go to XOA Python API repository to learn how to install it.
2.1.2.2.5. Start AN/LT Utility
After installing the package and ensuring the SSH key in place, you can start AN/LT Utility simply by typing xoa-utils
> xoa-utils
(PID: 12345) AN/LT Utility SSH Service (1.1.0) running on 0.0.0.0:22622.
$ xoa-utils
(PID: 12345) AN/LT Utility SSH Service (1.1.0) running on 0.0.0.0:22622.
Note
If you want to run xoa-utils SSH service on a different port, do xoa-utils <port number>
2.1.2.2.6. Uninstall and Remove Unused Dependencies
pip uninstall xoa-utils
can uninstall the package itself but not its dependencies. Leaving the package’s dependencies in your environment can later create conflicting dependencies problem.
We recommend install and use the pip-autoremove utility to remove a package plus unused dependencies.