NVM
Prerequisites
Before starting the installation of Evolution API v2, ensure that you have already configured the necessary services, such as PostgreSQL and Redis. Follow the links below for more details:
NVM Installation
Evolution API can be easily installed using Node Version Manager (NVM). Follow these steps to set up your environment and start the Evolution API on your server.
Install NVM
First, download and install Node.js with the following commands:
Now, load the environment and install Node.js:
Confirm that NVM was successfully installed:
If you haven’t set it up yet, you can also configure your server’s timezone with the command:
Cloning the Repository and Installing Dependencies
Clone the official Evolution API v2 repository from the correct branch:
Navigate to the project directory and install the dependencies:
Environment Variables Configuration
Now let’s configure the environment variables. First, copy the .env.example
file to .env
:
Edit the .env
file with your specific settings:
Replace the default values with your configurations, such as database connection strings, API keys, server ports, etc.
Visit the environment variables section for detailed instructions on how to configure your .env
file.
Database Generation and Deployment
After setting up the environment, you will need to generate the Prisma client files and deploy the migrations to the database. Use the following commands, depending on the database you are using (PostgreSQL or MySQL):
-
Generate the Prisma client files:
-
Deploy the migrations:
Starting the Evolution API
After configuration, you can start the Evolution API with the following command:
PM2 Installation and Configuration
Use PM2 to manage the API process:
If your server has more memory, consider configuring PM2 to utilize more resources:
This is recommended for servers with at least 4GB of RAM exclusively available for the Evolution API.
To verify that the API is running, visit http://localhost:8080. You should see the following response:
Make your life easier with the JSON Formatter extension on Google Chrome or Microsoft Edge.