0

I am new to MongoDB but have experience in mysql and i am trying to install MongoDB in ubuntu 22.04 but getting confirmation message that MongoDB is already installed on my machine :

sudo apt install mongodb-org -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
mongodb-org is already the newest version (8.0.5).
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.

but when i check the installed mongoDB version it throws error :

mongod --version
Illegal instruction (core dumped)

i am frustrated by this behavior of mongoDB..!!

asked Mar 18 at 5:16

1 Answer 1

0

I've tested an install on my local Ubuntu 22.04.5 system using the instructions from here - https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

add the repo key

curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \

sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg
--dearmor

add the apt list file

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

(the page had a few different versions for Noble, Jammy etc, so I had to ensure I used the right one)

Refresh my sources and then install

apt update
apt install -y mongodb-org

started the service

service mongod start

at which point I could connect with mongosh

# mongosh
Current Mongosh Log ID: 67d9b8ddcdc7fb01626b140a
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.4.2
Using MongoDB: 8.0.5
Using Mongosh: 2.4.2
For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.
------
 The server generated these startup warnings when booting
 2025年03月18日T18:17:51.570+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
 2025年03月18日T18:17:51.692+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
 2025年03月18日T18:17:51.692+00:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
 2025年03月18日T18:17:51.692+00:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
 2025年03月18日T18:17:51.692+00:00: We suggest setting the contents of sysfsFile to 0.
 2025年03月18日T18:17:51.692+00:00: vm.max_map_count is too low
 2025年03月18日T18:17:51.692+00:00: We suggest setting swappiness to 0 or 1, as swapping can cause performance problems.
------
test> 

and could query the version

#mongod --version
db version v8.0.5
Build Info: {
 "version": "8.0.5",
 "gitVersion": "cb9e2e5e552ee39dea1e39d7859336456d0c9820",
 "openSSLVersion": "OpenSSL 3.0.2 15 Mar 2022",
 "modules": [],
 "allocator": "tcmalloc-google",
 "environment": {
 "distmod": "ubuntu2204",
 "distarch": "x86_64",
 "target_arch": "x86_64"
 }
}

I suspect that you may have used the repo for the wrong version of Ubuntu.

answered Mar 18 at 18:26
3
  • What about all those warnings? Specifically I haven't been able to solve For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile - We suggest setting the contents of sysfsFile to 0. Commented Apr 10 at 15:36
  • I didn't tune the installation - simply checked how to get it up and running. Default memory allocator (malloc) will be set to system. It looks like they are suggesting tcmalloc as the one to use with MongoDB mongodb.com/docs/manual/administration/tcmalloc-performance tcmalloc is provided in libtcmalloc-minimal4t64 (sudo apt install libtcmalloc-minimal4t64) and you would need to update the service file using: sudo systemctl edit mongodb.service To get to the config options that are mentioned in the link. This should also remove the sysfsFile message too. Commented Apr 15 at 16:29
  • Swappiness is a Linux kernel setting - see here - mongodb.com/docs/manual/administration/production-notes/… vm.max_map_count is also a Linux kernel setting. It's set in /etc/sysctl.d/10-map-count.conf Commented Apr 15 at 16:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.