termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.99k stars 2.99k forks source link

Package Request: MongoDB #249

Closed angrykoala closed 1 year ago

angrykoala commented 8 years ago

Mongo database for nodejs application deploy

zawawimanja commented 6 years ago

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 .

fmsouza commented 6 years ago

@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`
zawawimanja commented 6 years ago

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 .

T-vK commented 6 years ago

@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?

its-pointless commented 6 years ago

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

better319 commented 6 years ago

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

better319 commented 6 years ago

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

naveedpash commented 5 years ago

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

T-vK commented 5 years ago

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.

oscl commented 5 years ago

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

its-pointless commented 5 years ago

It works for me without root??

better319 commented 5 years ago

@naveedpash in termux-ubuntu??

raynoppe commented 5 years ago

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

Neo-Oli commented 5 years ago

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

dextercva commented 5 years ago

Can any one say me how to install MongoDB On termux

ibnusyawall commented 5 years ago

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

xela92 commented 5 years ago

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

priesteye commented 4 years ago

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
priesteye commented 4 years ago

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

Sazzo commented 4 years ago

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

Bibi56 commented 4 years ago

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

DamianoSilverhand commented 4 years ago

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

eNdson commented 4 years ago

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

theaungmyatmoe commented 4 years ago

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

egeres commented 4 years ago

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

theDarkAlpha commented 4 years ago

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

theaungmyatmoe commented 4 years ago

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.

Hax4us commented 4 years ago

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

egeres commented 4 years ago

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
T-vK commented 4 years ago

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?

ghost commented 3 years ago

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 👍

laguill commented 3 years ago

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

theDarkAlpha commented 3 years ago

@amm834 you can go here: https://dev.to/patrickweb/doing-serious-back-end-development-on-your-phone-bk2

theaungmyatmoe commented 3 years ago

Now I solved by compiling necessary myself.

Below is how you can setup mongo yourself without errors.

https://github.com/amm834/Development-Environment-Setup-For-Android

Mehedi-MHS commented 3 years ago

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

I have installed dory mongodb.I can only connect this database using express app. But i can't insert,update or delete anything. Its showing 'collection is not a function' . Do you know how to solve this problem?

theaungmyatmoe commented 3 years ago

You can install mongodb from termux,, there is no problem now . Dory is very slow and not good for development.

ghost commented 2 years ago

Screenshot_2022-07-10-10-43-21-87_84d3000e3f4017145260f7618db1d683.jpg

after setting up itspointless's repo , pkg install mongodb returns the above error

DigitalLeaves commented 2 years ago

@Gh0st-sniper that error is due to the fact that the mongodb from the pointless repository requires pcrecpp 8.43 from the same repository, which conflicts with (tries to overwrite) files in termux's pcre-4.85 package.

As I don't know how to bypass this restriction, I am currently trying to build mongo, but I am stuck due to the fact that Termux's g++ is not recognized either as GCC or CLANG by the mongo script.

$ buildscripts/scons.py install-all-meta --disable-warnings-as-errors
...
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler

In 2022, with powerful hardware (Xiaomi 5 Pad in my case) we should be able to run mongoDB natively in our Android devices.

@amm834 as far as I know you can't run MongoDB in Android anymore, please let me know how, would love to be proven wrong and be able to run my favorite NoSQL DB in my Android tablet 🤞

Bibi56 commented 2 years ago

@Gh0st-sniper that error is due to the fact that the mongodb from the pointless repository requires pcrecpp 8.43 from the same repository, which conflicts with (tries to overwrite) files in termux's pcre-4.85 package.

@DigitalLeaves a better option seems to solve the issue, and a possible solution is to write a ticket on the pointless repository to update the dependnecis. Even better to write a PR ;-). Anyway, thanks for the description of the issue!

2096779623 commented 2 years ago

@DigitalLeaves a better option seems to solve the issue, and a possible solution is to write a ticket on the pointless repository to update the dependnecis. Even better to write a PR ;-). Anyway, thanks for the description of the issue!

its-pointless no one is maintaining it now.

theaungmyatmoe commented 2 years ago

@Gh0st-sniper that error is due to the fact that the mongodb from the pointless repository requires pcrecpp 8.43 from the same repository, which conflicts with (tries to overwrite) files in termux's pcre-4.85 package.

As I don't know how to bypass this restriction, I am currently trying to build mongo, but I am stuck due to the fact that Termux's g++ is not recognized either as GCC or CLANG by the mongo script.

$ buildscripts/scons.py install-all-meta --disable-warnings-as-errors
...
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler

In 2022, with powerful hardware (Xiaomi 5 Pad in my case) we should be able to run mongoDB natively in our Android devices.

@amm834 as far as I know you can't run MongoDB in Android anymore, please let me know how, would love to be proven wrong and be able to run my favorite NoSQL DB in my Android tablet 🤞

My potential solution is to install a Linux distribution like Ubuntu in termux. That can solve problem now.

Please use, Andronix - Linux on Android (instructions to install your favorite Linux distribution) or you can install arch Linux by following termux documentation.

https://wiki.termux.com/wiki/PRoot#Installing_Linux_distributions

Bibi56 commented 2 years ago

its-pointless no one is maintaining it now.

You're right :-(. But a fork is still an option. Another, with the skills and time required, ask to become a maintainer.

zorro commented 2 years ago

@Gh0st-sniper that error is due to the fact that the mongodb from the pointless repository requires pcrecpp 8.43 from the same repository, which conflicts with (tries to overwrite) files in termux's pcre-4.85 package.

As I don't know how to bypass this restriction, I am currently trying to build mongo, but I am stuck due to the fact that Termux's g++ is not recognized either as GCC or CLANG by the mongo script.

$ buildscripts/scons.py install-all-meta --disable-warnings-as-errors
...
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler

In 2022, with powerful hardware (Xiaomi 5 Pad in my case) we should be able to run mongoDB natively in our Android devices.

@amm834 as far as I know you can't run MongoDB in Android anymore, please let me know how, would love to be proven wrong and be able to run my favorite NoSQL DB in my Android tablet 🤞

The compiler will work if you add termux's $PREFIX to the PATH in file src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/posix.py

MongoDB 5 and later versions requires the ARMv8.2-A or later microarchitecture if building on arm64.

DigitalLeaves commented 2 years ago

Hey @zorro thanks a lot, I am going to try that ASAP and will let you know. Thanks for the clue, I can't wait to run MongoDB inside my Android tablet 🤞

DigitalLeaves commented 2 years ago

Hi @zorro , I was unfortunately not lucky. I edited src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/posix.py and appended $PREFIX to the path at line 94.

env['ENV']['PATH']    = '/usr/local/bin:/opt/bin:/bin:/usr/bin:$PREFIX'

But the error is the same. Any indication of how to better set this path? Thanks

CC is gcc
gcc found in $PATH at /data/data/com.termux/files/usr/bin/gcc
/data/data/com.termux/files/usr/bin/gcc resolves to /data/data/com.termux/files/usr/bin/clang-14
CXX is g++
g++ found in $PATH at /data/data/com.termux/files/usr/bin/g++
/data/data/com.termux/files/usr/bin/g++ resolves to /data/data/com.termux/files/usr/bin/clang-14
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler
See /data/data/com.termux/files/home/downloads/mongo/build/scons/config.log for details
~/downloads/mongo $ vi src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/posix.py
zorro commented 2 years ago

Hi @zorro , I was unfortunately not lucky. I edited src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/posix.py and appended $PREFIX to the path at line 94.

env['ENV']['PATH']    = '/usr/local/bin:/opt/bin:/bin:/usr/bin:$PREFIX'

But the error is the same. Any indication of how to better set this path? Thanks

CC is gcc
gcc found in $PATH at /data/data/com.termux/files/usr/bin/gcc
/data/data/com.termux/files/usr/bin/gcc resolves to /data/data/com.termux/files/usr/bin/clang-14
CXX is g++
g++ found in $PATH at /data/data/com.termux/files/usr/bin/g++
/data/data/com.termux/files/usr/bin/g++ resolves to /data/data/com.termux/files/usr/bin/clang-14
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler
See /data/data/com.termux/files/home/downloads/mongo/build/scons/config.log for details
~/downloads/mongo $ vi src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/posix.py

replace $PREFIX with /data/data/com.termux/files/usr/bin

DigitalLeaves commented 2 years ago

Thanks @zorro ! That helped me get past that issue. Unfortunately, now it says that the C++ compiler can't link C++ programs.

Detected a aarch64 processor
Checking if target OS linux is supported by the toolchain... yes
Checking if C compiler is clang 7.0 (or Apple XCode 13.0) or newer...yes
Checking if C++ compiler is clang 7.0 (or Apple XCode 13.0) or newer...yes
Checking if linker supports -fuse-ld=lld... no
Checking if linker supports -fuse-ld=gold... no
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... no
C++ compiler g++ can't link C++ programs
See /data/data/com.termux/files/home/downloads/mongo/build/scons/config.log for details

The config.log relevant part is:

scons: Configure: Checking that the C++ compiler can link a C++ program...
build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.cpp <-
  |
  |#include <iostream>
  |#include <cstdlib>
  |
  |int main() {
  |    std::cout << "Hello, World" << std::endl;
  |    return EXIT_SUCCESS;
  |}
  |
g++ -o build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.o -c -Werror=unused-result -Woverloaded-virtual -Werror -fasynchronous-unwind-tables -ggdb -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -fno-omit-frame-pointer -fno-strict-aliasing -O2 -march=armv8.2-a -mtune=generic -fPIE -DNDEBUG -D_XOPEN_SOURCE=700 -D_GNU_SOURCE build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.cpp
g++ -o build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0_a7fbbc069dd1a95e0951dbc2ef5513b9 -Wl,--fatal-warnings -pthread -Wl,-z,now -pie -rdynamic build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.o -lm -lresolv
ld.lld: error: unable to find library -lresolv
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
scons: Configure: no

Have been looking around for a solution but couldn't find anything. Can you help me here? (I may need to buy you a beer after all this if I can finally run MongoDB on my Android :).

thunder-coding commented 2 years ago

Remove the -lresolv from the command line flags from wherever it originates. On Android, almost everything is implemented in Bionic libc located at /system/lib{,64}/libc.so.

DigitalLeaves commented 2 years ago

Thanks @thunder-coding I will try this this weekend (sorry, quite a busy week). I had a look and there are like hundreds of -lresolv flags so will have a funny time removing them all :D

Will keep you posted. If I manage to install and run it, I will definitely write a post on how to do it to help other geeks out there 🤓

DigitalLeaves commented 2 years ago

Thanks a lot @thunder-coding for your clue, I was able to get into the file SConstruct and comment this configuration that didn't seem to correctly detect Android (so it was adding -lresolv).

2441 if env.TargetOSIs('linux'):
2442     env.Append(LIBS=["m"])                                                                                                              
2443     # if not env.TargetOSIs('android'):                                                                                                 
2444        #  env.Append(LIBS=["resolv"])

Then I got an error because ar was not installed, so I installed the package binutils and that solved it.

Then, when compiling, I got several errors. This is one of them:

In file included from src/third_party/mozjs/platform/aarch64/linux/build/Unified_cpp_js_src10.cpp:47:
src/third_party/mozjs/extract/js/src/threading/posix/PosixThread.cpp:129:8: error: use of undeclared identifier 'pthread_getname_np'
  rv = pthread_getname_np(pthread_self(), nameBuffer, len);
       ^
Compiling build/opt/third_party/libstemmer_c/src_c/stem_UTF_8_porter.o
1 error generated.
scons: *** [build/opt/third_party/mozjs/platform/aarch64/linux/build/Unified_cpp_js_src10.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/mozjs/platform/aarch64/linux/build/Unified_cpp_js_src10.o failed: Error 1

I might replace pthread_getname_np (which does not seem to be available in Android) by prctl(PR_GET_NAME) as suggested here, but I am afraid to mess up something.

This is another one...

src/third_party/gperftools/dist/src/base/sysinfo.cc:158:7: error: use of undeclared identifier '__environ'; did you mean 'environ'?
  if (__environ) {            // can exist but be NULL, if statically linked
      ^~~~~~~~~
      environ
/data/data/com.termux/files/usr/include/unistd.h:76:15: note: 'environ' declared here
extern char** environ;
              ^
src/third_party/gperftools/dist/src/base/sysinfo.cc:159:21: error: use of undeclared identifier '__environ'; did you mean 'environ'?
    for (char** p = __environ; *p; p++) {
                    ^~~~~~~~~
                    environ
/data/data/com.termux/files/usr/include/unistd.h:76:15: note: 'environ' declared here
extern char** environ;
              ^
2 errors generated.
scons: *** [build/opt/third_party/gperftools/dist/src/base/sysinfo.o] Error 1

So I am starting to lose faith, @thunder-coding , @zorro . Have any of you guys managed to run Android in their devices for real? 😥