diff --git a/docs/install.md b/docs/install.md index d4ebf60f..0e7425b7 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,29 +1,70 @@ # Installation - * Table of Contents {:toc} ## Overview +CORE provides a script to help automate the installation of dependencies, +build and install, and either generate a CORE specific python virtual environment +or build and install a python wheel. -CORE provides a script to help automate installing all required software -to build and run, including a python virtual environment to run it all in. - +### Tools Used The following tools will be leveraged during installation: |Tool|Description| |---|---| |[pip](https://pip.pypa.io/en/stable/)|used to install pipx| |[pipx](https://pipxproject.github.io/pipx/)|used to install standalone python tools (invoke, poetry)| -|[invoke](http://www.pyinvoke.org/)|used to run provided tasks (install, daemon, gui, tests, etc)| -|[poetry](https://python-poetry.org/)|used to install the managed python virtual environment for running CORE| +|[invoke](http://www.pyinvoke.org/)|used to run provided tasks (install, uninstall, reinstall, etc)| +|[poetry](https://python-poetry.org/)|used to install python virtual environment or building a python wheel| -## Required Hardware +### Files +The following is a list of files that would be installed after running the automated installation. +> **NOTE:** the default install prefix is /usr/local, but can be changed as noted below + +* executable files + * /bin/{core-daemon, core-gui, vcmd, vnoded, etc} +* tcl/tk gui files + * /lib/core + * /share/core/icons +* example imn files + * /share/core/examples +* python files + * poetry virtual env + * `cd /daemon && poetry env info` + * ~/.cache/pypoetry/virtualenvs/ + * local python install + * default install path for python3 installation of a wheel + * `python3 -c "import core; print(core.__file__)"` +* configuration files + * /etc/core/{core.conf, logging.conf} +* ospf mdr repository files + * /../ospf-mdr +* emane repository files + * /../emane + +### Installed Executables +After the installation complete it will have installed the following scripts. + +| Name | Description | +|---|---| +| core-cleanup | tool to help removed lingering core created containers, bridges, directories | +| core-cli | tool to query, open xml files, and send commands using gRPC | +| core-daemon | runs the backed core server providing TLV and gRPC APIs | +| core-gui | runs the legacy tcl/tk based GUI | +| core-imn-to-xml | tool to help automate converting a .imn file to .xml format | +| core-manage | tool to add, remove, or check for services, models, and node types | +| core-pygui | runs the new python/tk based GUI | +| core-python | provides a convenience for running the core python virtual environment | +| core-route-monitor | tool to help monitor traffic across nodes and feed that to SDT | +| core-service-update | tool to update automate modifying a legacy service to match current naming | +| coresendmsg | tool to send TLV API commands from command line | + +### Required Hardware Any computer capable of running Linux should be able to run CORE. Since the physical machine will be hosting numerous containers, as a general rule you should select a machine having as much RAM and CPU resources as possible. -## Supported Linux Distributions - +### Supported Linux Distributions Plan is to support recent Ubuntu and CentOS LTS releases. Verified: @@ -46,14 +87,14 @@ sudo yum install -y kernel-modules-extra sudo modprobe sch_netem ``` -## Utility Requirements +### Utility Requirements +The following are known dependencies that will result in errors when not met. * iproute2 4.5+ is a requirement for bridge related commands * ebtables not backed by nftables -## Upgrading - -Please make sure to uninstall the previous installation of CORE cleanly +## Upgrading from Older Release +Please make sure to uninstall any previous installations of CORE cleanly before proceeding to install. Previous install was built from source: @@ -72,92 +113,97 @@ sudo yum remove core sudo apt remove core ``` -## Automated Installation - -> **NOTE:** installing globally can have issues with dependency conflicts etc - -The automated install will install do the following: +## Automated Install +The automated install will do the following: * install base tools needed for installation * python3, pip, pipx, invoke, poetry * installs system dependencies for building core -* installs latest version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr) +* clone/build/install working version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr) * installs core into poetry managed virtual environment or locally, if flag is passed -* installs scripts pointing to python interpreter being used -* installs systemd service, disabled by default +* installs scripts pointing pointing to appropriate python location based on install type +* installs systemd service pointing to appropriate python location based on install type -After installation has completed you should be able to run the various -CORE scripts for running core. +After installation has completed you should be able to run `core-daemon` and `core-gui`. -> **NOTE:** provide a prefix that will be found on path when running as sudo -> if the default prefix is not valid +> **NOTE:** installing locally comes with its own risks, it can result it potential +> dependency conflicts with system package manager installed python dependencies +> **NOTE:** provide a prefix that will be found on path when running as sudo, +> if the default prefix /usr/local will not be valid + +`install.sh` will attempt to determine your OS by way of `/etc/os-release`, currently it supports +attempts to install OSs that are debian/redhat like (yum/apt). ```shell # clone CORE repo git clone https://github.com/coreemu/core.git cd core -# run install script # script usage: install.sh [-v] [-d] [-l] [-p ] # # -v enable verbose install # -d enable developer install # -l enable local install, not compatible with developer install # -p install prefix, defaults to /usr/local -./install.sh + +# install core to virtual environment +./install.sh -p + +# install core locally +./install.sh -p -l ``` ### Unsupported Linux Distribution +For unsupported OSs you could attempt to do the following to translate +an installation to your use case. -If you are on an unsupported distribution, you can look into the -[install.sh](https://github.com/coreemu/core/blob/master/install.sh) -and -[tasks.py](https://github.com/coreemu/core/blob/master/tasks.py) -files to see the various commands ran to install CORE and translate them to -your use case, assuming it is possible. +* make sure you have python3.6+ with venv support +* make sure you have python3 invoke available to leverage `/tasks.py` -If you get install down entirely, feel free to contribute and help others. +```shell +cd -## Installed Scripts +# Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...] +# +# Docstring: +# install core, poetry, scripts, service, and ospf mdr +# +# Options: +# -d, --dev install development mode +# -i STRING, --install-type=STRING +# -l, --local determines if core will install to local system, default is False +# -p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local +# -v, --verbose enable verbose -After the installation complete it will have installed the following scripts. +# install virtual environment +inv install -p -| Name | Description | -|---|---| -| core-cleanup | tool to help removed lingering core created containers, bridges, directories | -| core-cli | tool to query, open xml files, and send commands using gRPC | -| core-daemon | runs the backed core server providing TLV and gRPC APIs | -| core-gui | runs the legacy tcl/tk based GUI | -| core-imn-to-xml | tool to help automate converting a .imn file to .xml format | -| core-manage | tool to add, remove, or check for services, models, and node types | -| core-pygui | runs the new python/tk based GUI | -| core-python | provides a convenience for running the core python virtual environment | -| core-route-monitor | tool to help monitor traffic across nodes and feed that to SDT | -| core-service-update | tool to update automate modifying a legacy service to match current naming | -| coresendmsg | tool to send TLV API commands from command line | +# indstall locally +inv install -p -l + +# this will print the commands that would be ran for a given installation +# type without actually running them, they may help in being used as +# the basis for translating to your OS +inv install --dry -v -p -i +``` ## Running User Scripts - If you create your own python scripts to run CORE directly or using the gRPC/TLV APIs you will need to make sure you are running them within context of the installed virtual environment. To help support this CORE provides the `core-python` executable. This executable will allow you to enter CORE's python virtual environment interpreter or to run a script within it. -> **NOTE:** the following assumes CORE has been installed successfully - +For installations installed to a virtual environment: ```shell core-python