My linux world » Postgres

Postgres


Installation

  1. #!/bin/bash
  2.  
  3. echo "install postgresql server"
  4. yum -y install postgresql-server phpPgAdmin
  5.  
  6. echo "initialize database"
  7. postgresql-setup initdb
  8. sudo -u postgres createuser root
  9. sudo -u postgres createdb mydatabase
  10.  
  11. echo "activate postgresql at startup"
  12. systemctl enable postgresql.service
  13.  
  14. echo "start the server"
  15. systemctl start postgresql.service
  16.  
  17. echo "Note: by default only local users can access to phpPgAdmin."
  18. echo "Let's update the file /etc/httpd/conf.d/phpPgAdmin.conf and allow everyone."
  19. sed -i "s/\(Deny\s*from\s*All\)/#\1/i" /etc/httpd/conf.d/phpPgAdmin.conf
  20. sed -i "s/\(Allow\s*from\s*127.0.0.1\)/#\1/i" /etc/httpd/conf.d/phpPgAdmin.conf
  21. sed -i "s/\(Allow\s*from\s*::1\)/#\1/i" /etc/httpd/conf.d/phpPgAdmin.conf
  22.  
  23. echo "Now reload httpd"
  24. systemctl reload httpd.service
  25.  

Copyright © 2023 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.

Fork me on GitHub