Install MeteorJS on Raspberry Pi B + running Arch Linux ARM

  • Tutorial

If there is anyone else who, like me, suddenly decides to use RPI as a home or test server with a deployed meteor application, I hope this instruction comes in handy. The choice fell on Arch Linux, because, as far as I know, this is currently the only distribution for the ARM platform that supports MongoDB on localhost.

I usually use Mac OS X and Ubuntu, and this was my first meeting with Arch Linux, so some procedures caused questions and made me dig around the Internet. This instruction may seem primitive to some, but I would like to find one before I encounter difficulties. If you find an inaccuracy, a mistake or want to add something - you are welcome in the comments.

1. Install Arch Linux ARM

Download and unpack the archive with the img image from here , then write it to the mSD card. I used the ApplePi Baker application for this on my Mac . After recording, insert the memory card into the RPI and log in via ssh:
$ ssh root@

The default password is 'root'.

2. Extension of the root partition

The procedure for expanding the disk space of a partition is described in sufficient detail in this material by user dmitriy5181 . On my own, I want to add that to ensure MongoDB works, you should not set the noatime parameter in the / etc / fstab file - Mongo did not work with it.

3. Setting the time zone

Checking the current settings
# timedatectl status

If necessary, look what time zones are, choose the appropriate
# timedatectl list-timezones

And install it with the team
# timedatectl set-timezone Europe/Minsk

4. Install node.js and dependencies

In general, for node, js to work, you will need python2, a make utility, and a set of GCC compilers. Install everything you need
# pacman -Sy nodejs mongodb python2 make gcc

5. Creating a symlink in python

When installing python2 on Arch Linux, a symbolic link / usr / bin / python2 is created, but we need a link named python, so just copy the existing one
# cp /usr/bin/python2 /usr/bin/python

6. Running installed Mongo

# systemctl start mongodb

You can check the status of his work by the command
# systemctl status mongodb

Arch Linux has a systemd daemon , so to add MongoDB to autostart, just run the command
# systemctl enable mongodb

7. Transfer of the project

On the working machine (on the one where you are developing the project with MeteorJS) in the application folder (for example, ~ / meteorapps) we create the bundle of the desired project with the command
$ meteor bundle myapp.tgz

Then we transfer the created app.tgz to the mSD memory card and unpack
tar -xvzf myapp.tgz

8. Installation of specific dependencies

To get started, reinstall the library for working with unicode (something was wrong with the system version)
# pacman -Sy libunistring

Install packages for node.js
# npm install fibers@1.0.1 bcrypt@0.7.7

I used specific versions, but I believe that the latter will work too. If not, they can always be reinstalled using the command above.

Also for my project some libraries were needed
# npm install underscore source-map-support semver# npm install

9. Launching the application

If everything is ready, the application can be launched as follows.

Create a file in which our service will be described and how to run it
# nano /usr/lib/systemd/system/myapp.service

Myapp.service file content
Description=My awesome Meteor.JS app
Environment=ROOT_URL= PORT=80 MONGO_URL=mongodb://localhost:27017/myapp
ExecStart=/usr/bin/node /home/pi/meteorapps/myapp/main.js

Here you need to substitute the username, PORT, ROOT_URL and the path to main.js.

The service is launched by the team
# systemctl start myapp

Similar to the case with MongoDB, the service can be added to autorun
# systemctl enable myapp

If everything went smoothly, now you can go from the working machine to the address and see the face of the application.

Also popular now: