2016-07-09 12:43:50 +00:00
|
|
|
# Installation
|
2012-05-19 21:59:41 +00:00
|
|
|
|
2016-07-09 12:43:50 +00:00
|
|
|
**TL;DR:** Download the
|
|
|
|
[latest release archive](https://github.com/PrivateBin/PrivateBin/releases/latest)
|
|
|
|
and extract it in your web hosts folder were you want to install your PrivateBin
|
2016-08-08 12:43:30 +00:00
|
|
|
instance. We try to provide a safe default configuration, but advise you to check
|
|
|
|
the options and adjust them as you see fit.
|
|
|
|
|
|
|
|
## Basic installation
|
2012-05-19 21:59:41 +00:00
|
|
|
|
2015-09-19 15:23:10 +00:00
|
|
|
### Requirements
|
|
|
|
|
2016-08-08 12:43:30 +00:00
|
|
|
- PHP version 5.3 or above
|
2015-09-19 15:23:10 +00:00
|
|
|
- GD extension
|
2016-08-08 12:43:30 +00:00
|
|
|
- mcrypt extension (optional, but strongly recommended)
|
2015-09-19 15:23:10 +00:00
|
|
|
- some disk space or (optional) a database supported by PDO
|
2016-08-08 12:43:30 +00:00
|
|
|
- ability to create files and folders in the installation directory and the PATH
|
2015-09-19 15:23:10 +00:00
|
|
|
- A web browser with javascript support
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
2016-07-09 12:43:50 +00:00
|
|
|
In the file `cfg/conf.ini` you can configure PrivateBin. A `cfg/conf.ini.sample`
|
|
|
|
is provided containing all options on default values. You can copy it to
|
|
|
|
`cfg/conf.ini` and adapt it as needed. The config file is divided into multiple
|
2015-10-22 19:13:15 +00:00
|
|
|
sections, which are enclosed in square brackets.
|
2015-09-19 15:23:10 +00:00
|
|
|
|
2016-07-09 12:43:50 +00:00
|
|
|
In the `[main]` section you can enable or disable the discussion feature, set
|
|
|
|
the limit of stored pastes and comments in bytes. The `[traffic]` section lets
|
|
|
|
you set a time limit in seconds. Users may not post more often then this limit
|
|
|
|
to your PrivateBin installation.
|
2015-09-19 15:23:10 +00:00
|
|
|
|
|
|
|
More details can be found in the
|
2016-08-08 17:09:51 +00:00
|
|
|
[configuration documentation](https://github.com/PrivateBin/PrivateBin/wiki/Configuration).
|
2015-09-19 15:23:10 +00:00
|
|
|
|
|
|
|
## Advanced installation
|
|
|
|
|
|
|
|
### Changing the path
|
|
|
|
|
|
|
|
In the index.php you can define a different `PATH`. This is useful to secure your
|
|
|
|
installation. You can move the configuration, data files, templates and PHP
|
2016-08-08 12:43:30 +00:00
|
|
|
libraries (directories cfg, data, lib, tpl, tst and vendor) outside of your document
|
2015-09-19 15:23:10 +00:00
|
|
|
root. This new location must still be accessible to your webserver / PHP process
|
2016-08-08 17:09:51 +00:00
|
|
|
([open_basedir setting](https://secure.php.net/manual/en/ini.core.php#ini.open-basedir)).
|
2015-09-19 15:23:10 +00:00
|
|
|
|
|
|
|
> #### PATH Example
|
2016-07-09 12:43:50 +00:00
|
|
|
> Your PrivateBin installation lives in a subfolder called "paste" inside of
|
|
|
|
> your document root. The URL looks like this:
|
2012-05-19 21:59:41 +00:00
|
|
|
> http://example.com/paste/
|
2016-07-09 12:43:50 +00:00
|
|
|
>
|
|
|
|
> The full path of PrivateBin on your webserver is:
|
2012-05-19 21:59:41 +00:00
|
|
|
> /home/example.com/htdocs/paste
|
|
|
|
>
|
|
|
|
> When setting the path like this:
|
2016-07-09 12:43:50 +00:00
|
|
|
> define('PATH', '../../secret/privatebin/');
|
|
|
|
>
|
2016-08-08 12:43:30 +00:00
|
|
|
> PrivateBin will look for your includes / data here:
|
2016-07-09 12:43:50 +00:00
|
|
|
> /home/example.com/secret/privatebin
|
|
|
|
|
|
|
|
### Web server configuration
|
|
|
|
|
|
|
|
A `robots.txt` file is provided in the root dir of PrivateBin. It disallows all
|
|
|
|
robots from accessing your pastes. It is recommend to place it into the root of
|
|
|
|
your web directory if you have installed PrivateBin in a subdirectory. Make sure
|
|
|
|
to adjust it, so that the file paths match your installation. Of course also
|
|
|
|
adjust the file if you already use a `robots.txt`.
|
|
|
|
|
|
|
|
A `.htaccess.disabled` file is provided in the root dir of PrivateBin. It blocks
|
|
|
|
some known robots and link-scanning bots. If you use Apache, you can rename the
|
|
|
|
file to `.htaccess` to enable this feature. If you use another webserver, you
|
|
|
|
have to configure it manually to do the same.
|
2012-05-19 21:59:41 +00:00
|
|
|
|
2015-09-19 15:23:10 +00:00
|
|
|
### Using a database instead of flat files
|
|
|
|
|
|
|
|
In the configuration file the `[model]` and `[model_options]` sections let you
|
2016-07-09 12:43:50 +00:00
|
|
|
configure your favourite way of storing the pastes and discussions on your
|
|
|
|
server.
|
2015-09-19 15:23:10 +00:00
|
|
|
|
2016-08-08 12:43:30 +00:00
|
|
|
`Filesystem` is the default model, which stores everything in files in the
|
2016-07-09 12:43:50 +00:00
|
|
|
data folder. This is the recommended setup for most sites.
|
2015-09-19 15:23:10 +00:00
|
|
|
|
|
|
|
Under high load, in distributed setups or if you are not allowed to store files
|
2016-08-08 12:43:30 +00:00
|
|
|
locally, you might want to switch to the `Database` model. This lets you
|
2016-07-09 12:43:50 +00:00
|
|
|
store your data in a database. Basically all databases that are supported by
|
2016-08-08 17:11:07 +00:00
|
|
|
[PDO](https://secure.php.net/manual/en/book.pdo.php) may be used. Automatic table
|
2015-09-19 15:23:10 +00:00
|
|
|
creation is provided for `pdo_ibm`, `pdo_informix`, `pdo_mssql`, `pdo_mysql`,
|
|
|
|
`pdo_oci`, `pdo_pgsql` and `pdo_sqlite`. You may want to provide a table prefix,
|
2016-07-09 12:43:50 +00:00
|
|
|
if you have to share the PrivateBin database with another application or you want
|
|
|
|
to use a prefix for
|
|
|
|
[security reasons](https://security.stackexchange.com/questions/119510/is-using-a-db-prefix-for-tables-more-secure).
|
|
|
|
The table prefix option is called `tbl`.
|
2015-09-19 15:23:10 +00:00
|
|
|
|
|
|
|
> #### Note
|
2016-08-08 12:43:30 +00:00
|
|
|
> The `Database` model has only been tested with SQLite, MySQL and PostgreSQL,
|
|
|
|
> although it would not be recommended to use SQLite in a production environment.
|
|
|
|
> If you gain any experience running PrivateBin on other RDBMS, please let us
|
|
|
|
> know.
|
2012-05-19 21:59:41 +00:00
|
|
|
|
2016-08-08 12:43:30 +00:00
|
|
|
For reference or if you want to create the table schema for yourself (replace
|
|
|
|
`prefix_` with your own table prefix):
|
2012-05-19 21:59:41 +00:00
|
|
|
|
|
|
|
CREATE TABLE prefix_paste (
|
2015-11-01 16:10:36 +00:00
|
|
|
dataid CHAR(16) NOT NULL,
|
|
|
|
data BLOB,
|
2012-05-19 21:59:41 +00:00
|
|
|
postdate INT,
|
|
|
|
expiredate INT,
|
|
|
|
opendiscussion INT,
|
2015-11-01 16:10:36 +00:00
|
|
|
burnafterreading INT,
|
|
|
|
meta TEXT,
|
|
|
|
attachment MEDIUMBLOB,
|
|
|
|
attachmentname BLOB,
|
|
|
|
PRIMARY KEY (dataid)
|
2012-05-19 21:59:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE prefix_comment (
|
|
|
|
dataid CHAR(16),
|
|
|
|
pasteid CHAR(16),
|
|
|
|
parentid CHAR(16),
|
2015-11-01 16:10:36 +00:00
|
|
|
data BLOB,
|
|
|
|
nickname BLOB,
|
|
|
|
vizhash BLOB,
|
|
|
|
postdate INT,
|
|
|
|
PRIMARY KEY (dataid)
|
|
|
|
);
|
|
|
|
CREATE INDEX parent ON prefix_comment(pasteid);
|
|
|
|
|
|
|
|
CREATE TABLE prefix_config (
|
|
|
|
id CHAR(16) NOT NULL, value TEXT, PRIMARY KEY (id)
|
2012-05-19 21:59:41 +00:00
|
|
|
);
|
2015-11-01 16:10:36 +00:00
|
|
|
INSERT INTO prefix_config VALUES('VERSION', '0.22');
|