Part-DB

Part-DB is a web-based database for managing electronic components and distributed under the GPL-2.0 License.


Note

For this guide you should be familiar with the basic concepts of

Prerequisites

We’re using PHP in the stable version 7.4:

[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '7.4'
[isabell@stardust ~]$

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

Installation

cd to your document root, then download the latest release of Part-DB and extract it:

Note

The link to the latest version can be found at the release page.

[isabell@stardust ~]$ cd ~/html/
[isabell@stardust html]$ curl --location https://github.com/Part-DB/Part-DB/archive/master.tar.gz | tar -xzf - --strip-components=1
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
 100 37.5M  100 37.5M    0     0  5274k      0  0:00:07  0:00:07 --:--:-- 6062k
[isabell@stardust html]$

To install all needed libraries you run composer install:

[isabell@stardust html]$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 24 installs, 0 updates, 0 removals
  - Syncing golonka/bbcodeparser (dev-master a19daa7) into cache
  - Syncing tecnickcom/tcpdf (dev-master ca4f9b8) into cache
    0 [>---------------------------]    0 [>---------------------------]  - Installing psr/log (1.1.0): Extracting archive
  - Installing filp/whoops (2.4.1): Extracting archive
  - Installing geertw/ip-anonymizer (v1.1.0): Extracting archive
  - Installing golonka/bbcodeparser (dev-master a19daa7): Cloning a19daa7456 from cache
  - Installing ircmaxell/password-compat (v1.0.4): Extracting archive
  - Installing components/jquery (3.3.1): Extracting archive
  - Installing jquery-form/form (v4.2.2): Extracting archive
  - Installing kartik-v/bootstrap-fileinput (v4.5.3): Extracting archive
  - Installing symfony/polyfill-php72 (v1.11.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.11.0): Extracting archive
  - Installing symfony/var-dumper (v4.3.2): Extracting archive
  - Installing maximebf/debugbar (v1.15.0): Extracting archive
  - Installing nnnick/chartjs (v2.7.3): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing psr/container (1.0.0): Extracting archive
  - Installing pimple/pimple (v3.2.3): Extracting archive
  - Installing nikic/fast-route (v1.3.0): Extracting archive
  - Installing container-interop/container-interop (1.2.0): Extracting archive
  - Installing slim/slim (3.12.1): Extracting archive
  - Installing smarty-gettext/smarty-gettext (1.5.1): Extracting archive
  - Installing smarty/smarty (v3.1.33): Extracting archive
  - Installing snapappointments/bootstrap-select (v1.13.10): Extracting archive
  - Installing squizlabs/php_codesniffer (3.4.2): Extracting archive
  - Installing tecnickcom/tcpdf (dev-master ca4f9b8): Cloning ca4f9b86c9 from cache
  0/12 [>---------------------------]   0%
  8/12 [==================>---------]  66%
 10/12 [=======================>----]  83%
 11/12 [=========================>--]  91%
 12/12 [============================] 100%Generating autoload files
[isabell@stardust html]$

You have to create the Part-DB Database before configuring Part-DB like described here additional:

[isabell@stardust ~]$ mysql -e "CREATE DATABASE ${USER}_partdb" && echo "Created database ${USER}_partdb"
Created database isabell_partdb
[isabell@stardust ~]$

Now point your browser to your uberspace URL and follow the instructions.

You will need to enter the following information:

  • an initial administrator password: Insert the credentials you want to use for the admin user while installing Part-DB

  • your MySQL hostname, username and password: the hostname is localhost and you should know your MySQL credentials by now. If you don’t, start reading again at the top.

  • your Part-DB database name from the previous step

The installation wizard will prompt you to initialize the database and you will have to change the admin password afterwards.

Backup

To create a backup of the installation you need the data folder and the database. To backup the data directory you copy it into your home:

[isabell@stardust ~]$ cp --recursive ~/html/data ~/data
[isabell@stardust ~]$

To create a backup of your database you dump it into a file:

[isabell@stardust ~]$ mysqldump ${USER}_partdb > partdb_backup.sql
[isabell@stardust ~]$

Restore

You restore the database from the backup as follows:

[isabell@stardust ~]$ mysql --database=${USER}_partdb < partdb_backup.sql
[isabell@stardust ~]$

Note

If you get an error like “ERROR 1049 (42000): Unknown database ‘test_partdb’” you have to create the databse as described in the installation instructions.

The data directory can just be moved into the documentroot.

Updates

To update Part-DB you create a backup as described above, reinstall the new version and restore your old data.


Tested with Part-DB 0.5.9, Uberspace 7.7.10.0

Written by: 927589452