PartKeepr 1.4.0 installation on a Raspberry Pi

From PartKeepr Wiki
Revision as of 08:22, 4 September 2020 by Cabottech (talk | contribs) (Created page - WIP (need to upload images))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This guide will take you through the process of installing PartKeepr 1.4.0 on a Raspberry Pi to run your own parts inventory management system.

We’re assuming familiarity with basic Linux concepts, such as entering commands into a terminal, SSH, etc. We won’t be covering those concepts here.

Disclaimer: This step-by-step example is provided merely for informational purposes, in the hopes of helping others to get going with PartKeepr. If you follow the steps described here, you do so entirely at your own risk. Be especially mindful that if your system will be exposed to the Internet or any untrusted network, you must consult with a security expert before deploying PartKeepr or any other technology.

Fresh Raspberry Pi

Note: We are using an older version of Raspbian (stretch instead of the newer buster) to get a working version of PHP 7.0 with ACPu cache. The newer PHP 7.3 ACPu cache used by buster wasn’t compatible with PartKeepr during our testing (it is believed this compatibility issue is due to a Symfony2 framework limitation).


Download a Raspbian stretch Lite SD card image: We used the last stretch release: (354MB) from the Raspbian Lite Archives 2019-04-09.

Prepare a new SD card with the downloaded image: We used the Raspberry Pi Imager utility.

Power on a Raspberry Pi with the new SD card inserted and a HDMI display and keyboard attached (only required for first boot). We are using a Raspberry Pi 3 which has provided good performance to date. From the terminal, run:

sudo raspi-config

Using the menu, we set the following:

  • (Optional) Set the hostname to “PartKeepr”,
  • Changed default user password,
  • Enabled the SSH server.

(Optional) Set the IP address to be static as follows:

sudo nano /etc/dhcpcd.conf

See the bottom of this config file for example static IP configurations, and use as required.

Shutdown the Raspberry Pi with the following command:

sudo shutdown -h 0

We then unplugged the display and keyboard, moved the Raspberry Pi to it’s location (server cabinet), and connected an Ethernet cable for network access.

Power on the Raspberry Pi and access via SSH. The following of this guide assumes access to the device via SSH and later a web browser.

Update with the following commands:

sudo apt-get update
sudo apt-get upgrade

Installing PartKeepr 1.4.0

The following is heavily derived from the PartKeepr on Debian "Jessie" instructions.

Install prerequisites

Install the apache web server:

sudo apt-get install apache2 apache2-doc

Install curl and ntp:

sudo apt-get install curl ntp

Install the mariadb database server and client:

sudo apt-get install mariadb-server-10.0 mariadb-client-10.0

Note: By default the mariadb server is installed with no root password. Use the following command to run the security wizard. Set a root password and answer yes (default) to other questions if unsure:

sudo mysql_secure_installation

Install PHP 7.0 and extensions

sudo apt-get install php7.0 php-apcu php-apcu-bc php7.0-bcmath php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-xml

Verify apache is working

In a web browser go to the Raspberry Pi’s IP address and confirm that the default Apache “It works!” page is displayed.

Download PartKeepr 1.4.0

From the home directory, run:


Unzip with this command:


Move to the www directory:

sudo mv -R partkeepr-1.4.0 /var/www/partkeepr

Modify PartKeepr directory and file permissions

PartKeepr needs the ability to write into certain directories and files within its installation.

We opted to set our PartKeepr installation's ownership and permissions so that its files and directories are owned by our "admin" user and the "www-data" group. We set the files readable and writable by the owner and group, but inaccessible to everyone else. It is necessary to give the www-data group write access to the files because PartKeepr requires the ability to modify its files.

The "www-data" group already exists in the Debian system. If you are using a different operating system, you may need to check which group owns the web data files and make the appropriate adjustments in the commands below.

We configured ownership and permissions as follows:

sudo chown -R pi:www-data /var/www/partkeepr
sudo find /var/www/partkeepr -type d -exec chmod 770 {} +
sudo find /var/www/partkeepr -type f -exec chmod 660 {} +

Configure Apache

Enable the Apache modules userdir and rewrite:

sudo a2enmod userdir rewrite

Modify Apache settings:

sudo nano /etc/apache2/apache2.conf

Add these lines:

<Directory /var/www/partkeepr/>

AllowOverride All


Exit nano with ctrl+x and save the file.

Modify Apache web root:

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

Comment the line DocumentRoot /var/www/html by placing a # in front of it and add a similar line which points to /var/www/partkeepr/web.

# DocumentRoot /var/www/html
DocumentRoot /var/www/partkeepr/web

Exit nano with ctrl+x and save the file.

Make the same change to /etc/apache2/sites-available/default-ssl.conf:

sudo nano /etc/apache2/sites-available/default-ssl.conf
# DocumentRoot /var/www/html
DocumentRoot /var/www/partkeepr/web

Exit nano with ctrl+x and save the file.

Configure PHP

Modify PHP configuration:

sudo nano /etc/php/7.0/apache2/php.ini

Note: In nano you can find/search for text using ctrl+w (Where Is), which may be useful for the following:

Locate the line:

max_execution_time = 30

change to:

max_execution_time = 150

Locate the line:

upload_max_filesize = 2M

change to:

upload_max_filesize = 8M

Locate the line:

;date.timezone =

Uncomment it by removing the initial semicolon and add an appropriate time zone:

date.timezone = Australia/Brisbane

In our case, we used Australia/Brisbane. You can look up the possible time zone settings in the PHP manual here: [1]

Exit nano with ctrl+x and save the file.

APC Metadata Caching

Instructions adapted from the APC Metadata Caching page.

Symfony, per default, uses a deeply nested filesystem structure. This might be a problem on systems with slow I/O, like a Raspberry Pi. You can configure PartKeepr to use APC as metadata cache, greatly decreasing the required I/O performance.

The PHP APC Modules were installed in a previous step. We now need to make the following changes:

sudo nano /var/www/partkeepr/app/config/config_framework.yml

Note that the indentation is mandatory

Add the following snippet to the top of the file:

       class: Doctrine\Common\Cache\ApcCache
           - [setNamespace, [""]]

Below the framework, insert the following lines so that it reads:

        cache: "app.doctrine.apc_cache"

Reload Apache configuration

Configuration changes made above will not take effect until Apache is instructed to reload its configuration files:

sudo service apache2 restart

PartKeepr setup

Open a web browser and navigate to the PartKeepr setup wizard. I.e. assuming your Raspberry Pi's IP address is, you should go to:

You should see the setup wizard: