Raspbian on Raspberry pi 3B

How to install open enventory on Raspbian

This guide is to create a working Open enventory running on OS Raspbian on a Raspberry pi 3B (see https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ for information on the RPi 3B)

Initial Setup

  1. Flash a fresh copy of Raspbian onto the micro SD card. (A guide for completing this task can be found here https://www.raspberrypi.org/documentation/installation/installing-images/.

2. Once flashed insert micro SD into the RPi 3B and boot the device with monitor connected. If install completed you should now see the Raspbian desktop as shown below.

3. The first thing that should be done is to update the OS

  • open a terminal window by clicking on terminal icon on top bar or by pressing ctl+alt+t

  • run the following commands

sudo apt-get update
sudo apt-get upgrade

4. After the update has completed we will create a LAMP server on the pi. This was completed following this guide (https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress)

  • Complete the steps to set up the Apache server, install PHP, and install MYSQL mysql is outdated trying the command in the above link will give you an error use the following instead to setup the mariadb and mysql (NOTE: Wordpress does not need to be installed)

sudo apt-get install mariadb-server-10.0

5. Install the following packages to prepare for Open enventory

sudo apt-get install -y php-mysql php-gd php-mbstring php-pear ghostscript imagemagick
sudo service apache2 restart

6. Create MYSQL root pwd by entering the following command in terminal the default password is blank. We will subsequently set it up so sudo is not required so that we can login online to create our databases for oe. When asked for a password after command 4, use the password we just set up for mysql_secure_installation.

sudo mysql_secure_installation
sudo service apache2 restart
sudo service mariadb restart
sudo mysql -u root -p
MariaDB [(none)]> USE mysql;
MariaDB [mysql]> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> exit;
sudo service mariadb restart

7. Download Open Enventory image and set up on apache server (exact link to download can be found at https://sourceforge.net/projects/enventory/files/?source=navbar) (NOTE: in terminal commands below, the open_enventory_2019-07-24.zipshould be replaced with the version you wish to use) - Once downloaded unzip and copy to the right location which we will need to make.

cd ~/Downloads/
wget https://sourceforge.net/projects/enventory/files/open_enventory_2019-07-24.zip
unzip open_enventory_2019-07-24.zip
sudo mkdir /var/www/html/oe
sudo cp -r ~/Downloads/open_enventory_2019-07-24/. /var/www/html/oe

8. Now go to the http://xx.xx.xx.xx/oe

With xx.xx.xx.xx: is the server’s ip address

To find the ip address of your raspberry pi on your local network run the following command. The result will yield many things we only care about the ip address number directly following inet

ifconfig

going to servers address in a browser on a device on the local network will look like the following

  • Database: to create a new database, type the desired database’s name

  • Username: root

  • Password: use the mariadb password that was set up in step 6 of this tutorial

9. If successful after clicking inventory you should see the following page

10. Modify .htaccess file

sudo nano /var/www/html/oe/.htaccess

Modify the content of the file as in this screenshot. Important: these settings are for the server with configuration as indicated in the top of this tutorial

Save the file by typing ctrl+o then hitting the enter key then exit by typing ctrl+x. You will then have to tell the raspberry pi to use the settings in the .htaccess file. Navigate to 000-default.conf and add add the Directory lines so that the file is identical to the image below.

sudo nano /etc/apache2/sites-available/000-default.conf

Then restart the apache server

sudo service apache2 restart

You are done with the initial set up here. Open Enventory is ready to be used at this time.

11. Note this can only be accessed on the local server if you wish to access the OE database on any network you can set up ngrok. If you sign up you can use the given link indefinitely, and using https://freedns.afraid.org/ you can make a DNS to access the database easily.

12. Install ngrok (see https://thisdavej.com/how-to-host-a-raspberry-pi-web-server-on-the-internet-with-ngrok/ for more details)

sudo npm install --unsafe-perm -g ngrok

13. Start the ngrok server

ngrok http 80

the output should look as follows (note if you close the terminal window the session will be closed

by navigating to the link provided by your output in a web browser with the directory oe for this example it would be http://2057a4d3.ngrok.io/oe should get you to the open enventory login page from any device on any network.