linux

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!-- Tab options on this page. Append to the .md URL to filter: ?tabs=<id,...> select specific tabs (e.g. ?tabs=nodejs,shell) ?allTabs=true include every tab (no param) default: one tab per tabset

Available tabs: other tabs: arm-arch, amd-arch, linux_macos, windows, windows-2 -->

Install or Uninstall mongot on Linux

You can install the MongoDB Search and MongoDB Vector Search process, mongot, in MongoDB Community Edition. The mongot process is available for deployment for all Linux distributions such as Red Hat, Ubuntu, Debian, SUSE, and Amazon Linux as a tarball with the .tgz extension.

Note:

To onboard quickly with a deployment for experimentation, see the following tutorials for Self-Managed deployments:

  • [Local Development Quickstart](https://www.mongodb.com/docs/search/self-managed/current/installation/quick-start.md#std-label-mongot-deployment-using-atlas-local

  • [MongoDB Search Quick Start](https://www.mongodb.com/docs/search/tutorial.md#std-label-fts-tutorial-ref

  • [MongoDB Vector Search Quick Start](https://www.mongodb.com/docs/vector-search/tutorials/quick-start.md#std-label-vector-search-quick-start

Before You Begin

To install mongot in a self-managed deployment, you must have the following prerequisites:

  • MongoDB Community Edition v8.3 or later.

See [Install MongoDB Community Edition](https://www.mongodb.com/docs/manual/administration/install-community.md#std-label-install-mdb-community-edition for installation tutorials.

Note:

You must have MongoDB 8.3 or later to run MongoDB Search and MongoDB Vector Search process, whether you use a standalone self-managed deployment or deploy with the MongoDB Controllers for Kubernetes Operator. For more information, see [Compatibility and Requirements for mongot.](https://www.mongodb.com/docs/search/self-managed/current/deployment/compatibility-requirements.md#std-label-mongot-compatibility-requirements

  • An initiated replica set with keyfile access control.

Procedure

  1. Download the mongot tarball.

Download the latest Search in Community tarball for your system architecture from the MongoDB Search in Community Download Center.

To download a specific version from the command line, replace {VERSION_NUMBER} with the version of mongot that you want and run the command for your system architecture:

### ARM Architectures

shell wget https://downloads.mongodb.org/mongodb-search-community/{VERSION_NUMBER}/mongot_community_{VERSION_NUMBER}_linux_aarch64.tgz

  1. (Optional). Verify the integrity of the tarball package.

See [Verify Integrity of mongot Packages](https://www.mongodb.com/docs/search/self-managed/current/deployment/verify-mongot-packages.md#std-label-verify-integrity-mongot-packages for more information.

  1. Extract the mongot tarball.

Replace {VERSION_NUMBER} with the version of mongot that you downloaded and run the command for your system architecture to extract the tarball:

### ARM Architectures

shell tar -zxvf mongot_community_{VERSION_NUMBER}_linux_aarch64.tgz

Note:

If your web browser automatically unzips the file as part of the download, the file extension is .tar.

The tarball contains a sample configuration file, the mongot launcher script, and MongoDB Search and Vector Search license information.

  1. Configure mongod to communicate with mongot.

If you have an existing replica set that you want to use, configure the following mongod parameters to route Search and MongoDB Vector Search queries and manage indexes.

Parameter Description
searchIndexManagementHostAndPort The host address of mongot.
mongotHost The host address of mongot. You must specify the same address in searchIndexManagementHostAndPort and mongotHost.
skipAuthenticationToSearchIndexManagementServer Specifies whether authentication is enabled for the Search Index Management Server
useGrpcForSearch Specifies whether GRPC is enabled for MongoDB Search

For example, you can add the following lines to your mongod config file and then restart mongod:

javascript setParameter: searchIndexManagementHostAndPort: localhost:27028 mongotHost: localhost:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: true

See [MongoDB Server Parameters for a Self-Managed Deployment](https://www.mongodb.com/docs/manual/reference/parameters.md#std-label-server-parameters for more information on setting mongod parameters. For detailed information about search-specific setParameter options, see [MongoDB Search Options.](https://www.mongodb.com/docs/manual/reference/configuration-options.md#std-label-set-parameter-search-options

Note:

The mongotHost, searchIndexManagementHostAndPort, and useGrpcForSearch parameters are set only at startup. You can't change them at runtime with setParameter. To point mongod at a different mongot instance, update these parameters in the mongod configuration file and restart mongod.

If you want to deploy a new replica set with keyfile authentication, follow the steps in [Deploy Self-Managed Replica Set With Keyfile Authentication.](https://www.mongodb.com/docs/manual/tutorial/deploy-replica-set-with-keyfile-access-control.md#std-label-deploy-repl-set-with-keyfile

  1. Create a user for the mongot process on your MongoDB deployment.

mongot must be able to connect to your MongoDB deployment through a user with the [searchCoordinator](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-authrole-searchCoordinator role.

Connect to mongosh as the admin user.

shell mongosh --port 27017 -u <your_admin_username> -p <your_admin_password>

Connect to the admin database.

Run the following command to connect to the admin database:

shell use admin

Create your mongot user.

To create a user with the searchCoordinator role:

  • Replace <mongot-username> with a username for your mongot user

  • Replace <mongot-password> with the password that you specify in your passwordFile in the next step

  • Run the following command:

shell db.createUser( { user: <mongot-username>, pwd: <mongot-password>, roles: [ "searchCoordinator"] } )

  1. Create your password file.

Create a password file for mongot to connect to mongod.

For example, select your operating system and replace <mongot-password> with your password. Then, run the following command to create a file called passwordFile:

### Linux/MacOS

shell echo -n "<mongot-password>" > passwordFile chmod 400 passwordFile

Note:

The -n flag prevents a trailing newline.

  1. Specify your mongot configuration options.

You can configure mongot with a YAML configuration file. Use the included sample configuration file named config.default.yml or a new configuration file to define the configuration. For more information on mongot configuration options, see [mongot Options.](https://www.mongodb.com/docs/manual/reference/configuration-options.md#std-label-mongot-configuration-options

The tarball contains the following sample configuration file, config.default.yml, with the default mongot settings. You can modify the settings for your deployment:

Warning:

Depending on your system topology, it may be necessary to bind the mongot query server to an interface reachable from your MongoDB Cluster. While binding to the 0.0.0.0 IP address is permitted, it exposes the server to all public networks and carries the risk of unauthorized access.

To enhance security, consider restricting server.grpc.address to specific interfaces that are controlled and protected at the network layer such as localhost or other trusted internal addresses.

bash syncSource: replicaSet: hostAndPort: "localhost:27017" # Replace with the mongod host and port. scramAuth: username: mongotUser # Replace with mongod username enabled with "searchCoordinator" role. authSource: admin # Replace with the database to authenticate the user against. passwordFile: "/etc/mongot/secrets/passwordFile" # Replace with path to password file for the above user. tls: enabled: false storage: dataPath: "/var/lib/mongot" # Replace with the path where you want mongot to store search data. server: grpc: address: "localhost:27028" # Replace with the address and port for mongot listen server tls: mode: "disabled" metrics: enabled: true address: "localhost:9946" healthCheck: address: "localhost:8080" logging: verbosity: INFO

Note:

The dataPath directory in your configuration file must be writable by the user that runs mongot.

The sample configuration uses SCRAM authentication with the scramAuth block. You must configure exactly one authentication mechanism for the sync source: either SCRAM or X.509. To authenticate with a TLS client certificate instead of a username and password, use the x509 block. For both mechanisms, including the sharded-cluster syncSource.router configuration, see [Configure Authentication and Authorization for mongot.](https://www.mongodb.com/docs/search/self-managed/current/security/authentication-and-authorization.md#std-label-mongot-auth

This sample runs mongot and mongod on the same host, so it binds server.grpc.address to localhost and disables TLS. If you run mongot and mongod on separate hosts, complete the following steps instead:

  • Bind server.grpc.address to a network interface that mongod can reach, rather than localhost.

  • Set the mongod mongotHost and searchIndexManagementHostAndPort parameters to that address.

  • Enable TLS for the sync source and gRPC connections. Running without TLS is only appropriate when mongot and mongod run on the same host. To configure TLS, see [Configure TLS Encryption for mongot.](https://www.mongodb.com/docs/search/self-managed/current/security/tls-encryption.md#std-label-mongot-tls-encryption

Use [logging.logPath](https://www.mongodb.com/docs/search/self-managed/current/configuration/reference.md#mongodb-setting-logging.logPath to specify the path of the log file that mongot writes to. If you do not specify a log file path, mongot logs to standard output.

  1. Start the mongot process.

Run the mongot launcher script that you downloaded with the tarball. The script is in the mongot-community folder.

Change to the mongot-community folder:

bash cd <path-to-mongot>

To start mongot with the sample config file, issue the following command:

bash ./mongot --config config.default.yml

  1. Verify the health of the mongot process.

To verify, send a request by using a HTTP (HyperText Transport Protocol) client or curl to the /health endpoint. For example, send a curl request similar to the following sample request:

shell curl localhost:8080/health

The endpoint returns one of the following in the response:

  • SERVING, if the mongot process is running

    mongot might not serve queries as it doesn't check the status of the indexes, which must be in Ready state to serve queries.

  • NOT_SERVING, if the mongot process isn't running

For additional details, see [Verify Your mongot Connection.](https://www.mongodb.com/docs/search/self-managed/current/connection/verify-connection.md#std-label-mongot-verify-connection

To remove MongoDB Search and MongoDB Vector Search from a system, you must remove mongot, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.

  1. Drop the mongotUser user

To drop the mongotUser user, run the following commands:

javascript use admin db.dropUser("mongotUser")

For details, see [db.dropUser().](https://www.mongodb.com/docs/manual/reference/method/db.dropUser.md#mongodb-method-db.dropUser

  1. Stop the mongot

To stop the mongot binary, use Ctrl + C in the terminal session it's running in.

  1. Remove any configuration files

To remove the mongot and mongod configuration files, run the following commands as root or with sudo by using the full path to your configuration files:

bash sudo rm /path/to/config.default.yml sudo rm /path/to/mongod.conf

  1. Remove the keyfile and password file

To remove the keyfile and password file, run the following commands using the full path to the keyfile and the password file:

bash rm /path/to/keyfile rm /path/to/passwordFile

  1. Remove any logs and the log directory for mongot

To remove the logs and log directory for mongot, run the following command using the full path to the log directory you specified in [logging.logPath:](https://www.mongodb.com/docs/search/self-managed/current/configuration/reference.md#mongodb-setting-logging.logPath

bash rm -rf /path/to/mongot-logs

  1. Remove the data directory for mongot

To remove the data directory that stores mongot data, run the following command using the full path to your mongot data directory:

bash rm /path/to/mongot/data

Next Steps

  • Create [MongoDB Search indexes](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-fts-about-indexing

  • Create [MongoDB Vector Search indexes](https://www.mongodb.com/docs/vector-search/indexes/vector-search-type.md#std-label-avs-types-vector-search