Advertisement
load-net

PostgreSQL Linux postgres 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

Nov 23rd, 2022 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. hostnamectl set-hostname postgres
  2. mcedit /etc/hosts
  3.  
  4.  
  5.  
  6. PostgreSQL
  7.  
  8. apt update && sudo apt upgrade -y
  9. apt-get install wget sudo curl gnupg2 -y
  10. sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  11. wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
  12. apt -y update
  13. apt-get install postgresql-15 -y
  14. systemctl start postgresql
  15. systemctl enable postgresql
  16. systemctl status postgresql
  17. ss -antpl | grep 5432
  18. sudo -u postgres psql -c "SELECT version();"
  19. su postgres
  20. psql
  21. ALTER USER postgres PASSWORD '1234566';
  22. CREATE DATABASE test;
  23. \l
  24. \c test
  25. \dt
  26. exit
  27.  
  28. backup
  29. su - postgres
  30. pg_dump -d test -f test_backup.sql
  31.  
  32. restore
  33. su - postgres
  34. psql -d test -f test_backup.sql
  35.  
  36. mcedit /etc/postgresql/15/main/postgresql.conf
  37. listen_addresses = '*'
  38.  
  39. mcedit /etc/postgresql/15/main/pg_hba.conf
  40. host all all 10.20.7.1/24 password
  41.  
  42. systemctl restart postgresql
  43. systemctl status postgresql
  44.  
  45. psql -h 10.20.7.114 -U usersql
  46.  
  47.  
  48.  
  49. sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
  50. sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
  51. sudo apt install pgadmin4 -y
  52. sudo /usr/pgadmin4/bin/setup-web.sh
  53. systemctl status apache2
  54. http://localhost/pgadmin4
  55.  
  56.  
  57.  
  58. ssh-keygen -t rsa -b 4096
  59. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  60. chmod 0600 authorized_keys
  61.  
  62.  
  63. id_rsa
  64.  
  65.  
  66.  
  67. psql -h 10.20.7.123 -U postgres aster117 < /usr/src/asterisk-20.6.0/contrib/realtime/postgresql/postgresql_cdr.sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement