Linux Ubuntu

This section provides a step-by-step guide to installing Babel Licensing Service on Linux Ubuntu.

By following these instructions, you will be able to set up and configure the Babel Licensing Service on your Ubuntu system.

Prerequisites

To successfully install Babel Licensing Service on Linux Ubuntu LTS, you will need to ensure that the following prerequisites are met.

  1. Linux Ubuntu 22.04 LTS

  2. MariaDB v9.1 distrib 10.6 or later version

  3. .NET 7 ASP.NET runtime version 7 or the required version for Babel Licensing Service

  4. Babel Licensing Service ZIP package (babel_service_net70_10.0.0.zip)

  5. Babel Obfuscator Server or Data Center License file (babel.licenses)

Additionally, ensure you have the root password available during the installation process. This password is required to perform administrative tasks, such as installing files and configuring the system.

Here are the commands you can use to check the versions of the installed components on your Linux Ubuntu system.

To check the Ubuntu version

lsb_release -a

This command will display detailed information about your Ubuntu distribution, including the version number.

To check the MariaDB version

mariadb-admin --version

Running this command will provide you with the version information of the installed MariaDB server.

To check the .NET runtime versions

dotnet --list-runtimes

Executing this command will list the available .NET runtime versions installed on your system.

Install Script

The BabelLicensingService.sh Bash script is crafted to streamline the installation and configuration of the Babel Licensing Service on Ubuntu Linux environments as outlined in this section.

This script verifies prerequisites such as root privileges, the presence of required tools like MariaDB CLI command, and dotnet before commencing the installation procedure. It offers an intuitive interface, enabling users to effortlessly install and check the service status.

Throughout the installation, the script manages various tasks including unzipping the installation archive, transferring the license file, initializing the database, adjusting the appsettings.json for proper connection strings, and setting up the service with the right configurations.

To utilize the BabelLicensingService.sh script, adhere to the steps below:

  1. Download the script from the provided link.

  2. Move the downloaded script to a temporary directory (the user's home directory).

  3. Position the Babel service zip file (formatted as babel_service_net70_x.y.z.zip, where x.y.z represents the version) and the license file (babel.licenses) in the same temporary directory as the script.

  4. After completing the above steps, execute the following commands to initiate the installation process.

chmod +x ./BabelLicensingService.sh
sudo 

If you opt not to use the BabelLicensingService.sh script, you may proceed to the subsequent sections for detailed instructions on manual service setup.

Setup Files

To install the Babel Licensing Service, copy the ZIP file containing all the service assemblies and the license file to the home directory of the "babel" user (/home/babel). Assuming you are currently in the directory where the ZIP file is located, follow these steps:

  1. Open a terminal.

  2. Run the following command to copy the ZIP file to the desired location

cp babel_service_net70_10.0.0.zip /home/babel/
cp babel.licenses /home/babel/

Now, the ZIP file containing the Babel Licensing Service assemblies will be available in the home directory of the "babel" user (/home/babel). You can proceed with the installation and configuration of the Babel Licensing Service using the files in this directory.

Create the "svc/babel" folder under "/var/www" and extract the contents of the ZIP archive:

  1. In the terminal window, run the following command to create the "svc/babel" folder under "/var/www"

sudo mkdir -p /var/www/svc/babel

You will be prompted to enter your password, as "sudo" grants administrative privileges for creating directories under the system directory.

  1. Change the current working directory to the newly created "babel" folder:

cd /var/www/svc/babel
  1. Extract the contents of the ZIP archive into the current directory ("/var/www/svc/babel"):

sudo unzip /home/babel/babel_service_net70_10.0.0.zip

By following these steps, you will create the necessary folder structure and extract the contents of the ZIP archive into the "/var/www/svc/babel" directory. This will allow you to proceed with the installation and configuration of the Babel Licensing Service in the appropriate location.

License File

Copy the license file "babel.licenses" into the "/var/www/svc/babel" directory using the following command:

sudo cp /home/babel/babel.licenses /var/www/svc/babel/

Now, the license file "babel.licenses" is installed in "/var/www/svc/babel" directory, you can proceed with the configuration of the user that will run the Babel Licensing Service user.

Set Application Ownership

With the license file "babel.licenses" successfully installed in the "/var/www/svc/babel" directory, the next step is to configure the user that will run the Babel Licensing Service. In this case, we will set the user as "www-data."

To configure the user, execute the following command in the terminal:

sudo chown www-data:www-data -R /var/www/svc/babel

This command changes the ownership of the "/var/www/svc/babel" directory and its contents to the "www-data" user and group. By setting the correct ownership, you ensure that the Babel Licensing Service can be run by the appropriate user, allowing it to access and operate on the necessary files and directories.

Configure Babel Licensing Services

To configure the Babel Licensing Service and edit the appsettings.json file with the appropriate database connection settings and other application configurations, follow these steps:

  1. In a terminal window, use the following command to open the appsettings.json file in the Nano text editor

sudo nano /var/www/svc/babel/appsettings.json
  1. In the appsettings.json file, locate the "Database" section. Set the "Provider" value to "MySQL" to specify that you are using MySQL as the database provider

"Database": {
  "Provider": "MySQL"
},
  1. Find the "ConnectionStrings" section. Under the "MySQL" key, modify the connection string to match your MySQL server configuration. Update the server, User, Password, and Database values accordingly:

"ConnectionStrings": {
  "SQLServer": "",
  "MySQL": "Server=127.0.0.1;User=babel;Password=YourUniquePassword;Database=licenses",
  "SQLite": ""
},

Remember to replace "YourUniquePassword" with a strong password of your choice. It is highly recommended to use a combination of uppercase and lowercase letters, numbers, and special characters to create a secure password. Keep the password for later use during the database configuration.

  1. Optionally, you can customize other application settings. For example, under the "Serilog" section, you can configure logging settings and adjust the minimum log level:

"Serilog": {
  "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
  "MinimumLevel": {
    "Default": "Information",
    "Override": {
      "Microsoft": "Debug",
      "System": "Debug",
      "Grpc": "Debug"
    }
  },
  ...
},

It might be useful for debugging installation issues to set the minimum log level to Debug. When the service is running, we can revert the log level to Information or Warning.

  1. Further down, under the "Application" section, you can specify the "LicenseFile" (babel.licenses) and customize the "SigningKey" and "TokenExpiration" values according to your requirements:

"Application": {
  "LicenseFile": "babel.licenses",
  "SigningKey": "Secret Token Key",
  "TokenExpiration": "00:30:00"
},

Replace the Secret Token Key with your unique key. This will we used to secure the communication between application clients and the Babel Licensing Service.

  1. To save the changes and exit Nano, press Ctrl + X, then press Y to confirm the changes, and finally, press Enter to save the file.

By following these steps, you will have successfully configured the Babel Service by editing the appsettings.json file. The updated configuration will include the correct database connection settings and any other customizations you have made.

To learn more about the Babel Licensing Service configuration file, please refer to the Configuration paragraph.

Create Database

We need to create the "licenses" database configured in the connection string we set for Babel Licensing Service. Then create the "babel" user, grant privileges to the database, and verify the user's permissions.

  1. Open a terminal.

  2. Log in to the MariaDB console as the root user using the following command:

sudo mariadb -u root -p

You will be prompted to enter the root password.

  1. Once you are logged in to the MariaDB console, you can list all existing databases by running the command:

SHOW DATABASES;
  1. To list all existing users, execute the following query:

SELECT User FROM mysql.user;
  1. Create the "licenses" database using the command:

CREATE DATABASE licenses;
  1. Create the "babel" user and grant all privileges to the "licenses" database by executing the following commands:

CREATE USER babel@localhost IDENTIFIED BY 'YourUniquePassword';
GRANT ALL PRIVILEGES ON licenses.* TO babel@localhost;
FLUSH PRIVILEGES;

Replace 'YourUniquePassword' with the password you set for the Babel Licensing Service MySQL connection string.

  1. To verify that the "babel" user has the appropriate permissions, you can use the following statement:

SHOW GRANTS FOR babel@localhost;

You can now exit the MariaDB console by typing the command quit then ENTER.

By following these steps, you will have successfully created the "licenses" database, created the "babel" user, granted privileges to the database, and verified the user's permissions.

Start Babel Licensing Service

To start the Babel Licensing Service, follow these steps:

  1. Open a terminal.

  2. Navigate to the directory where the Babel Licensing Service is located. For example:

cd /var/www/svc/babel
  1. Run the following command to start the Babel Licensing Service:

dotnet Babel.Licensing.Service.dll

If everything is configured correctly, you will see the service starting up. The terminal log will display information about the service initialization, including the creation of tables in the database, depending on the log level you choose in the appsettings.json file.

Keep an eye on the terminal log for any errors or warnings. If there are any issues, make sure to review the configuration, database connection settings, and permissions to ensure they are set up correctly.

If the Babel Licensing Service starts successfully, it will be ready to handle licensing operations and provide licensing services to your applications.

It is recommended to run the Babel Licensing Service as a background process or set up a service manager to ensure it continues running even after closing the terminal.

Configure As Background Process

In Linux, service files, also known as service unit files, are configuration files with a ".service" extension that are used to control the behaviour of daemons or services. These files define various settings and parameters related to the service, such as its name, description, execution command, working directory, environment variables, and more.

To configure the Babel Licensing Service as a system service in Linux, follow these steps:

  1. Open a terminal.

  2. Run the following command to create and edit the service file:

sudo nano /etc/systemd/system/babel.licensing.service
  1. Paste the following configuration into the file:

[Unit]
Description=Babel Licensing Service

[Service]
WorkingDirectory=/var/www/svc/babel/
ExecStart=/usr/bin/dotnet /var/www/svc/babel/Babel.Licensing.Service.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=babel-licensing-svc
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target
  1. Save the file by pressing Ctrl+O, then exit the editor by pressing Ctrl+X.

  2. Start the Babel Licensing Service by running the following command:

sudo systemctl start babel.licensing
  1. To check the status of the service, use the following command:

systemctl status babel.licensing

This command will display the current status of the service, including any error messages or warnings:

● babel.service - Babel Licensing Service
     Loaded: loaded (/etc/systemd/system/babel.licensing.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-05-19 09:24:53 UTC; 1s ago
   Main PID: 2710499 (dotnet)
      Tasks: 17 (limit: 4392)
     Memory: 28.0M
        CPU: 903ms
     CGroup: /system.slice/babel.licensing
             └─2710499 /usr/bin/dotnet /var/www/svc/babel/Babel.Licensing.Service.dll

May 19 09:24:57 babel-licensing-svc[2710499]: [09:24:57 DBG] Hosting started
  1. By default, the service is not set to start automatically when the server is started. To enable the service to start automatically, run the following command:

sudo systemctl enable babel.licensing

Enabling the service ensures that it will start automatically after the server is rebooted.

With these steps, you have configured the Babel Licensing Service as a systemd service in Linux. The service will start automatically upon system boot and can be managed using the systemctl command.

Last updated