From 63c6129a72a056dcdbf487bbd4c019c1dad4093d Mon Sep 17 00:00:00 2001 From: Vasilios Tzanoudakis Date: Thu, 5 Jul 2018 16:09:40 +0300 Subject: [PATCH] DOCS : How to install GO Lang and proper paths for building CGRateS from Source / Add Section to Create Debian Style Packages from Sources --- docs/installation.rst | 53 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index cb3efb53c..cf19ec5ce 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -8,7 +8,7 @@ We recommend using source installs for advanced users familiar with Go programmi ------------------- 3.1.1. Debian -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~ This is for the moment the only packaged and the most recommended to use method to install CGRateS. @@ -16,8 +16,8 @@ On the server you want to install CGRateS, simply execute the following commands :: - wget http://www.cgrates.org/tmp_pkg/cgrates_0.9.1~rc8_amd64.deb - dpkg -i cgrates_0.9.1~rc8_amd64.deb + wget http://www.cgrates.org/tmp_pkg/cgrates_0.9.1~rc8_amd64.deb + dpkg -i cgrates_0.9.1~rc8_amd64.deb Once the installation is completed, one should perform the :ref:`post-install` section in order to have the CGRateS properly set and ready to run. After *post-install* actions are performed, CGRateS will be configured in **/etc/cgrates/cgrates.json** and enabled in **/etc/default/cgrates**. @@ -28,6 +28,24 @@ After *post-install* actions are performed, CGRateS will be configured in **/etc For developing CGRateS and switching between its versions, we are using the **new vendor directory feature** introduced in go 1.6. In a nutshell all the dependencies are installed and used from a folder named *vendor* placed in the root of the project. +3.2.1 Install GO Lang +~~~~~~~~~~~~~~~~~~~~~ + +First we have to setup the GO Lang to our OS. Feel free to download +the latest GO binary release from https://golang.org/dl/ +In this Tutorial we are going to install Go 1.10.3. + +:: + + cd $HOME && mkdir -p src/go opt && cd src + wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz + tar -xvf go1.10.3.linux-amd64.tar.gz -C $HOME/opt + export GOPATH=$HOME/src/go + export PATH=$PATH:$HOME/opt/go/bin:$GOPATH/bin + +3.2.2 Build CGRateS from Source +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + To manage this *vendor* folder we use a tool named `glide`_ which will download specific versions of the external packages used by CGRateS. To configure the project with `glide`_ use the following commands: @@ -52,6 +70,35 @@ For more information and command options use `glide`_ readme page. .. _post-install: +3.2.3 Create Debian / Ubuntu Packages from Source +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After compiling the source code you are ready to create the .deb packages +for your Debian like OS. But First lets install some dependencies. + +:: + + sudo apt-get install build-essential fakeroot dh-systemd + +Finally we are ready to create the system package. Before creation we make +sure that we delete the old one first. + +:: + + cd $GOPATH/src/github.com/cgrates/cgrates/packages + rm -rf $GOPATH/src/github.com/cgrates/*.deb + make deb + +After some time and maybe some console warnings, your CGRateS package will be ready. + +3.2.4 Install Custom Debian / Ubuntu Package +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + cd $GOPATH/src/github.com/cgrates + sudo dpkg -i cgrates_*.deb + 3.3. Post-install -----------------