Single Blog

How to Connect MongoDB to cPanel

May 18, 2024, Written by 0 comment

Learn how to connect MongoDB to cPanel. Our MongoDB Support team is here to help you with your questions and concerns.

How to Connect MongoDB to cPanel

MongoDB is a powerful open-source NoSQL database management system. It is popular for it scalability and flexibility. In fact, MongoDB excels in storing and managing diverse data types within a single document.

How to Connect MongoDB to cPanel

It is a great choice for document-oriented data. Making it ideal for modern web applications, AI, edge computing, IoT, etc.

How to Install MongoDB on a cPanel Server

  1. First, log in to the cPanel Server and access the server as the root user.
  2. Then, go to the /etc/yum.repos.d directory.
  3. Now, create a new file named mongodb.repo.
  4. Then, open the mongodb.repo file and add this code:

    [mongodb]
    name=MongoDB Repo
    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
    gpgcheck=0
    enabled=1

  5. Save and close the file.
  6. Next, run this command to install MongoDB:

    yum install mongo-10gen mongo-10gen-server

  7. Then, enable MongoDB to start automatically after the system reboots with this command:

    chkconfig mongod on

  8. Now, start the MongoDB service with this command:

    service mongod start

  9. Next, install the PHP extension for MongoDB using PECL:

    pecl install mongo

  10. Then, restart the Apache web server to apply the changes:

    service httpd restart

  11. Now, check the PHP configuration to verify if MongoDB has been installed:

    php -i | grep mongodb -i

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to connect MongoDB to cPanel.

admin
Rock