Commit 6acd5100 authored by garciadeblas's avatar garciadeblas
Browse files

Merge branch 'osmclient-windows' into 'master'

Add how-to for OSM client installation on Windows

See merge request !105
parents 0c3f3422 43d9e300
Loading
Loading
Loading
Loading
+79 −0
Original line number Diff line number Diff line
@@ -272,6 +272,85 @@ sudo snap install charm --classic
which osm
```

### How to install OSM Client in Windows with WSL

OSM client can be easily installed in Windows by installing an Ubuntu distro on Linux with [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install).

Once WSL is installed with an Ubuntu 20.04 distro, you can install OSM following the instruccions in (#how-to-install-osm-client-in-ubuntu-2004)

### How to install OSM Client directly in Windows with Conda and Git

OSM can also be installed in Windows with [Miniconda](https://docs.conda.io/en/latest/miniconda.html) and [Git](https://git-scm.com/)

You can install both programs with [Chocolatey](https://chocolatey.org/), the package manager for Windows. Open a CMD window and run the following commands:

```cmd
choco install -y git make wget
choco install -y miniconda3
```

Then, open Windows environment variables > User environment variables, and add the following entries to the `Path` user environment variable in order to make Conda executables reachable from all terminals:

- `C:\tools\miniconda3`
- `C:\tools\miniconda3\Scripts`
- `C:\tools\miniconda3\Library\bin`

Make sure that aliases for Python are disabled in Windows Configuration. Go to Settings > Apps > Apps & features, and click on "Manage app execution aliases". Then disable aliases for Python.

Open Git Bash and run the following commands to create a Conda environment with Python 3.8 and initialize all shells to work with Conda:

```bash
conda create -n osm-env python=3.8
conda init --all
# Logout
```

Then install OSM client as follows:

```bash
# Install conda and install some packages via conda (which will install dependent libraries)
conda activate osm-env
conda install pycurl==7.45.1

# Upgrade pip to the latest version (with sudo, to install it globally for all users)
python -m pip install -U pip

# Decide which version to use (e.g., v12.0)
export OSM_CLIENT_VERSION=v12.0

# Clone IM repo and checkut the desired version
git clone https://osm.etsi.org/gerrit/osm/IM
git -C IM checkout ${OSM_CLIENT_VERSION}

# Install OSM IM using pip
python -m pip install -r IM/requirements.txt
# make -C IM clean
python -m pip install ./IM

# Clone osmclient repo and checkut the desired version
git clone https://osm.etsi.org/gerrit/osm/osmclient
git -C osmclient checkout ${OSM_CLIENT_VERSION}

# Install osmclient using pip
python -m pip install -r osmclient/requirements.txt
# Required DLLs for python-magic
python -m pip install python-magic-bin
python -m pip install ./osmclient

# Try OSM client
python -m osmclient.scripts.osm
# Logout from Git Bash
```

Open Git Bash again and edit `.bash_profile` to activate the Conda environment persistently. If desired, add an alias to osm executable:

```bash
conda activate osm-env
alias 'osm=python -m osmclient.scripts.osm'
```

That will complete OSM client installation for Windows.

## Getting help

Options `-h` or `--help`can be used globally to know the global options and commands, or after a command to know the specific options and args of a command