1
votes

I'm using WSL2 with Ubuntu 20.04.2 LTS. I tried setting up mongodb. There are two issues:

  1. Running the command sudo apt-get install -y mongodb-org results in the error below.

    Errors were encountered while processing: /tmp/apt-dpkg-install-NtCqHi/1-mongodb-org-server_4.4.4_amd64.deb /tmp/apt-dpkg-install-NtCqHi/2-mongodb-org-mongos_4.4.4_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

  2. Although the command mongod --version results in:

    db version v3.6.8 git version: 8e540c0b6db93ce994cc548f000900bdc740f80a OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 allocator: tcmalloc modules: none build environment: distarch: x86_64 target_arch: x86_64 which is not the latest, even though I installed the latest community version. running sudo service mongod start shows the following error:

    mongod: unrecognized service

the list of available services currently in the system are:

sudo service --status-all

 [ - ]  apparmor
 [ ? ]  apport
 [ - ]  atd
 [ - ]  console-setup.sh
 [ - ]  cron
 [ ? ]  cryptdisks
 [ ? ]  cryptdisks-early
 [ - ]  dbus
 [ ? ]  hwclock.sh
 [ + ]  irqbalance
 [ - ]  iscsid
 [ - ]  keyboard-setup.sh
 [ ? ]  kmod
 [ - ]  lvm2
 [ - ]  lvm2-lvmpolld
 [ - ]  multipath-tools
 [ + ]  open-iscsi
 [ - ]  open-vm-tools
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ - ]  postgresql
 [ - ]  procps
 [ + ]  redis-server
 [ - ]  rsync
 [ - ]  rsyslog
 [ - ]  screen-cleanup
 [ - ]  ssh
 [ - ]  sysstat
 [ - ]  udev
 [ - ]  ufw
 [ - ]  unattended-upgrades
 [ - ]  uuidd
 [ - ]  x11-common
1

1 Answers

0
votes

This works for me:

sudo apt-get update

sudo apt-get install mongodb

sudo service mongodb start

:: My setup: [win10, wsl2]