Skip to content
Jan Böhmer edited this page Jan 19, 2019 · 8 revisions

Installation

This manual only describes the installation of Part-DB, the infrastructure (Apache, PHP, MySQL) is required. If you want to install your own web server, you must first install the necessary server components. How to do this is described in the EN: Requirements).

Create the database

First, a new database for part DB must be created on the MySQL server. It is also recommended that you create a new user, which is exclusively intended for Part-DB.

The user must have all rights to the database of Part-DB, otherwise the database updates may not work properly!

The database and the user can be created e. g. via the web interface phpMyAdmin, or in the console (replace database name, user and password respectively):

mysql -u root -p
CREATE DATABASE `DATABASE NAME`;
GRANT ALL ON `DATABASE NAME`.* TO 'USERNAME'@localhost IDENTIFIED BY 'PASSWORD';
quit

then test briefly to see if database access is working:

mysql -u USERNAME -DATABASENAME -p
quit

Download and unpack Part-DB

Then you download Part-DB and unpack the archive into the directory of the web server (often "/var/www/"under Linux).

Please download the link to the latest version from the Download page or download the current development version!

wget -O part-db.tar.gz https://github.com/jbtronics/Part-DB/archive/master.tar.gz
sudo tar -xzf part-db.tar.gz -C /var/wwww

If you don't have direct access to the server (e. g. via SSH), you have to upload the files to the server via FTP. To do this, you download the archive on your personal computer, unpack it and then copy the unpacked files to the server via FTP client (e. g. FileZilla).

Set access rights for directories

If you have installed Part-DB directly on a Linux/UNIX server according to the instructions above (wget/tar) (not uploaded via FTP!), this section can be skipped because the owner and the rights of all files are already set correctly (according to this section) in the downloaded archive. When unpacking with the above-mentioned tar command, the rights for the unzipped files are then automatically taken over from the archive.

If you install Part-DB in another way (e. g. via FTP-Upload), or if you are unsure, you should not skip this section!

For Part-DB to work correctly and ensure maximum security, the file permissions must still be set. The permissions of all directories should be set to 555, the permissions of all files should be set to 444. Only the directories "data" and "documentation/dokuwiki/data" have to be set recursively to 755 and 644, respectively.

Too generous file permissions (e. g. 777) are very convenient because they allow Part-DB to work without any problems, but they pose an unnecessary security risk and should not be used under any circumstances (if this is not absolutely necessary due to the existing infrastructure)!

In addition, all files should belong to the owner of Apache (normally "www-data"on Linux).

All this can be done on a Linux/UNIX server with the following commands:

cd /var/wwww
sudo chown -R www-data: www-data part-db
find part-db -type d -print0 | sudo xargs -0 chmod 555
find part-db -type f -print0 | sudo xargs -0 chmod 444
find part-db/data -type d -print0 | sudo xargs -0 chmod 755
find part-db/data -type f -print0 | sudo xargs -0 chmod 644

If you do not have direct access to the server's file system, you can set the permissions with an FTP client.

If you upload the files to the server via FTP, the owner of the files is often an FTP user, not the Apache user. In this case, the rights for "data" 775 or 664, or possibly. even 777 or 666, so that Apache also gets write permissions in this directory! In this case, you also have to create a folder templates_cin the Part-DB root folder, and give it the same rights, so Part-DB can write its template cache.

However, some hosters allow you to change the owner of the files (uploaded via FTP) via a web interface of the hoster. This is the safer version than the file permissions and should therefore be preferred!

Set SELinux Permission

If SELinux is active on the system (this can be checked with sestatus), then you have to allow write access to the Part-DB folder separately, this can be done with the following command: chcon -R -t httpd_sys_content_rw_t /var/www/part-db

Installation of the dependencies

On systems with console access

Part-DB usesComposer for dependency management, which means that most of the required libraries are not part of the Part-DB repository, but need to be downloaded first:

To do this, the command php composer.phar install -o --no-dev(-o option should be omitted if the installation is used to further develop the code)** must be executed in the main directory of Part-DB. The command loads the required libraries automatically from the Internet in the correct version and sets them up.

On systems without console access

If it is not possible to run console commands on a system, then this Zip file must be downloaded and the vendor/ folder from ZIP must be copied to the main Part-DB directory. For a release version it is recommended to use vendor_optimized. zip, which is located on the release page. This version offers a speed advantage, but needs to be replaced with the "normal" vendor. zip when upgrading to a non-release version.

Open Part-DB in your browser

Part-DB is now installed and can be accessed via http://localhost/part-db/ in any browser.

However, this address only works on the server itself, for other PCs in the same network you have to replace "localhost" with the IP address of the server, e. g. <http://192.168.1.100/part-db/ Instead of the IP address, you can also use the computer name of the server, e. g. http://name-of-server/part-db/ (if the server has a dynamic IP, this variant should be preferred).

Configuration of part DB

The first time you call Part-DB, an installation wizard is started automatically. You must enter the data for the database you have just created and its user. You will then be informed that the database needs to be updated. With this update, all tables in the database are created or updated if they already exist.

If this update fails, you should check whether the specified user has sufficient rights to the database. Missing permissions are the most common cause of failed database updates!

If the update has been completed successfully, Part-DB is fully operational!

Check function of. htaccess

Whether the server really interprets the. htaccess files correctly can be easily verified by trying to open the page http://localhost/part-db/data/, for example. The error message "403 Forbidden" must appear there. In case the directory protection doesn't work, there is a "index. html" in "data"which redirects directly to the start page of Part-DB. This does not replace the directory protection of. htaccess!

Updates

If you want to update an existing installation of Part-DB, you just have to unpack the downloaded package of the new Part-DB version in the installation folder of Part-DB (or with the command git pull, if Part-DB was downloaded with git). The existing files must be overwritten. For a clean update, which deletes the files that are no longer needed, you have to delete all files and directories, except the directory "data". All your settings and uploaded files are stored in the directory "data", they must not be deleted.

Important: After each update the command php composer. phar update -o has to be executed in order to update the required libraries and references to internal components. If no console access is possible, a vendor/ folder should be copied from a current vendor.zip to the main directory.

For part DB prior to version 0.3.0, the "data" directory did not yet exist. Here you need to back up the file "config. php" and the directories "backup" (if used), "img" (if files have been uploaded) and "media" (if available).

It is recommended to make a backup of the database and the "data" directory before each update. The developers of Part-DB assume no liability for damages caused by failed updates.

After the update you should check if the permission has the values you desire.