Installing MongoDB Cpanel

I have executed the curl statement and it worked!

Could be possible that yum has a bug? ¿?

1 Like

Very unlikely as I can run it in Centos7 and Redhat 7 fine. Are you still trying this on CPanel. Have you contacted their support?

Yes, but they redirect to your documentation.

Which version of yum have you installed? They could be different.

That variable wasn’t defined. I updated that yum.conf and I have got this result:
Loaded plugins: fastestmirror, langpacks, universal-hooks
Loading mirror speeds from cached hostfile

  • EA4: 206.130.99.76
  • cpanel-addons-production-feed: 206.130.99.76
  • cpanel-plugins: 206.130.99.76
  • remi-php74: mirror.sjc02.svwh.net
  • remi-safe: mirror.sjc02.svwh.net
    EA4 | 2.9 kB 00:00:00
    cpanel-addons-production-feed | 2.9 kB 00:00:00
    cpanel-plugins | 2.9 kB 00:00:00
    base | 3.6 kB 00:00:00
    docker-ce-stable | 3.5 kB 00:00:00
    epel | 4.7 kB 00:00:00
    extras | 2.9 kB 00:00:00
    imunify360 | 2.7 kB 00:00:00
    imunify360-rollout-1 | 3.0 kB 00:00:00
    imunify360-rollout-2 | 3.0 kB 00:00:00
    imunify360-rollout-3 | 3.0 kB 00:00:00
    imunify360-rollout-4 | 3.0 kB 00:00:00
    mongodb-org-4.4 | 2.5 kB 00:00:00
    mysql-connectors-community | 2.6 kB 00:00:00
    mysql-tools-community | 2.6 kB 00:00:00
    mysql57-community | 2.6 kB 00:00:00
    remi-php74 | 3.0 kB 00:00:00
    remi-safe | 3.0 kB 00:00:00
    ul | 2.9 kB 00:00:00
    ul_ipage | 2.9 kB 00:00:00
    updates | 2.9 kB 00:00:00
    No package mongodb-org available.
    Error: Nothing to do

Not my documentation :smiley:

Try it anywhere other than CPanel. I’m sure it will work.

It appears mongodb-org-4.4 | 2.5 kB but I don’t know if it is installed…

root@server.abelardolg.com [~]# sudo yum install -y mongodb-org-4.4.4 mongodb-org-server-4.4.4 mongodb-org-shell-4.4.4 mongodb-org-mongos-4.4.4 mongodb-org-tools-4.4.4
Loaded plugins: fastestmirror, langpacks, universal-hooks
Loading mirror speeds from cached hostfile

No package mongodb-org-4.4.4 available.
No package mongodb-org-server-4.4.4 available.
No package mongodb-org-shell-4.4.4 available.
No package mongodb-org-mongos-4.4.4 available.
No package mongodb-org-tools-4.4.4 available.
Error: Nothing to do
root@server.abelardolg.com [~]#

How could I check if I can reach your server from my CentOS 7 server, please?

The package you are installing should just be mongodb-org

yum install mongodb-org

If you are wanting a specific release the format is for example:
yum install mongodb-org-4.4.4-1.el7

What does yum search mongodb-org show now ?

Hey Abelardo! I had a chance to dig into this a bit this morning. The script here is based on the instructions with some modifications mentioned in this thread. This script was tested on a cloud VPS running CentOS 7.4 with cPanel/WHM installed under a trial license. No other modifications were made to the system aside from the activation process for the cPanel/WHM license.

#!/bin/bash
#
# Example MongoDB Install on CentOS 7 / cPanel
#
# This code is for informational purposes and not maintained or warrantied for any specific use
#
# (c) 2021 MongoDB Inc
# author: ryan.quinn@mongodb.com

# Create entry for MongoDB repository
cat > /etc/yum.repos.d/mongodb-org-4.4.repo <<- EOM
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
EOM

# Install MongoDB packages
sudo yum install -y mongodb-org;

# Configure SELinux (only needed if running SELinux in enforcing mode)
sudo yum install checkpolicy;
cat > mongodb_cgroup_memory.te <<EOF
module mongodb_cgroup_memory 1.0;

require {
    type cgroup_t;
    type mongod_t;
    class dir search;
    class file { getattr open read };
}

#============= mongod_t ==============
allow mongod_t cgroup_t:dir search;
allow mongod_t cgroup_t:file { getattr open read };
EOF

checkmodule -M -m -o mongodb_cgroup_memory.mod mongodb_cgroup_memory.te;
semodule_package -o mongodb_cgroup_memory.pp -m 
mongodb_cgroup_memory.mod;
sudo semodule -i mongodb_cgroup_memory.pp;

cat > mongodb_proc_net.te <<EOF
module mongodb_proc_net 1.0;

require {
    type proc_net_t;
    type mongod_t;
    class file { open read };
}

#============= mongod_t ==============
allow mongod_t proc_net_t:file { open read };
EOF

checkmodule -M -m -o mongodb_proc_net.mod mongodb_proc_net.te
semodule_package -o mongodb_proc_net.pp -m mongodb_proc_net.mod
sudo semodule -i mongodb_proc_net.pp

# Start the MongoDB Service
sudo systemctl daemon-reload;
sudo systemctl start mongod;

# Check MongoDB status
sudo systemctl status mongod;

# Enable MongoDB to automatically start on boot (optional)
sudo systemctl enable mongod;

cat << EOF
------------------------------------------------------
This script has completed.
Please check the output for any critical
errors and ensure that the MongoDB service is running.
------------------------------------------------------
EOF
2 Likes

Hi @ABELARDO_GONZALEZ!

Wow, it’s terrible that you’re still having issues after all this time. Do you actually need to run MongoDB on a CentOS7 machine with cPanel?

Personally, I don’t bother with MongoDB on Linux (except for debugging to help others!), I just use Atlas - The free tier is enough for my needs (I have a few databases I regularly use) and you don’t need to provide a credit card for the free tier, just head on over to cloud.mongodb.com - and with a few clicks and waiting about 5-10 minutes for the machines to spin up, you’ll be querying in no time…

1 Like

Hi there,

Thanks for your piece of advice.

I prefer MongoDB on CentOS 7 since I wouldn’t like to share my personal data in any online platform such as Atlas.

I know I can’t avoid anybody accesses to my data but I prefer not doing it with online platforms.

Best regards.

Loaded plugins: fastestmirror, langpacks, universal-hooks
Loading mirror speeds from cached hostfile

  • EA4: 206.130.99.76
  • cpanel-addons-production-feed: 206.130.99.76
  • cpanel-plugins: 206.130.99.76
  • remi-php74: mirror.bebout.net
  • remi-safe: mirror.bebout.net
    ========================================================== N/S matched: mongodb-org ===========================================================
    mongodb-org-database-tools-extra.x86_64 : MongoDB extra database tools

Name and summary matches only, use “search all” for everything.

@ABELARDO_GONZALEZ Absolutely - data privacy is very important! I was very pleased to learn when I joined that, as an employee, I was not allowed to go into any databases without explicit permission - e.g. we have to ask “may I look into your database?” specifically, if it’s needed to debug an issue.

Here’s a link to MongoDB’s privacy policy - this isn’t specifically for you, Abelardo, but just in case other people are worried if MongoDB is using your data…I want to assure them we’re not!

-Sheeri

Hello there!

Thanks for your all time / effort / support.

My issue was successfully solved.

I could install MongoDB on CentOS 7.

The problem was I followed your instructions:
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
and it avoided any installation.

I removed mongodb from this section and it worked like a charm.

:slight_smile: Warmest regards.

2 Likes

That step is executes after a yum install. If your yum install didn’t succeed then adding this would indeed block installing.

You can specify any available version of MongoDB. However yum upgrades the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:

exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

Thanks for following up, it was a head scratcher.

2 Likes

Hi there,

I executed a yum install. Since it didn’t work, I included these files under the “excluded” section. Consequently, future invocations to install Mongodb didn’t work. :wink:

I think that documentation should warm to future users to avoid writing these names under the excluded section.

Regards.

2 Likes

Hi @ABELARDO_GONZALEZ,

Great to see you were able to successfully solve your installation issue! Thank you for confirming the problem with the excluded section - I created a suggestion for our documentation team you can watch, upvote, or comment on with additional information: DOCS-14314.

I know you prefer to manage your own hosting, but for future reference you might be interested to know that cloud security has evolved significantly.

With MongoDB Atlas:

There’s more information on security, compliance, and privacy in the MongoDB Trust Centre.

With MongoDB 4.2+ (self-hosted or Atlas) you can also use Client-Side Field Level Encryption (CSFLE) to encrypt sensitive fields in documents prior to sending to the server. The CSFLE Guide includes some practical examples for using CSFLE and other security measures.

Regards,
Stennie

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.