2020-07-16 00:22:03 +01:00
|
|
|
# Installation
|
2018-07-31 20:57:30 +01:00
|
|
|
* Table of Contents
|
|
|
|
{:toc}
|
|
|
|
|
2020-03-05 23:04:29 +00:00
|
|
|
## Overview
|
2020-09-26 17:42:15 +01:00
|
|
|
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.
|
2018-07-31 20:57:30 +01:00
|
|
|
|
2020-09-29 07:14:20 +01:00
|
|
|
> **WARNING:** if Docker is installed, the default iptable rules will block CORE traffic
|
|
|
|
|
2020-12-02 17:40:49 +00:00
|
|
|
### Requirements
|
|
|
|
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.
|
|
|
|
|
|
|
|
* Linux Kernel v3.3+
|
|
|
|
* iproute2 4.5+ is a requirement for bridge related commands
|
2021-05-10 23:07:42 +01:00
|
|
|
* nftables compatible kernel and nft command line tool
|
2020-12-02 17:40:49 +00:00
|
|
|
|
|
|
|
### Supported Linux Distributions
|
|
|
|
Plan is to support recent Ubuntu and CentOS LTS releases.
|
|
|
|
|
|
|
|
Verified:
|
|
|
|
* Ubuntu - 18.04, 20.04
|
2021-05-10 23:07:42 +01:00
|
|
|
* CentOS - 7.8, 8.0
|
2020-12-02 17:40:49 +00:00
|
|
|
|
2021-11-17 23:55:05 +00:00
|
|
|
> **NOTE:** Ubuntu 20.04 requires installing legacy ebtables for WLAN functionality
|
|
|
|
|
|
|
|
Enabling ebtables legacy:
|
|
|
|
```shell
|
|
|
|
sudo apt install ebtables
|
|
|
|
update-alternatives --set ebtables /usr/sbin/ebtables-legacy
|
|
|
|
```
|
|
|
|
|
|
|
|
> **NOTE:** CentOS 8 does not provide legacy ebtables support, WLAN will not function properly
|
|
|
|
|
2020-12-02 17:40:49 +00:00
|
|
|
> **NOTE:** CentOS 8 does not have the netem kernel mod available by default
|
|
|
|
|
|
|
|
CentOS 8 Enabled netem:
|
|
|
|
```shell
|
|
|
|
sudo yum update
|
|
|
|
# restart into updated kernel
|
|
|
|
sudo yum install -y kernel-modules-extra
|
|
|
|
sudo modprobe sch_netem
|
|
|
|
```
|
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
### Tools Used
|
2020-07-14 18:42:24 +01:00
|
|
|
The following tools will be leveraged during installation:
|
|
|
|
|
|
|
|
|Tool|Description|
|
|
|
|
|---|---|
|
2020-07-16 00:22:03 +01:00
|
|
|
|[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)|
|
2020-09-26 17:42:15 +01:00
|
|
|
|[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|
|
|
|
|
|
|
|
|
### 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
|
2020-12-02 17:40:49 +00:00
|
|
|
* `<prefix>/bin/{core-daemon, core-gui, vcmd, vnoded, etc}`
|
2020-09-26 17:42:15 +01:00
|
|
|
* tcl/tk gui files
|
2020-12-02 17:40:49 +00:00
|
|
|
* `<prefix>/lib/core`
|
|
|
|
* `<prefix>/share/core/icons`
|
2020-09-26 17:42:15 +01:00
|
|
|
* example imn files
|
2020-12-02 17:40:49 +00:00
|
|
|
* `<prefix>/share/core/examples`
|
2020-09-26 17:42:15 +01:00
|
|
|
* python files
|
|
|
|
* poetry virtual env
|
|
|
|
* `cd <repo>/daemon && poetry env info`
|
2020-12-02 17:40:49 +00:00
|
|
|
* `~/.cache/pypoetry/virtualenvs/`
|
2020-09-26 17:42:15 +01:00
|
|
|
* local python install
|
|
|
|
* default install path for python3 installation of a wheel
|
|
|
|
* `python3 -c "import core; print(core.__file__)"`
|
|
|
|
* configuration files
|
2020-12-02 17:40:49 +00:00
|
|
|
* `/etc/core/{core.conf, logging.conf}`
|
2020-09-26 17:42:15 +01:00
|
|
|
* ospf mdr repository files
|
2020-12-02 17:40:49 +00:00
|
|
|
* `<repo>/../ospf-mdr`
|
2020-09-26 17:42:15 +01:00
|
|
|
* emane repository files
|
2020-12-02 17:40:49 +00:00
|
|
|
* `<repo>/../emane`
|
2020-09-26 17:42:15 +01:00
|
|
|
|
|
|
|
### Installed Executables
|
|
|
|
After the installation complete it will have installed the following scripts.
|
2018-07-31 20:57:30 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
| 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 |
|
2018-07-31 20:57:30 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
## Upgrading from Older Release
|
|
|
|
Please make sure to uninstall any previous installations of CORE cleanly
|
2020-07-16 00:22:03 +01:00
|
|
|
before proceeding to install.
|
|
|
|
|
2021-11-16 20:52:31 +00:00
|
|
|
Clearing out a current install from 7.0.0+, making sure to provide options
|
|
|
|
used for install (`-l` or `-p`).
|
|
|
|
```shell
|
|
|
|
cd <CORE_REPO>
|
2022-01-11 19:06:06 +00:00
|
|
|
inv uninstall <options>
|
2021-11-16 20:52:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Previous install was built from source for CORE release older than 7.0.0:
|
2020-07-16 00:22:03 +01:00
|
|
|
```shell
|
2020-07-22 00:52:17 +01:00
|
|
|
cd <CORE_REPO>
|
2020-07-16 00:22:03 +01:00
|
|
|
sudo make uninstall
|
|
|
|
make clean
|
|
|
|
./bootstrap.sh clean
|
|
|
|
```
|
|
|
|
|
|
|
|
Installed from previously built packages:
|
|
|
|
```shell
|
|
|
|
# centos
|
|
|
|
sudo yum remove core
|
|
|
|
# ubuntu
|
|
|
|
sudo apt remove core
|
|
|
|
```
|
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
## Automated Install
|
2022-01-11 19:06:06 +00:00
|
|
|
First we will need to clone and navigate to the CORE repo.
|
|
|
|
```shell
|
|
|
|
# clone CORE repo
|
|
|
|
git clone https://github.com/coreemu/core.git
|
|
|
|
cd core
|
|
|
|
```
|
|
|
|
|
|
|
|
First you can use `setup.sh` as a convenience to install tooling for running invoke tasks:
|
|
|
|
|
|
|
|
> **NOTE:** `setup.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).
|
|
|
|
|
|
|
|
* python3, pip, venv
|
|
|
|
* pipx 0.16.4 via pip
|
|
|
|
* invoke 1.4.1 via pipx
|
|
|
|
* poetry 1.1.7 via pipx
|
|
|
|
|
|
|
|
Then you can run `inv install <options>`:
|
2020-09-12 00:26:13 +01:00
|
|
|
* installs system dependencies for building core
|
|
|
|
* installs core into poetry managed virtual environment or locally, if flag is passed
|
2022-01-11 19:06:06 +00:00
|
|
|
* installs scripts pointing to appropriate python location based on install type
|
2020-09-26 17:42:15 +01:00
|
|
|
* installs systemd service pointing to appropriate python location based on install type
|
2022-01-11 19:06:06 +00:00
|
|
|
* clone/build/install working version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr)
|
2020-04-10 05:42:04 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
> **NOTE:** installing locally comes with its own risks, it can result it potential
|
|
|
|
> dependency conflicts with system package manager installed python dependencies
|
2020-04-10 05:42:04 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
> **NOTE:** provide a prefix that will be found on path when running as sudo,
|
|
|
|
> if the default prefix /usr/local will not be valid
|
2020-07-16 00:22:03 +01:00
|
|
|
|
2020-04-10 05:42:04 +01:00
|
|
|
```shell
|
2022-01-11 19:06:06 +00:00
|
|
|
inv -h install
|
2021-04-16 05:46:55 +01:00
|
|
|
|
2022-01-11 19:06:06 +00:00
|
|
|
Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...]
|
|
|
|
|
|
|
|
Docstring:
|
|
|
|
install core, poetry, scripts, service, and ospf mdr
|
2020-07-14 18:42:24 +01:00
|
|
|
|
2022-01-11 19:06:06 +00:00
|
|
|
Options:
|
|
|
|
-d, --dev install development mode
|
|
|
|
-i STRING, --install-type=STRING used to force an install type, can be one of the following (redhat, debian)
|
|
|
|
-l, --local determines if core will install to local system, default is False
|
|
|
|
-o, --[no-]ospf disable ospf installation
|
|
|
|
-p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local
|
|
|
|
-v, --verbose enable verbose
|
2020-04-10 05:42:04 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
# install core to virtual environment
|
|
|
|
./install.sh -p <prefix>
|
2019-10-03 20:11:12 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
# install core locally
|
|
|
|
./install.sh -p <prefix> -l
|
|
|
|
```
|
2020-07-14 18:42:24 +01:00
|
|
|
|
2022-01-11 19:06:06 +00:00
|
|
|
After installation has completed you should be able to run `core-daemon` and `core-gui`.
|
|
|
|
|
|
|
|
## Using Invoke Tasks
|
|
|
|
The invoke tool installed by way of pipx provides conveniences for running
|
|
|
|
CORE tasks to help ensure usage of the create python virtual environment.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
inv --list
|
|
|
|
|
|
|
|
Available tasks:
|
|
|
|
|
|
|
|
install install core, poetry, scripts, service, and ospf mdr
|
|
|
|
install-emane install emane python bindings into the core virtual environment
|
|
|
|
reinstall run the uninstall task, get latest from specified branch, and run install task
|
|
|
|
test run core tests
|
|
|
|
test-emane run core emane tests
|
|
|
|
test-mock run core tests using mock to avoid running as sudo
|
|
|
|
uninstall uninstall core, scripts, service, virtual environment, and clean build directory
|
|
|
|
```
|
|
|
|
|
2021-05-12 04:52:10 +01:00
|
|
|
### Enabling Service
|
|
|
|
After installation, the core service is not enabled by default. If you desire to use the
|
|
|
|
service, run the following commands.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
sudo systemctl enable core-daemon
|
|
|
|
sudo systemctl start core-daemon
|
|
|
|
```
|
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
### Unsupported Linux Distribution
|
|
|
|
For unsupported OSs you could attempt to do the following to translate
|
|
|
|
an installation to your use case.
|
2019-06-10 21:15:34 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
* make sure you have python3.6+ with venv support
|
|
|
|
* make sure you have python3 invoke available to leverage `<repo>/tasks.py`
|
2020-07-15 08:08:22 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
```shell
|
|
|
|
# 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 <prefix> -i <install type>
|
|
|
|
```
|
2020-07-15 08:08:22 +01:00
|
|
|
|
2022-01-12 23:30:10 +00:00
|
|
|
## Dockerfile Install
|
|
|
|
You can leverage the provided Dockerfile, to run and launch CORE within a Docker container.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# clone core
|
|
|
|
git clone https://github.com/coreemu/core.git
|
|
|
|
cd core
|
|
|
|
# build image
|
|
|
|
sudo docker build -t core .
|
|
|
|
# start container
|
|
|
|
sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged core
|
|
|
|
# enable xhost access to the root user
|
|
|
|
xhost +local:root
|
|
|
|
# launch core-gui
|
|
|
|
sudo docker exec -it core core-gui
|
|
|
|
```
|
|
|
|
|
2020-07-16 00:22:03 +01:00
|
|
|
## 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
|
2020-08-08 06:04:34 +01:00
|
|
|
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.
|
2018-07-31 20:57:30 +01:00
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
For installations installed to a virtual environment:
|
2018-07-31 20:57:30 +01:00
|
|
|
```shell
|
2020-08-08 06:04:34 +01:00
|
|
|
core-python <script>
|
2018-07-31 20:57:30 +01:00
|
|
|
```
|
|
|
|
|
2020-09-26 17:42:15 +01:00
|
|
|
For local installations:
|
2020-09-12 00:26:13 +01:00
|
|
|
```shell
|
|
|
|
python3 <script>
|
|
|
|
```
|
|
|
|
|
|
|
|
## Installing EMANE
|
|
|
|
> **NOTE:** installng emane for the virtual environment is known to work for 1.21+
|
2018-07-31 20:57:30 +01:00
|
|
|
|
2021-11-17 23:55:05 +00:00
|
|
|
The recommended way to install EMANE is using prebuilt packages, otherwise
|
|
|
|
you can follow their instructions for installing from source. Installation
|
|
|
|
information can be found [here](https://github.com/adjacentlink/emane/wiki/Install).
|
2020-07-16 17:26:08 +01:00
|
|
|
|
2021-11-17 23:55:05 +00:00
|
|
|
There is an invoke task to help install the EMANE bindings into the CORE virtual
|
|
|
|
environment, when needed.
|
2018-10-18 18:56:41 +01:00
|
|
|
```shell
|
2020-07-22 00:52:17 +01:00
|
|
|
cd <CORE_REPO>
|
2020-07-16 17:26:08 +01:00
|
|
|
inv install-emane
|
2018-10-18 18:56:41 +01:00
|
|
|
```
|