Creating the Jamf Pro Database Using the Jamf Pro Server Tools Command-Line Interface

This article explains how to create the Jamf Pro database using the Jamf Pro Server Tools command-line interface (CLI). The Jamf Pro web application stores its data in the Jamf Pro database and requires credentials for a user that has full access to that database.

MySQL is the database subsystem used by Jamf Pro. MySQL can reside on the same server as Jamf Pro (i.e., a local instance), or MySQL can reside on a different server. The process described in this article assumes that MySQL and Jamf Pro are installed on the same server.
Note:
  • The Jamf Pro Server Tools CLI can still be used when Jamf Pro and MySQL are installed on different servers. However, it may be necessary to install the CLI on all servers. The appropriate settings will need to be set with the CLI on each server.

  • It is recommended that Jamf Pro be installed before the Jamf Pro database is created. The advantage is that the Jamf Pro Server Tools CLI is installed with the Jamf Pro installer. The CLI simplifies the process of creating the database as opposed to creating the database manually. In addition, while the Jamf Pro database can be created and configured before Jamf Pro is installed, the Jamf Pro-to-MySQL connection information cannot be configured until after Jamf Pro is installed.

Creating the Jamf Pro database and configuring the connection information involves the following steps:

  1. Verifying the Jamf Pro Server Tools CLI Version

  2. Creating the Jamf Pro Database and MySQL User Account

  3. Configuring MySQL

  4. Verifying Settings

  5. Restarting the Services

  6. Accessing Jamf Pro

Red Hat Enterprise Linux:

If any of the sudo jamf-pro ... commands provided below return a "command not found" error, make sure the CLI is accessible from the root path by executing the following command:
sudo ln -s /usr/local/bin/jamf-pro /bin/jamf-pro

Step 1: Verifying the Jamf Pro Server Tools CLI Version

  1. Check the version of the Jamf Pro Server Tools CLI installed on the system by executing the following command:
    jamf-pro --version
  2. Compare your version of the Jamf Pro Server Tools CLI with the latest version listed in the Changelog.
  3. If a newer version is available, follow the instructions in the The Jamf Pro Server Tools Command-Line Interface article to download and install the latest release.

Step 2: Creating the Jamf Pro Database and MySQL User Account

  1. Execute the following command from a terminal or command prompt:
    sudo jamf-pro database init
    Note:

    If you choose not to use sudo, the Jamf Pro Server Tools CLI may not be able to save the Jamf Pro-to-MySQL configuration information.

  2. When prompted, enter your MySQL root user password.
    Note:

    An option will appear to set the MySQL root user password. If you had previously used a temporary root password, you can set a new MySQL root password now. Press Enter to skip this option.

  3. Enter the name that you want to use for the Jamf Pro database (for example, "jamfpro").
  4. Enter the username of a MySQL account for Jamf Pro to use to access the database (for example, "jamfpro"). If you enter a new username, it will be created.
  5. Enter a new, strong user password for the MySQL account.
    Note:

    If you forget to enter the password, you can repeat the steps above. When you enter the old username, the password will be reset.

  6. A database connection test will run. You should see a message similar to the following:
    Testing database connection... connected to 'jamfpro' as 'jamfpro'
  7. When prompted, press "Y" if you want to save the database connection settings to the Jamf Pro configuration file (DataBase.xml).
  8. When prompted, press "Y" if you want to save the username and password to the Jamf Pro Server Tools CLI configuration file so the CLI can connect to the database in the future.

Step 3: Configuring MySQL

Configuration changes are made in the MySQL configuration file: my.cnf (Linux and macOS) or my.ini (Windows).

Requirements
Creating the my.cnf File on macOS
On macOS with MySQL 5.7.18 or later, the MySQL configuration file (my.cnf) does not get created by default. To determine if the my.cnf file can be found by the Jamf Pro Server Tools CLI, execute the following command:
sudo jamf-pro database config list
An error like the following indicates that the my.cnf file could not be found:
Error: MySQL config file not found in any of these locations:
  /etc
  /etc/mysql
  /usr/local/mysql
  /usr/local/mysql/etc
 Use 'jamf-pro config set --mysql-home "<path>"' to specify your custom installation folder
To provide a path to the my.cnf file (if it exists in a non-standard location), use the command suggested in the error message (where <path> is the path to the my.cnf file):
jamf-pro config set --mysql-home "<path>"
To create a my.cnf file, execute a command similar to the following using your preferred path:
sudo touch /etc/my.cnf

For a complete list of MySQL-supported paths, see the following webpage: https://dev.mysql.com/doc/refman/8.0/en/option-files.html

  1. Set the innodb_buffer_pool_size value to an appropriate size for your server by executing the following command:
    sudo jamf-pro database config set --innodb-buffer-pool-size <size>
    The <size> value is the total amount of memory that MySQL will use on the server. This should be approximately 70% of the server's total available memory. At a minimum, a value larger than the largest table size in the database is recommended. Table sizes will vary based on the number of enrolled devices and log flushing frequency. The value for this variable uses a single character to specify the unit of measure for the numeric value. Decimal values are not supported. For example:
    • "16G" is equal to 16 Gigabytes

    • "4096M" is equal to 4096 Megabytes or 4 Gigabytes.
      Note:

      Ensure that enough memory remains available for the operating system of the server. Different operating systems have different memory requirements.

  2. Set the innodb_file_per_table value to true by executing the following command:
    sudo jamf-pro database config set --innodb-file-per-table true

Step 4: Verifying Settings

  1. To view the complete list of saved Server Tools configuration settings, execute the following command:
    jamf-pro config list
  2. To view the complete list of saved Jamf Pro-to-MySQL connection settings, execute the following command:
    sudo jamf-pro server config list
  3. To view the complete list of saved MySQL database settings, execute the following command:
    sudo jamf-pro database config list

Step 5: Restarting the Services

  1. Stop Tomcat by executing the following command:
    sudo jamf-pro server stop
  2. Restart MySQL by executing the following command:
    sudo jamf-pro database restart
  3. Start Tomcat by executing the following command:
    sudo jamf-pro server start

Step 6: Accessing Jamf Pro

Access Jamf Pro by opening a web browser and typing the protocol, IP address or hostname of the server, and port. For example: https://jamfpro.mycompany.com:8443/