📜 ⬆️ ⬇️

Installing MeteorJS on Raspberry Pi B + running Arch Linux ARM



If there is someone else who, like me, suddenly decides to use RPI as a home or test server with a deployed meteor application, I hope this instruction will be useful to him. The choice fell on Arch Linux, because, as I know, at present it is the only distribution for the ARM platform that supports the work of 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 forced me to dig around on the Internet. Perhaps this instruction will seem to someone primitive, but I would like to find one before I encountered difficulties. If you find an inaccuracy, an error, 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. On my Mac, I used the ApplePi Baker application for this. After recording, insert the memory card into RPI and login using ssh:
$ ssh root@192.168.1.11 

The default password is 'root'.
')

2. Expansion of the root partition


In sufficient detail, the procedure for expanding the disk space of a partition is described in this material by the user dmitriy5181 . From myself I want to add that in order to make MongoDB work, the noatime parameter should not be set in the / etc / fstab file — Mongo did not work for me with it.

3. Set the time zone


Checking current installations
 # timedatectl status 

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

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


4. Installing node.js and dependencies


In general, for node, js, you 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 python symbolic link


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


6. Running Mongo Installed


 # systemctl start mongodb 

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

There is a systemd daemon in Arch Linux, so to add MongoDB to autorun, just run the command
 # systemctl enable mongodb 


7. Project Transfer


On the working machine (on the one where you are developing the project with MeteorJS) in the folder with the application (for example, ~ / meteorapps) we create a bundle of the desired project by 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. Install specific dependencies


To begin with, 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 with the latter everything will work too. If not, they can always be reinstalled using the command above.

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


9. Run the application


If everything is ready, the launch of the application can be done as follows.

Create a file that describes our service and how to start it.
 # nano /usr/lib/systemd/system/myapp.service 

Contents of myapp.service file
 [Unit] Description=My awesome Meteor.JS app After=mongodb.target [Service] User=pi Environment=ROOT_URL=http://192.168.1.11 PORT=80 MONGO_URL=mongodb://localhost:27017/myapp ExecStart=/usr/bin/node /home/pi/meteorapps/myapp/main.js [Install] WantedBy=multi-user.target 

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

The service is started by the command
 # systemctl start myapp 


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


If everything went smoothly, you can now log in from the working machine at 192.168.1.11 and see the face of the application.

Source: https://habr.com/ru/post/249677/


All Articles