Installing WSO2 API Manager on CentOS

WSO2 API Manager is an Open Source-based API Gateway that allows the development teams to deploy and monitor APIs and as well provides a facility for the consumers to subscribe to APIs and consume to meet their needs. Why would someone need an API Manager?  Well, that’s a good question. Imagine an organization exposing its core processes, data, and services as APIs to the public, and the external agencies or parties can consume these APIs to build their applications. This way the business can improve its growth potentials through its APIs. But what if the businesses have too many APIs exposed to the public? How will they manage those, the security, performance, logging, monitoring, analytics, policies, etc…API Gateways are meant to do that and WSO2 API-M is one of the popular products in that domain. The API Manager facilitates complete API governance; API creation, publishing, life cycle management, versioning, security, load balancing and failover management, monetization, and analytics. Well, in this tutorial we will be Installing WSO2 API Manager 4.0.0 and on CentOS 7.9.


  • Minimum of 4GB RAM  and 10 GB disk space. If you are installing on a VM, then a minimum of 2 VCPUs.
  • OpenJDK. You may need to check the version compatibility before installing it. For WSO2 version 4.0.0, you need OpenJDK version 8, 11.
  • Apache Ant 1.7.0 or later

Installing WSO2 API Manager on CentOS

Installing the pre-requisites:

Installing OpenJDK 11 on CentOS

Step 1: Get your machine ready with the latest package repository

# yum update

Step 2: Install OpenJDK via yum

# yum install java-11-openjdk-devel

Step 3: Install OpenJRE 11

# yum install java-11-openjdk

Step 4: Verify Java is installed successfully

# java --version
openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

Step 5: Set JAVA_HOME environment variable

# update-alternatives --config java

There are 2 programs which provide 'java'.

Selection Command
* 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-
+ 2 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-

Enter to keep the current selection[+], or type selection number: 2

Copy the path of Java from the above output and set the JAVA_HOME variable in  /etc/bashrc or /etc/bash_profile 

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-
export PATH=$JAVA_HOME/bin:$PATH

Step 6: Install Apache ANT

# wget
# unzip
# mv apache-ant-1.10.11 /opt/

Step 7: Set ANT_HOME in bashrc or bash_profile

export ANT_HOME=/opt/apache-ant-1.10.11
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

Check Apache ANT version

# ant -version
Apache Ant(TM) version 1.10.11 compiled on July 10 2021

Step 8: Create a new user to run the WSO2 API Manager

# adduser apigw

Step 9: Switch to 'apigw' user and Download API Manager

Visit this link and download the API Manager 4.0.

$ unzip

Step 10: Set hostname or domain name to use in /etc/hosts localhost localhost.localdomain

Note: Remember to replace the <local_ip_address> with an actual IP address.

Step 11: Configure deployment.toml file

Verify the configurations in wso2am-4.0.0/repository/conf/deployment.toml. If you are setting up WSO2 for the very first time, then you may not be required to change much in this file except the below.

hostname = "<domain_name/hostname>"


hostname = ""

Step 12: Start the API-Manager

Remember to start the API manager as a local user (apigw) and not as ‘root’.

$ ./bin/

The above command will start the API manager as a foreground process allowing to see the messages and errors printed to stdout. By starting in the foreground, you get to see errors and fix those if required.

But ideally, the API manager should be run as a daemon using the start, stop options as shown below:

$ ./bin/ -start
$ ./bin/ -stop
$ ./bin/ - restart

Look out for the logs files under wso2am-4.0.0/repository/logs folder.

  • wso2carbon.log
  • wso2-apigw-errors.log
  • wso2-apigw-service.log
  • audit.log
  • http_access_.2021-09-08.log

In case if the API manager fails to start, then wso2carbon.log and wso2-apigw-errors.log will provide more insight.

Check if API Manager is working properly.

Try accessing the following URLs,

  • Carbon – https://<hostname>:9443/carbon

Installing WSO2 API Manager

  • Publisher URL – https://<hostname>:9443/publisher

WSO2 Publisher

  • Developer Portal – https://<hostname>:9443/devportal

WSO2 Developer portal

If everything goes well, you should be able to see the interface. The default username is ‘admin’ and the password is ‘admin’.

Note: The default database used in WSO2 is H2. However, WSO2 should be integrated with MySQL database for the production environments. We will discuss this in a separate article.

Updated on September 15, 2021

Was this article helpful?

Related Articles

Leave a Comment