Over a million developers have joined DZone.

Installing MongoDB on 32-bit Ubuntu 15.10

With MongoDB no longer providing an option to install packages for 32-bit Linux, author Greg Brown shows us how to get around this hurdle in short order.

· Database Zone

Sign up for the Couchbase Community Newsletter to stay ahead of the curve on the latest NoSQL news, events, and webinars. Brought to you in partnership with Coucbase.

I recently decided to install MongoDB on an old Mac Mini I use for testing. This particular device is too old to run the latest version of OS X, so I'm currently running the 32-bit version of Ubuntu 15.10 on it. Unfortunately, MongoDB no longer provides installation packages for 32-bit Linux distributions, so I had to set it up manually. Since this was a fairly cumbersome process, I thought I would share the steps I took in case they are of use to anyone:

  1. Download 32-bit MongoDB binaries:
    curl -O https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.2.4.tgz
    tar -zxvf mongodb-linux-i686-3.2.4.tgz
  2. Copy MongoDB binaries to /usr/bin:
    sudo cp mongodb-linux-i686-3.2.4/bin/* /usr/bin/
  3. Download startup script:
    curl https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d > init.d
  4. Move startup script to /etc/init.d directory:
    sudo mv init.d /etc/init.d/mongod
    sudo chmod 755 /etc/init.d/mongod        
  5. Create configuration script /etc/mongod.conf:
    storage:
      dbPath: /var/lib/mongo
      journal:
        enabled: true
      engine: mmapv1
    
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
    
    processManagement:
      fork: true
    
    net:
      port: 27017
      bindIp: 0.0.0.0
  6. Add "mongodb" user:
    sudo useradd --home-dir /var/lib/mongo --shell /bin/false mongodb
    sudo passwd mongodb
  7. Create /var/lib/mongo directory:
    sudo mkdir /var/lib/mongo
    sudo chown -R mongodb /var/lib/mongo
    sudo chgrp -R mongodb /var/lib/mongo
  8. Create /var/log/mongodb directory:
    sudo mkdir /var/log/mongodb
    sudo chown -R mongodb /var/log/mongodb
    sudo chgrp -R mongodb /var/log/mongodb
  9. Create /var/run/mongod.pid file:
    sudo touch /var/run/mongod.pid
    sudo chown mongodb /var/run/mongod.pid
    sudo chgrp mongodb /var/run/mongod.pid
  10. Initialize service:
    sudo update-rc.d mongod defaults
  11. Restart server:
    sudo shutdown -r now

The Getting Started with NoSQL Guide will get you hands-on with NoSQL in minutes with no coding needed. Brought to you in partnership with Couchbase.

Topics:
ubuntu ,linux ,32-bit ,mongodb ,installation ,tip

Published at DZone with permission of Greg Brown, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}