Screenshot 2023 05 17 at 11 32 15 PrivateBin

Cara Install Privatebin di Linux: Pastebin Open Source

Gunakan Privatebin, pastebin open source, sebagai tempat mencadangkan teks. Mari kita bahas cara install privatebin di Linux.

Privatebin, Pastebin Open Source

Pernahkah kamu berhasrat menyediakan layanan bak Pastebin di peladen (server) sendiri? Realisasikan ide dengan PrivateBin!

Privatebin adalah pastebin open source dan minimalis untuk menyimpan teks dalam enkripsi 256 bits AES. Pihak pengembang mengatakan bahwa pemilik server pun tidak punya informasi tentang data yang tersimpan.

Cara Install Privatebin di Linux

Kita membutuhkan php, mariadb, git, dan nginx untuk memasang PrivateBin. Sebelum memulai, pastikan kamu sudah menyiapkan paket-paketnya.

$ sudo apt install -y mariadb-server mariadb-client git nginx php php-xml php-mbstring php-mysql php-json php-pdo 

Kita unduh berkas PrivateBin melalui teknik git clone di direktori /var/www.

# cd /var/www/
# git clone https://github.com/PrivateBin/PrivateBin.gitCode language: PHP (php)

Beri akses Nginx di direktori Privatebin.

# chown -R www-data:www-data PrivateBin/Code language: PHP (php)

Kita buat konfigurasi Nginx untuk Privatebin agar dapat diakses.

# vim /etc/nginx/nginx.confCode language: PHP (php)

Jangan lupa ubah value sesuai konfigurasi kamu.

server {
    root /var/www/privatebin/PrivateBin;
    index  index.php index.html index.htm;
    server_name txt.radhitya.org;
    client_max_body_size 500M;	
autoindex off;
#Hide the nginx version.
server_tokens off;
#Hide the PHP version.
fastcgi_hide_header X-Powered-By;
proxy_hide_header X-Powered-By;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }
  }Code language: PHP (php)

Kali ini kita akan menyiapkan pemasangan MariaDB. Silahkan lakukan setup untuk pengguna baru.

# mysql_secure_installationCode language: PHP (php)

Jika sudah setup, masuk ke mysql dengan akun kamu.

# mysql -u root -pCode language: PHP (php)

Kita buat database baru bernama privatebin.

MariaDB [(none)]> CREATE DATABASE privatebin;Code language: CSS (css)

Bikin pengguna dan kata sandi melalui perintah di bawah.

MariaDB [(none)]> CREATE USER 'privatebin'@'localhost' IDENTIFIED BY 'newpassword';Code language: JavaScript (javascript)

Beri akses kekuasaan pengguna terhadap database privatebin.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON privatebin.* TO 'privatebin'@'localhost';
MariaDB [(none)]> exit;Code language: PHP (php)

Ubah direktori ke Privatebin.

# cd /var/www/PrivateBin/cfg/Code language: PHP (php)

Salin berkas contoh conf.sample.php dan tempel sebagai conf.php.

# cp conf.sample.php conf.phpCode language: CSS (css)

Kita ubah konfigurasi agar data tersimpan pada database.

# vim conf.phpCode language: CSS (css)
; [model]
; name of data model class to load and directory for storage
; the default model "Filesystem" stores everything in the filesystem
; class = Filesystem
; [model_options]
; dir = PATH "data"

[model]
class = Database
[model_options]
dsn = "mysql:host=localhost;dbname=privatebin;charset=UTF8"
tbl = "privatebin_" ; table prefix
usr = "privatebin"
pwd = "newpassword"
opt[12] = true ; PDO::ATTR_PERSISTENTCode language: JavaScript (javascript)

Terakhir, reset nginx agar perubahan dapat dimuat.

# service nginx reloadCode language: PHP (php)

Artikel Terkait

Leave a Reply

Your email address will not be published. Required fields are marked *