Commit ac505581 authored by garciadeblas's avatar garciadeblas
Browse files

Merge branch 'osmclient-how-to-install' into 'master'

Update osmclient doc: how to install in ubuntu, rhel and for developers

See merge request !101
parents 0d055055 09ee2cd0
Loading
Loading
Loading
Loading
+107 −37
Original line number Diff line number Diff line
@@ -142,64 +142,134 @@ Commands:
  wim-update                 updates a WIM account
```

## Installing standalone OSM Client
## How to install standalone OSM client

OSM client is installed by default in the host where OSM is installed, but it can be also installed as a standalone client.
### How to install OSM Client in Ubuntu 20.04 (RECOMMENDED)

### Installing with debian package

In order to install the OSM Client in your local Linux machine, you should follow this procedure:
OSM client is installed by default in the host where OSM is installed, but it can be also installed as a standalone client in an Ubuntu 20.04 system, following the procedure below:

```bash
# Clean the previous repos that might exist
sudo sed -i "/osm-download.etsi.org/d" /etc/apt/sources.list
wget -qO - https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add -

# Install dependencies
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https
sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip

# Add OSM debian repo
curl -q -o OSM-ETSI-Release-key.gpg https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE/OSM%20ETSI%20Release%20Key.gpg
sudo apt-key add OSM-ETSI-Release-key.gpg
sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE stable devops IM osmclient"
sudo apt-get update
sudo apt-get install -y python3-pip
sudo -H python3 -m pip install -U pip
sudo -H python3 -m pip install python-magic pyangbind verboselogs
sudo apt-get install python3-osmclient

# Install OSM IM and osmclient packages from deb repo
sudo apt-get install python3-osm-im python3-osmclient

# Install osmclient and osm_im dependencies via pip
sudo -H python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt -r /usr/lib/python3/dist-packages/osmclient/requirements.txt

# Install charm to be able to build OSM packages with charms
sudo snap install charm --classic
```

### Installing from git repo
### How to install OSM Client in Ubuntu 20.04 via pip (ALTERNATIVE)

```bash
# Ubuntu 18.04 pre-requirements
sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev
# CentOS pre-requirements
# sudo yum install python3-pip libcurl-devel gnutls-devel
sudo -H python3 -m pip install python-magic
# Install OSM Information model
sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade
# Install OSM client from the git repo.
# You can install the latest client from master branch in this way:
sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient
# You could also install a specific tag/version in this way
sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v8.0.0rc1
# Install dependencies
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https
sudo apt-get install -y git wget make
sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip

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

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

# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users)
sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}"
sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade

# 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
sudo -H python3 -m pip install -r osmclient/requirements.txt
sudo -H python3 -m pip install ./osmclient

# Install charm to be able to build OSM packages with charms
sudo snap install charm --classic
```

### Installing from cloned repo (for developers)
### How to install OSM Client in RHEL 8.4

```bash
# Ubuntu 18.04 pre-requirements
sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev
# Centos pre-requirements
# sudo yum install python3-pip libcurl-devel gnutls-devel
sudo -H python3 -m pip install python-magic pyangbind verboselogs
# Install OSM Information model
sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade
# Clone the osmclient repo and install OSM client from the git repo.
# Install dependencies
sudo dnf upgrade -y
sudo dnf install -y libcurl-devel openssl-devel
sudo dnf install -y git wget make patch gcc
sudo dnf install -y python38 python38-devel

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

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

# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users)
sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}"
sudo -H bash -c "PATH=$PATH:/usr/local/bin python3 -m pip install \"git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im\" --upgrade"

# Clone osmclient repo and checkut the desired version
git clone https://osm.etsi.org/gerrit/osm/osmclient
cd osmclient
python3 -m pip install --user -e .
# logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin
git -C osmclient checkout ${OSM_CLIENT_VERSION}

# Install osmclient using pip
sudo -H python3 -m pip install -r osmclient/requirements.txt
sudo -H python3 -m pip install ./osmclient

# Install charm to be able to build OSM packages with charms
wget -O charm.sh "https://osm.etsi.org/gitweb/?p=osm/tests.git;a=blob;f=charm.sh;hb=${OSM_CLIENT_VERSION}"
sudo cp charm.sh /usr/sbin/charm
sudo chmod 755 /usr/sbin/charm

```

To uninstall, just:
### How to install OSM Client for developers in Ubuntu 20.04

```bash
python3 -m pip uninstall osmclient
# Install dependencies
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https
sudo apt-get install -y git wget make
sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip

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

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

# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users)
sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}"
sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade

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

# Install osmclient directly from the repo for development purposes
python3 -m pip install --user -e osmclient -r osmclient/requirements.txt -r osmclient/requirements-dev.txt

# Install charm to be able to build OSM packages with charm
sudo snap install charm --classic

# Logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin
which osm
```

## Getting help