Termux-packages: Package Request: MongoDB

Created on 3 May 2016  ·  83Comments  ·  Source: termux/termux-packages

Mongo database for nodejs application deploy

package request

Most helpful comment

Install Mongodb in Termux without root

Add @its-pointless repository

  1. wget https://its-pointless.github.io/setup-pointless-repo.sh
  2. sh setup-pointless-repo.sh
  3. pkg upgrade
  4. pkg install mongodb
  5. mkdir -p $PREFIX/data/db
  6. mongod -> to start mongodb service
  7. mongo

All 83 comments

👍

:+1:

Just saw in the official repository that both Ubuntu and Debian are currently supporting MongoDB package for armhf architecture.

Debian: https://packages.debian.org/jessie/mongodb
Ubuntu: http://packages.ubuntu.com/xenial/mongodb

Any movement on getting this into termux? Has anyone found a way to get MongoDB installed?

Better C++ support is required. Waiting for next NDK release.

@vishalbiswas Is C++ support better now? Is the 'next NDK release' there yet? I mean, there was a version bump, right?

Should be. we are using libc++ now. Some of us are working on fixing bugs its caused right now on arm (ndk guys said it wasn't stable) . But yeah this might work now.

MongoDB depends on WiredTiger which only works on 64-bit devices. I don't have one to test. So, it could be possible to port MongoDB, but, not by me.

I think most of us would be much more interested in a 32-bit version. I mean 64-bit arm devices are very rare, aren't they? I think before version 3.4 MongoDB did run on 32-bit devices, at least on the desktop. Maybe we could simply use an older version? 3.2 for instance is still being maintained.

@T-vK that's what I'm working on. I have disabled wiredtiger (which is the default engine)

MongoDB requires some on device configuration data.
If you have abundant free space on your device then you can help. Run this on your device/termux.

git clone --depth 1 https://github.com/mongodb/mongo
cd mongo/src/third_party/mozjs-45
sh get-sources.sh
sh gen-config.sh <your arch> android

After successful configuration, you'll have a folder in platform/\ I need that folder.
Ideally, config files for all arches (arm, i686, aarch64 and x86_64) are required for building on that arch

@vishalbiswas
I'm stuck at the gen-config.sh script. I ran sh gen-config.sh arm android and got:

gen-config.sh: 15: gen-config.sh: ./configure: not found
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory

I checked the script at line 15 and it says:

PYTHON=python ./configure --without-intl-api --enable-posix-nspr-emulation --disable-trace-logging

right before that it does:

cd mozilla-release/js/src

So I manually checked for the existence of mozilla-release/js/src/configure and sure enough, it does exist. mozilla-release/js/src/js on the other hand does not exist.

@T-vK run termux-fix-shebang on configure then, and also export CONFIG_SHELL=sh

@vishalbiswas

Now it says:

Using Python from environment variable $PYTHON
Creating Python environment
./configure: 4708: ./configure: python: not found

It previously complained about me having python 3, so I uninstalled python 3 and now I only have python2. The $PYTHON variable is empty. I tried to set it to the path of the python2 binary, but that didn't help.

Here is the full output:

$ sh gen-config.sh arm android
loading cache ./config.cache
checking host system type... armv7l-unknown-linux-gnueabi
checking target system type... armv7l-unknown-linux-gnueabi
checking build system type... armv7l-unknown-linux-gnueabi
checking for gawk... gawk
checking for perl5... no
checking for perl... /data/data/com.termux/files/usr/bin/perl
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking for ranlib... ranlib
checking for as... /data/data/com.termux/files/usr/bin/as
checking for ar... ar
checking for ld... ld
checking for strip... strip
checking for windres... no
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... c++ -E
checking for rustc... no
checking for sb-conf... no
checking for ve... no
checking for a BSD compatible install... /data/data/com.termux/files/usr/bin/install -c
checking whether ln -s works... yes
checking for tar archiver... checking for gnutar... no
checking for gtar... no
checking for tar... tar
tar
checking for minimum required perl version >= 5.006... 5.024001
checking for full perl installation... yes
Using Python from environment variable $PYTHON
Creating Python environment
./configure: 4708: ./configure: python: not found
------ config.log ------
exit (42);
^
configure:3278:1: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:3301: checking for ranlib
configure:3333: checking for as
configure:3387: checking for ar
configure:3422: checking for ld
configure:3457: checking for strip
configure:3492: checking for windres
configure:3782: checking how to run the C preprocessor
configure:3803: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:3862: checking how to run the C++ preprocessor
configure:3880: c++ -E  conftest.C >/dev/null 2>conftest.out
configure:3908: checking for rustc
configure:4408: checking for sb-conf
configure:4408: checking for ve
configure:4470: checking for a BSD compatible install
configure:4523: checking whether ln -s works
configure:4545: checking for tar archiver
configure:4551: checking for gnutar
configure:4551: checking for gtar
configure:4551: checking for tar
configure:4588: checking for minimum required perl version >= 5.006
configure:4598: checking for full perl installation
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory
$

Edit:

I now created a symbolic link called python that points to python2: ln -s /data/data/com.termux/files/usr/bin/python2 /data/data/com.termux/files/usr/bin/python.

Now it doesn't complain about python being missing anymore.
But now it complaints:

Exception: Could not detect environment shell!
configure: error: Python environment does not appear to be sane.
Using Python from environment variable $PYTHON
Creating Python environment
checking Python environment is Mozilla virtualenv... Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/build/mach_bootstrap.py", line 340, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/python/mozbuild/mozbuild/base.py", line 17, in <module>
    from mach.mixin.process import ProcessExecutionMixin
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/build/mach_bootstrap.py", line 340, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/python/mach/mach/mixin/process.py", line 29, in <module>
    raise Exception('Could not detect environment shell!')
Exception: Could not detect environment shell!
configure: error: Python environment does not appear to be sane.
------ config.log ------
configure:3278:1: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:3301: checking for ranlib
configure:3333: checking for as
configure:3387: checking for ar
configure:3422: checking for ld
configure:3457: checking for strip
configure:3492: checking for windres
configure:3782: checking how to run the C preprocessor
configure:3803: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:3862: checking how to run the C++ preprocessor
configure:3880: c++ -E  conftest.C >/dev/null 2>conftest.out
configure:3908: checking for rustc
configure:4408: checking for sb-conf
configure:4408: checking for ve
configure:4470: checking for a BSD compatible install
configure:4523: checking whether ln -s works
configure:4545: checking for tar archiver
configure:4551: checking for gnutar
configure:4551: checking for gtar
configure:4551: checking for tar
configure:4588: checking for minimum required perl version >= 5.006
configure:4598: checking for full perl installation
configure:4726: checking Python environment is Mozilla virtualenv
configure: error: Python environment does not appear to be sane.
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory

Let it be. I've also disabled mozjs engine.
I did manage it on my arm device but with different steps. If its really wanted, I'll request it again here.

Okay, if there is anything else that I can do, tell me.

Edit:
Do not try these yet. Let me do this on my arm mobile and build successfully

seems like mongo shell cannot be built without mozjs and with the shell, mongodb itself wouldn't be as useful. So if you are still up to it, follow these steps:

  1. Download moz.txt. Install proot, python2, clang if not already installed.
  2. Run it with sh moz.txt <your arch>. \
  3. If it's successful, you'll get a file named platform_\

It shouldn't use as much space as downloading the whole firefox code like before

Updates:
Doesn't work, yet.

Successfully compiled and install on arm device, but the server fails to start.

2017-08-08T14:00:46.067+0530 I CONTROL  [main] 
2017-08-08T14:00:46.067+0530 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-08-08T14:00:46.068+0530 I CONTROL  [main] 
[New LWP 19651]
[New LWP 19652]
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] MongoDB starting : pid=19635 port=27017 dbpath=/storage/sdcard0/db 32-bit host=localhost
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] db version v3.4.6
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] allocator: system
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten] modules: none
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten] build environment:
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten]     distarch: arm
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten]     target_arch: arm
2017-08-08T14:00:46.098+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "/storage/sdcard0/db" } }

Thread 1 "mongod" received signal SIGSEGV, Segmentation fault.
0xb6faacc0 in dlfree () from /system/lib/libc.so

This is the code (from boost 1.64, libs/filesystem/src/operations.cpp) that causes the segfault:

  void directory_iterator_increment(directory_iterator& it,
    system::error_code* ec)
  {
    BOOST_ASSERT_MSG(it.m_imp.get(), "attempt to increment end iterator");
    BOOST_ASSERT_MSG(it.m_imp->handle != 0, "internal program error");

    path::string_type filename;
    file_status file_stat, symlink_file_stat;
    system::error_code temp_ec;

    for (;;)
    {
      temp_ec = dir_itr_increment(it.m_imp->handle,
#       if defined(BOOST_POSIX_API)
        it.m_imp->buffer,
#       endif
        filename, file_stat, symlink_file_stat);

      if (temp_ec)  // happens if filesystem is corrupt, such as on a damaged optical disc
      {
        path error_path(it.m_imp->dir_entry.path().parent_path());  // fix ticket #5900
        it.m_imp.reset();
        if (ec == 0)
          BOOST_FILESYSTEM_THROW(
            filesystem_error("boost::filesystem::directory_iterator::operator++",
              error_path,
              error_code(BOOST_ERRNO, system_category())));
        ec->assign(BOOST_ERRNO, system_category());
        return;
      }
      else if (ec != 0) ec->clear();

      if (it.m_imp->handle == 0)  // eof, make end
      {
        it.m_imp.reset();
        return;
      }

      if (!(filename[0] == dot // !(dot or dot-dot)
        && (filename.size()== 1
          || (filename[1] == dot
            && filename.size()== 2))))
      {
        it.m_imp->dir_entry.replace_filename(
          filename, file_stat, symlink_file_stat);
        return;
      }
    }
  }

Line number 2424 throws a filesystem_error and then it immediately segfaults on return from this function.

BOOST_FILESYSTEM_THROW(
            filesystem_error("boost::filesystem::directory_iterator::operator++",
              error_path,
              error_code(BOOST_ERRNO, system_category())));

This is the exact exception that gets thrown.

Backtrace:

#0  __gnu_Unwind_Resume (ucbp=0x2, entry_vrs=0xbeffe41c) at /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc:482
#1  0xb512856c in ___Unwind_Resume () at /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/libunwind.S:357
#2  0xb5139564 in boost::filesystem::detail::directory_iterator_increment (it=..., ec=<optimized out>) at libs/filesystem/src/operations.cpp:2449
#3  0x2abd0d22 in boost::filesystem::directory_iterator::increment (this=0xbeffe6d0) at /data/data/com.termux/files/usr/include/boost/filesystem/operations.hpp:939
#4  boost::iterators::iterator_core_access::increment<boost::filesystem::directory_iterator> (f=...) at /data/data/com.termux/files/usr/include/boost/iterator/iterator_facade.hpp:555
#5  boost::iterators::detail::iterator_facade_base<boost::filesystem::directory_iterator, boost::filesystem::directory_entry, boost::iterators::single_pass_traversal_tag, boost::filesystem::directory_entry&, int, false, false>::operator++ (this=<optimized out>) at /data/data/com.termux/files/usr/include/boost/iterator/iterator_facade.hpp:665
#6  mongo::(anonymous namespace)::clearTmpFiles () at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:222
#7  mongo::MMAPV1Engine::MMAPV1Engine (this=0x2ba09130, lockFile=<optimized out>, cs=<optimized out>, extentManagerFactory=...) at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:249
#8  0x2abcfe10 in mongo::MMAPV1Engine::MMAPV1Engine (this=0x2ba09130, lockFile=0xb6fdc0e8 <_gm_>, cs=0x1) at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:231
#9  0x2abd5c04 in mongo::(anonymous namespace)::MMAPV1Factory::create (this=<optimized out>, params=..., lockFile=0x2ba08c30) at src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp:48
#10 0x2ab5e54a in mongo::ServiceContextMongoD::initializeGlobalStorageEngine (this=0x2ba30d30) at src/mongo/db/service_context_d.cpp:202
#11 0x2a5a5a74 in mongo::(anonymous namespace)::_initAndListen (listenPort=27017) at src/mongo/db/db.cpp:596
#12 0x2a5a3ed8 in mongo::(anonymous namespace)::initAndListen (listenPort=2) at src/mongo/db/db.cpp:841
#13 mongoDbMain (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at src/mongo/db/db.cpp:1190
#14 0x2a5a3b68 in main (argc=2, argv=0xb6fdc0e8 <_gm_>, envp=0x1) at src/mongo/db/db.cpp:884

If you want to debug it, you can grab the debug binaries from https://drive.google.com/drive/folders/0B8Q4yBRb9PSHdWpORmMzQWhIYUk
BEWARE: they have debug symbols and require 2 GB free space
pcre is needed because the one in the repos hasn't enabled cpp.

I'm not really a C++ guy so I can't help too much on this one. Maybe you can ask on Stack Overflow. I'd be willing to throw a bounty at it.

@T-vK It's for whoever stumbles upon this issue, looking for mongodb on termux.
I don't really want to post to stackoverflow or others because I'll probably get responses saying mongodb isn't supported on 32-bit devices. Not tested for 64 bits.
This attempt was for 3.4.6. I'll try 3.2 when I give up on this.

Hi everyone, I'm not sure to understand what worked and what didn't...
I have aarch64.
Before coming here, I downloaded mongodb from curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.7.tgz, untared it and tried to run it mongodb-linux-x86_64-3.4.7/bin/mongod --dbpath sd/db but it failed : zsh: exec format error: mongodb-linux-x86_64-3.4.7/bin/mongod

@dajaj That deb is for arm. To build for aarch64 we'll need mozjs configuration for aarch64 Android. My previous comment has steps as to how to generate those files.

Anybody on arm can help me out?
Try this package and report how well it works https://drive.google.com/drive/folders/0B8Q4yBRb9PSHdWpORmMzQWhIYUk
Note: You have to install pcre from that folder as well, because the current version in repo doesn't have cpp bindings enabled.

@vishalbiswas I downloaded the files to my SD and then using Termux I copied them into my home directory. Then I did a chmod 777 on them and also a chown... both commands worked, but when I try to access the files I always get a permission denied. I guess that's some SELinux blackmagic that happens for files on the SD card. I never had this problem when downloading files in Termux with wget directly. Is there any chance you could upload these files to Github, so that I can download them with wget?

@T-vK github.com doesn't support files larger than 10mb. any other way?

@vishalbiswas when i tried to install pcre, it removed tons of my packages,
is that supposed to happen?

@Auxilus no

Okay... 😅

@vishalbiswas Dang it... I'm gonna try to set up a local http server. This way I should be able to wget the files with Termux over my Wifi..

@T-vK you can just share that file to termux from any file manager

@T-vK there is a cool npm package called http-server

@vishalbiswas Can you please help me out with https://github.com/termux/termux-packages/pull/1361 ? The build script is having issue with building gems with native extensions, gives error that couldn't find header files (ruby.h) even though I added sudo apt-get -y install ruby ruby-dev in the script
PS: sorry to go off topic to this issue btw

@vishalbiswas Well, not any. It needs to run on the phone directly, and it needs to have root permissions. But nevertheless, when I copy a file with such a file manager to the Termux home dir, I get the same permission denied problems that I got after doing cp.

@T-vK What exactly are you copying and what exactly are you running when you permission denied?

@Grimler91 It doesn't matter which file I copy. I get this issue with any file from the SD card. And the permission denied happens for any command. Be it cat, vim or any other command that tries to read the file and probably also any command that tries to write to it or execute it...

@T-vK I didn't say "copy". I said "share". Tap and hold on a find and click share then select termux. It will be stored in ~/downloads

@vishalbiswas It seemed to have worked at first. I was able to run mongod. Then from another terminal I started mongo and that seems to have caused both mongod and mongo to crash. Now when I try to run mongod, I get this:

$ mongod
2017-09-13T18:43:43.231+0200 I CONTROL  [main]
2017-09-13T18:43:43.232+0200 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-09-13T18:43:43.232+0200 I CONTROL  [main]
2017-09-13T18:43:43.252+0200 I CONTROL  [initandlisten] MongoDB starting : pid=7237 port=27017 dbpath=/data/data/com.termux/files/usr/var/lib/mongodb/db 32-bit host=localhost
2017-09-13T18:43:43.252+0200 I CONTROL  [initandlisten] db version v3.4.9
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] git version: 876ebee8c7dd0e2d992f36a848ff4dc50ee6603e
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] allocator: system
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] modules: none
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] build environment:
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten]     distarch: arm
2017-09-13T18:43:43.254+0200 I CONTROL  [initandlisten]     target_arch: arm
2017-09-13T18:43:43.254+0200 I CONTROL  [initandlisten] options: {}
2017-09-13T18:43:43.254+0200 W -        [initandlisten] Detected unclean shutdown - /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock is not empty.
2017-09-13T18:43:43.418+0200 I -        [initandlisten] Detected data files in /data/data/com.termux/files/usr/var/lib/mongodb/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-09-13T18:43:43.447+0200 I STORAGE  [initandlisten]
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
2017-09-13T18:43:43.449+0200 F -        [initandlisten] Invalid access at address: 0xe
2017-09-13T18:43:43.449+0200 F -        [initandlisten] Got signal: 11 (Segmentation fault).
This platform does not support printing stacktraces
Segmentation fault

When I clear the contents of /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock and run mongod again it keeps running:

2017-09-13T18:50:20.599+0200 I CONTROL  [main]
2017-09-13T18:50:20.601+0200 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-09-13T18:50:20.601+0200 I CONTROL  [main]
2017-09-13T18:50:20.635+0200 I CONTROL  [initandlisten] MongoDB starting : pid=9344 port=27017 dbpath=/data/data/com.termux/files/usr/var/lib/mongodb/db 32-bit host=localhost
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] db version v3.4.9
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] git version: 876ebee8c7dd0e2d992f36a848ff4dc50ee6603e
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] allocator: system
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] modules: none
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] build environment:
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten]     distarch: arm
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten]     target_arch: arm
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] options: {}
2017-09-13T18:50:20.797+0200 I -        [initandlisten] Detected data files in /data/data/com.termux/files/usr/var/lib/mongodb/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten]
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** WARNING: This 32-bit MongoDB binary is deprecated
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.868+0200 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/data/com.termux/files/usr/var/lib/mongodb/db/diagnostic.data'
2017-09-13T18:50:20.871+0200 I NETWORK  [thread1] waiting for connections on port 27017
2017-09-13T18:50:21.001+0200 I FTDC     [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. InvalidBSON: bson length doesn't match what we found in object with unknown _id

From another machine I was then able to access it with mongo:

$ mongo mongodb://192.168.3.7:27017
MongoDB shell version v3.4.3
connecting to: mongodb://192.168.3.7:27017
MongoDB server version: 3.4.9
Server has startup warnings: 
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] 
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** WARNING: This 32-bit MongoDB binary is deprecated
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
> use test
switched to db test
>     db.myCollection.insert([
...         {'name': 'Alice', 'age': 30},
...         {'name': 'Bill', 'age': 25},
...         {'name': 'Bob', 'age': 35}
...     ]);
BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 3,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
> db.myCollection.find({})
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8c"), "name" : "Alice", "age" : 30 }
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8d"), "name" : "Bill", "age" : 25 }
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8e"), "name" : "Bob", "age" : 35 }

Edit:
Every time I exit mongod, I have to empty /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock to get it running again.

@vishalbiswas Is there anything else I can do?

it works? may 1 know the step ?like below??

git clone --depth 1 https://github.com/mongodb/mongo
cd mongo/src/third_party/mozjs-45
sh get-sources.sh

sh gen-config.sh android

or???
download the two ....deb

I am using this link to try with mongodb.Unfortunately it fails.

Link: https://www.w3schools.com/nodejs/nodejs_mongodb_create_db.asp

Anyone know why? Nodejs & mongodb already install.But when to run it fail

@zawawimanja Have you started the mongod daemon? If not, open a second tab and run mongod.
Then try to connect using the terminal based mongo client by running mongo and check if you can create a db from there: https://www.tutorialspoint.com/mongodb/mongodb_create_database.htm
If that already fails you can rule out that this problem is related to nodejs.

There is no command mongod in Termux.

On Wed, Jul 25, 2018, 8:05 PM T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja Have you started the mongod
daemon? If not, open a second tab and run mongod.
Then try to connect using the terminal based mongo client by running mongo
and check if you can create a db from there:
https://www.tutorialspoint.com/mongodb/mongodb_create_database.htm
If that already fails you can rule out that this problem is related to
nodejs.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/249#issuecomment-407731254,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AjgWu3C9KwkNkt7JpuGzOMOJfsqrxjVlks5uKF8UgaJpZM4IWJR4
.

@zawawimanja In that case mongodb has not been installed properly. When I did it a year ago I had mongod and mongo.

if u can,make a video tutorial. Really needs it

On Thu, Jul 26, 2018, 4:54 AM T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja In that case mongodb has
not installed properly. When I did it a year ago I had mongod and mongo.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/249#issuecomment-407892111,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AjgWu5Ps8dFduN96QLNmOlkP3zaRZgYpks5uKNsMgaJpZM4IWJR4
.

actually ,it had worked as i know @T-vK "T-vK commented on 14 Sep 2017 •",may i know this steps?

@zawawimanja Sorry, I don't have the time to make a video tutorial on that.
@better319 I can't remember the steps, but I think you can find what I did if you read through all the comments here.

But remember, even though I got it to work it was unstable and had weird issues.

Ok. Thanks. So I will not install it.

Muhammad Zawawi Bin Manja
Bachelor Of Information Technology
International Islamic University Malaysia
http://www.zawawimanja.com | +6013-5372906

On 26 July 2018 at 16:16, T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja Sorry, I don't have the
time to make a video tutorial on that.
@better319 https://github.com/better319 I can't remember the steps, but
I think you can find what I did if you read through all the comments here.

But remember, even though I got it to work it was unstable and had weird
issues.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/249#issuecomment-408015702,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AjgWu46B3xFRlgGe9mqkgzUB4EMkF5a5ks5uKXrZgaJpZM4IWJR4
.

when you change congputer ,the mongodb will create a xxx.lock file......even in window.so,i think you step is right .i will try again,did you root you device? @T-vK

@better319 My device is rooted, yes. I'm not sure if it was necessary though.
The lock file is probably there for a good reason. The issue was that I was not able to start mongod again every time it crashed without clearing that file first.

i got it in another way:termux-ubuntu
https://github.com/Neo-Oli/termux-ubuntu

  1. install termux-ubuntu
    2.install mongodb...
    3.it works well
    image

I already install
ubuntu 1. pkg install wget proot
mongodb 2. npm install mongodb

But it still fail. Is it correct my steps?Phone already root

Or you can make a video tutorial about it.

On Fri, Jul 27, 2018, 5:13 PM better319 notifications@github.com wrote:

i got it in another way:termux-ubuntu
https://github.com/Neo-Oli/termux-ubuntu

  1. install termux-ubuntu
    2.install mongodb...
    3.it works well
    [image: image]
    https://user-images.githubusercontent.com/13842581/43312563-43a72ca2-91c0-11e8-911a-e0edb5eed756.png


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/249#issuecomment-408361449,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AjgWu6LhK5j9TepVLogLuP4kOcBZ8JsVks5uKtnOgaJpZM4IWJR4
.

@zawawimanja as far as I understood from the discussion:

1. Follow the installation steps in https://github.com/Neo-Oli/termux-ubuntu
2. When running the ubuntu proot, you `apt install mongodb`
3. Then you can finally use `mongo`

Unfortunately already tried and not work.

On Fri, Jul 27, 2018, 6:26 PM Fred Souza notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja as far as I understood from
the discussion:

  1. Follow the installation steps in https://github.com/Neo-Oli/termux-ubuntu
  2. When running the ubuntu proot, you apt install mongodb
  3. Then you can finally use mongo


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/249#issuecomment-408378790,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AjgWu93F4hEgNg3WzomZQnzxYnpSf24zks5uKurKgaJpZM4IWJR4
.

@zawawimanja I don't want to be rude, but if you actually want help with this, you should explain what exactly didn't work and maybe provide some logs, screenshots etc.
What happened exactly? Did your phone explode? Did the installation fail? Did the mongod daemon crash? Did you get any errors?

I can probably get a functional build for 64 bit. (Have 4.1.1 working on aarch64 mostly..). Which version should i aim for?

mongodb steps in termux-ubuntu(18),maybe what you really need is google...........:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

apt-get update

apt-get install -y mongodb-org

cd /usr/bin/mongod

./mongod --dbpath /var/lib/mongodb/ --logpath /var/log/mongodb/mongodb.log --logappend &

mongo

xenial it works well in 18.....
and i would like to use a sh to start my mongodb,like this:
image

Um... y'all: did you know that @its-pointless has made a termux package called mongodb?

Install using pkg install mongodb

Works for me after giving Termux root access

image

If it works for everybody else too then we can close this issue

Doesn't seem to be in the official repo, so pkg update && pkg install mongodb didn't work. Requiring root is also less than ideal.

Yup!
I have already rooted and u rooted my smartphone three times. No more rooting....

It works for me without root??

@naveedpash in termux-ubuntu??

pkg update && pkg install mongodb
I get: Unable to locate package mongodb

@raynoppe MongoDB is currently only avaiable from @its-pointless' repository: https://github.com/its-pointless/gcc_termux

Can any one say me how to install MongoDB On termux

can you install mongodb on termux? while my device has no root access

It would be great to be able to install mongodb directly to be used with nodejs! Is it possible without using ubuntu with proot?

Install Mongodb in Termux without root

Add @its-pointless repository

  1. wget https://its-pointless.github.io/setup-pointless-repo.sh
  2. sh setup-pointless-repo.sh
  3. pkg upgrade
  4. pkg install mongodb
  5. mkdir -p $PREFIX/data/db
  6. mongod -> to start mongodb service
  7. mongo

Don't thank me yet, go donate to @its-pointless for his countless support and # @Termux

I don't know if I did something wrong but ... nothing to find the mongodb package lol, even installing the pointless repository.

Any chance to get @its-pointless repository Mongodb port to the official directory? It would make life easier.

Install Mongodb in Termux without root

Add @its-pointless repository

  1. wget https://its-pointless.github.io/setup-pointless-repo.sh
  2. sh setup-pointless-repo.sh
  3. pkg upgrade
  4. pkg install mongodb
  5. mkdir -p $PREFIX/data/db
  6. mongod -> to start mongodb service
  7. mongo
    Screenshot_20200623-020241
    Screenshot_20200623-020333
    Screenshot_20200623-020403
    Screenshot_20200623-020425

@dekubi I followed your instructions to the latter. But I still got the "Unable to locate package mongodb" error. Is there any other way to get it working? @its-pointless

Install Mongodb in Termux without root

Add @its-pointless repository

  1. wget https://its-pointless.github.io/setup-pointless-repo.sh
  2. sh setup-pointless-repo.sh
  3. pkg upgrade
  4. pkg install mongodb
  5. mkdir -p $PREFIX/data/db
  6. mongod -> to start mongodb service
  7. mongo

Hy, thank you. this work on my phone when mongodb version v4.1.13, but now when i get update i found some issue, mongodb now on my phone is version v4.2.4-1.

When i start mongod on termux, it says:

$ mongod
CANNOT LINK EXECUTABLE "mongod": library "libicudata.so.66" not found

mongodb version on my phone now is:
$ apt install mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb is already the newest version (4.2.4-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

But i can start mongodb.
Help me please

Screenshot_2020-08-17-09-03-15-66_84d3000e3f4017145260f7618db1d683
I get This error you should fix🙂

I'm getting the same error:
CANNOT LINK EXECUTABLE "mongod": library "libicudata.so.66" not found

If you really just want to use mongodb, then try to use dory mongodb server for android

If you really just want to use mongodb, then try to use dory mongodb server for android

How to use dory mongo When i connect it is not work.Show me some nodejs code plz.

mongodb is working fine in my device ( android 9)
@egeres do apt update && apt upgrade to solve your problem

Screenshot_2020-09-03-15-55-51-131_com termux

Unfortunately, that didn't seem to work for me @Hax4us. However, removing the mongodb package and following the installation instructions from scratch seemed to fix the issue:

Install Mongodb in Termux without root

Add @its-pointless repository

1. wget https://its-pointless.github.io/setup-pointless-repo.sh

2. sh setup-pointless-repo.sh

3. pkg upgrade

4. pkg install mongodb

5. mkdir -p $PREFIX/data/db

6. mongod  -> to start mongodb service

7. mongo

In my opinion this issue shouldn't be closed until the package is in the official repository.
Btw are there any plans to get it there?

I want to clear a problem that you need to create another session in termux after you type mongod

then in the other session type mongo

Boom, now it works 👍

Hi,
I followed your instructions to the latter. But I still got the "Unable to locate package mongodb" error.
I tried apt update && apt upgrade but still not working.
Can someone help me on this ?
I'm pretty new in termux

Was this page helpful?
0 / 5 - 0 ratings

Related issues

newmania picture newmania  ·  3Comments

Cyb3rD3m0n picture Cyb3rD3m0n  ·  3Comments

loveablefellow007 picture loveablefellow007  ·  3Comments

ILadis picture ILadis  ·  3Comments

StephanBeer picture StephanBeer  ·  3Comments