CGRateS can be installed either via packages or through an automated Go source installation. We recommend the latter for advanced users familiar with Go programming, and package installations for those not wanting to engage in the code building process.

After completing the installation, you need to perform the post-install configuration steps to set up CGRateS properly and prepare it to run. After these steps, CGRateS will be configured in /etc/cgrates/cgrates.json and the service can be managed using the systemctl command.

Package Installation

Package installation method varies according to the Linux distribution:

Debian or Debian-based Distributions

You can add the CGRateS repository to your system’s sources list, depending of the Debian version you are running, as follows:

# Install dependencies
sudo apt-get install wget gnupg -y

# Download and move the GPG Key to the trusted area
wget -O
sudo mv /etc/apt/trusted.gpg.d/

# Add the repository to the apt sources list
echo "deb master-bookworm main" | sudo tee /etc/apt/sources.list.d/cgrates.list

# Update the system repository and install CGRateS
sudo apt-get update -y
sudo apt-get install cgrates -y

Alternatively, you can manually install a specific .deb package as follows:

sudo dpkg -i ./cgrates_current_amd64.deb


A complete archive of CGRateS packages is available at

Redhat-based Distributions

For .rpm distros, we are using copr to manage the CGRateS packages:

  • If using a version of Linux with dnf:

    # sudo yum install -y dnf-plugins-core on RHEL 8 or CentOS Stream
    sudo dnf install -y dnf-plugins-core
    sudo dnf copr -y enable cgrates/master
    sudo dnf install -y cgrates
  • For older distributions:

    sudo yum install -y yum-plugin-copr
    sudo yum copr -y enable cgrates/master
    sudo yum install -y cgrates

To install a specific version of the package, run:

sudo dnf install -y cgrates-<version>.x86_64

Alternatively, you can manually install a specific .rpm package as follows:

sudo dnf install ./cgrates_current.rpm


The entire archive of CGRateS rpm packages is available at or

Installing from Source


  • Git

sudo apt-get install -y git
# sudo dnf install -y git for .rpm distros

To install the latest Go version at the time of writing this documentation, run:

sudo apt-get install -y wget tar
# sudo dnf install -y wget tar for .rpm distros
sudo rm -rf /usr/local/go
cd /tmp
sudo tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin


mkdir -p $HOME/go/src/
git clone $HOME/go/src/
cd $HOME/go/src/

# Compile the binaries and move them to $GOPATH/bin

# Create a symbolic link to the data folder
sudo ln -s $HOME/go/src/ /usr/share/cgrates

# Make cgr-engine binary available system-wide
sudo ln -s $HOME/go/bin/cgr-engine /usr/bin/cgr-engine

# Optional: Additional useful symbolic links
sudo ln -s $HOME/go/bin/cgr-loader /usr/bin/cgr-loader
sudo ln -s $HOME/go/bin/cgr-migrator /usr/bin/cgr-migrator
sudo ln -s $HOME/go/bin/cgr-console /usr/bin/cgr-console
sudo ln -s $HOME/go/bin/cgr-tester /usr/bin/cgr-tester

Creating Your Own Packages

After compiling the source code, you may choose to create your own packages.

For Debian-based distros:

# Install dependencies
sudo apt-get install build-essential fakeroot dh-systemd -y

cd $HOME/go/src/

# Delete old ones, if any
rm -rf $HOME/go/src/*.deb

make deb


You might see some console warnings, which can be safely ignored.

To install the generated package, run:

cd $HOME/go/src/
sudo dpkg -i cgrates_*.deb

For Redhat-based distros:

sudo dnf install -y rpm-build wget curl tar

# Create build directories

# Fetch source code
cd $HOME/go/src/
export gitLastCommit=$(git rev-parse HEAD)
export rpmTag=$(git log -1 --format=%ci | date +%Y%m%d%H%M%S)+$(git rev-parse --short HEAD)

#Create the tarball from the source code
cd ..
tar -czvf  $HOME/rpmbuild/SOURCES/$gitLastCommit.tar.gz cgrates

# Copy RPM spec file
cp $HOME/go/src/ $HOME/rpmbuild/SPECS

# Build RPM package
cd $HOME/rpmbuild
rpmbuild -bb  SPECS/cgrates.spec

Post-install Configuration

Database Setup

CGRateS supports multiple database types for various operations, based on your installation and configuration.

Currently, we support the following databases:


This can be used as DataDB. It is optimized for real-time information access. Post-installation, no additional setup is required as Redis doesn’t require a specific schema.


This can be used as StorDB and is optimized for CDR archiving and offline Tariff Plan versioning. Post-installation, you need to set up the CGRateS database using the provided scripts:

cd /usr/share/cgrates/storage/mysql/
sudo ./ root localhost

Like MySQL, PostgreSQL can be used as StorDB. Post-installation, you need to set up the CGRateS database using the provided scripts:

cd /usr/share/cgrates/storage/postgres/

MongoDB can be used as both DataDB and StorDB. This is the first database that can store all types of data from CGRateS - from accounts, tariff plans to CDRs and logs. Post-installation, you need to set up the CGRateS database using the provided scripts:

cd /usr/share/cgrates/storage/mongo/

Set Versions Data

After completing the database setup, you need to write the versions data. To do this, run the migrator tool with the parameters specific to your database.

Sample usage for MySQL:

cgr-migrator -stordb_passwd="" -exec="*set_versions"