Saturday , 27 April 2024

Bagaimana Instal PostgreSQL di Linux Ubuntu

Awal mula saya menulis tutorial instalasi postgreSQL ini dimaksudkan untuk membuat catatan pribadi agar saya mudah dalam mencari catatan apa yang telah saya kerjakan. Instalasi ini saya lakukan pada VPS yang saat ini banyak sekali gunanya diantaranya adalah membuat server database, membuat server web, membuat server data cloud dan lain sebangsanya.
Apa sich hubungan instal server ini dengan bisnis saya? ada karena saya berbisnis menjual software sekolah atau software pesantren yang mana databasenya memakai postgreSQL. Saat ini software saya juga sudah berkembang untuk pengguna android sehingga penggunaan VPS sangat diperlukan agar setiap saat bisa diakses dengan android.
Pada tutorial singkat ini bukan maksud saya untuk memamerkan atau unjuk kepandaian karena saya bukanlah orang yang memiliki kepandaian yang super, saya hanya bercerita apa yang telah saya kerjakan dan dari cerita saya semoga ada orang yang terbantu, apa salahnya jika cerita saya membuat seseorang berpikir untuk membuat bisnis server yang menyediakan database atau komputer sistem data ‘awan’. Cerita instalasi postgreSQL ini sudah saya lakukan jadi dipastikan langkah yang ada pasti benar dan berhasil di server saya.
  1. update sistem dengan perintah : sudo apt-get update -y sudo apt-get upgrade -y
  2. instal postgre : sudo apt-get update -y sudo apt-get upgrade -y
  3. agar dia berjalan walau direstart : sudo systemctl start postgresql sudo systemctl enable postgresql
  4. kemudian kita masuk postgre nya : sudo -u postgres psql
  5. melihat info postgre : conninfo
  6. membuat password : password tulis_passwordnya_disini
  7. jika sudah selesai dan ingin keluar dari postgre ketik : q
Untuk membukanya saya biasa menggunakan pgadmin 4 yang saya instal di komputer lainnya (harus mempunyai jaringan) ini kelemahan saya, saya tidak bisa mengatur jaringan lokal ubuntu ini, maka saya memakai jaringan internet. Mungkin bapak bisa browsing untuk mengatur jaringan lokal ini
Cara Instal PostgreSQL di Linux Ubuntu
Atau membuat phppgadmin caranya sebagai berikut :
  1. instal phppgadmin : sudo apt-get install apache2 phppgadmin
  2. edit config nya : sudo nano /etc/apache2/conf-available/phppgadmin.conf
  3. kata “Require local” diganti “Allow From all”Alias /phppgadmin/usr/share/phppgadmin<Directory /usr/share/phppgadmin><IfModule mod_dir.c>DirectoryIndex index.php</IfModule>AllowOverride None# Only allow connections from localhost:#Require localAllow From all<IfModule mod_php.c> php_flag magic_quotes_gpc Off php_flag track_vars On #php_value include_path .</IfModule><IfModule !mod_php.c> <IfModule mod_actions.c> <IfModule mod_cgi.c> AddType application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php </IfModule> <IfModule mod_cgid.c> AddType application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php </IfModule> </IfModule></IfModule></Directory>
  4. kemudian config php inc nya diedit juga dengan : sudo nano /etc/phppgadmin/config.inc.php
    <?php/**// Display name for the server on the login screen $conf['servers'][0]['desc'] = 'PostgreSQL';// Hostname or IP address for server. Use '' for UNIX domain socket. // use 'localhost' for TCP/IP connection on this computer $conf['servers'][0]['host'] = 'localhost';// Database port on server (5432 is the PostgreSQL default) $conf['servers'][0]['port'] = 5432;// Database SSL mode // Possible options: disable, allow, prefer, require // To require SSL on older servers use option: legacy // To ignore the SSL mode, use option: unspecified $conf['servers'][0]['sslmode'] = 'allow';// For a PostgreSQL 8.1+ server, you can set this to 'postgres'. $conf['servers'][0]['defaultdb'] = 'template1';// You can set these to '' if no dumper is available. $conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump'; $conf['servers'][0]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';// your browser preference. $conf['default_lang'] = 'auto'; $conf['autocomplete'] = 'default on'; $conf['extra_login_security'] = false; $conf['owned_only'] = false;// Display comments on objects? Comments are a good way of documenting // a database, but they do take up space in the interface. $conf['show_comments'] = true;// Display "advanced" objects? Setting this to true will show // aggregates, types, operators, operator classes, conversions, // languages and casts in phpPgAdmin. These objects are rarely // administered and can clutter the interface. $conf['show_advanced'] = false; // Display "system" objects? $conf['show_system'] = false;// Minimum length users can set their password to. $conf['min_password_length'] = 1;// Width of the left frame in pixels (object browser) $conf['left_width'] = 200;// Which look & feel theme to use $conf['theme'] = 'default';// Show OIDs when browsing tables? $conf['show_oids'] = false; // Max rows to show on a page when browsing record sets $conf['max_rows'] = 30;// Max chars of each field to display by default in browse mode $conf['max_chars'] = 50;// Send XHTML strict headers? $conf['use_xhtml_strict'] = false;// Base URL for PostgreSQL documentation. // '%s', if present, will be replaced with the PostgreSQL version // (e.g. 8.4 ) $conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/';// Configuration for ajax scripts // Time in seconds. If set to 0, refreshing data using ajax will be disabled (locks and activity pages) $conf['ajax_refresh'] = 3; $conf['plugins'] = array();/***************************************** * Don't modify anything below this line * *****************************************/$conf['version'] = 19;?>
  5. restrat service : sudo systemctl restart apache2 sudo systemctl restart postgresql
  6. cara akses phppgadmin : http://ipserver/phppgadmin
Cara-cara ini ditempat saya bekerja dengan baik, jika cara ini ditempat sampeyan semua tidak bekerja dengan maksimal maka janganlah protes kepada saya, karena mungkin saja kondisi hardware kita berbeda sehingga mempengaruhi driver atau software yang dibutuhkan oleh OS dengan demikian juga pengaruh pada beberapa jenis settingan software yang berkaitan dengan server. Tanyakan saja pada support atau data center yang bersangkutan saya yakin mereka akan memberikan pelayanan yang terbaik yang bisa mereka berikan.

About Fauzi

Nama saya Fauzi lebih dikenal dengan nama Fauziwong, saya seorang aktifis dibidang pendidikan khususnya pembangunan sistem informasi sekolah terpadu, pengalaman saya lebih dari 10 tahun dimulai tahun 2006, baik untuk bisnis via internet online dan juga off line

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.