{"id":5586,"date":"2023-12-02T11:37:14","date_gmt":"2023-12-02T11:37:14","guid":{"rendered":"https:\/\/natsav.com\/blog\/?p=5586"},"modified":"2024-01-30T12:24:27","modified_gmt":"2024-01-30T12:24:27","slug":"install-postgresql-on-cyber-panel","status":"publish","type":"post","link":"https:\/\/natsav.com\/blog\/install-postgresql-on-cyber-panel\/","title":{"rendered":"How to Install postgreSQL on Cyber Panel"},"content":{"rendered":"<p><strong><span style=\"text-decoration: underline; color: #000000;\">Step 1: Access Your Server<\/span>.<br \/>\n<\/strong>Log in to your server via SSH.<\/p>\n<p><strong><span style=\"text-decoration: underline; color: #000000;\">Step 2: Update Server Packages<\/span>.<br \/>\n<\/strong>Before installing any new software, it&#8217;s a good practice to update your server packages:-<br \/>\n# [ sudo yum update ]<\/p>\n<p><span style=\"text-decoration: underline;\"><span style=\"color: #000000; text-decoration: underline;\"><strong>Step 3:<\/strong> <\/span><\/span><strong><span style=\"text-decoration: underline;\"><span style=\"color: #000000; text-decoration: underline;\">Install PostgreSQL<\/span><\/span>.<br \/>\n<\/strong>Install the PostgreSQL server and client packages. CyberPanel uses LiteSpeed, and PostgreSQL 12 is recommended. You can install it using the following command:-<br \/>\n# [ sudo yum install -y postgresql12-server postgresql12-contrib ]<\/p>\n<p><span style=\"text-decoration: underline;\"><span style=\"color: #000000; text-decoration: underline;\"><strong>Step 4:<\/strong> <\/span><\/span><strong><span style=\"text-decoration: underline;\"><span style=\"color: #000000; text-decoration: underline;\">Initialize the Database<\/span><\/span>.<br \/>\n<\/strong>Initialize the PostgreSQL database and start the service:-<br \/>\n# [ sudo \/usr\/pgsql-12\/bin\/postgresql-12-setup initdb ]<br \/>\n# [ sudo systemctl start postgresql-12 ]<br \/>\n# [ sudo systemctl <span class=\"hljs-built_in\">enable<\/span> postgresql-12 ]<\/p>\n<p><strong><span style=\"text-decoration: underline; color: #000000;\">Step 5: Create a Database and User<\/span>.<br \/>\n<\/strong>Access the PostgreSQL command line and create a new database and user:-<br \/>\n# [ sudo -u postgres psql ]<br \/>\nInside the PostgreSQL shell:-<br \/>\nCREATE DATABASE your_database_name;<br \/>\nCREATE USER your_username WITH PASSWORD &#8216;your_password&#8217;;<br \/>\nALTER ROLE your_username SET client_encoding TO &#8216;utf8&#8217;;<br \/>\nALTER ROLE your_username SET default_transaction_isolation TO &#8216;read committed&#8217;;<br \/>\nALTER ROLE your_username SET timezone TO &#8216;UTC&#8217;;<br \/>\nGRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username;<br \/>\n\\q<\/p>\n<p><strong><span style=\"text-decoration: underline; color: #000000;\">Step 6: Configure PostgreSQL<\/span>.<br \/>\n<\/strong>Edit the PostgreSQL configuration file to allow connections from CyberPanel. Open the <code>'pg_hba.conf'<\/code> file:-<br \/>\n# [ host all all your_server_ip\/32 md5 ]<br \/>\nSave the file and exit.<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Step 7:<\/strong> <\/span><strong><span style=\"text-decoration: underline; color: #000000;\">Restart PostgreSQL<\/span>.<br \/>\n<\/strong>Restart the PostgreSQL service to apply the changes.<br \/>\n# [ sudo systemctl restart postgresql-12 ]<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Step 8:<\/strong> <\/span><strong><span style=\"text-decoration: underline; color: #000000;\">Update CyberPanel Settings<\/span>.<br \/>\n<\/strong>In the CyberPanel interface, go to the &#8220;Databases&#8221; section and add the PostgreSQL database details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Access Your Server. Log in to your server via SSH. Step 2: Update Server Packages. Before installing any new software, it&#8217;s a good practice to update your server packages:- # [ sudo yum update ] Step 3: Install PostgreSQL. Install the PostgreSQL server and client packages. CyberPanel uses LiteSpeed, and PostgreSQL 12 is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5596,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[257],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/natsav.com\/blog\/wp-content\/uploads\/2023\/12\/PSQL.png?fit=590%2C312&ssl=1","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5586"}],"collection":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/comments?post=5586"}],"version-history":[{"count":5,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5586\/revisions"}],"predecessor-version":[{"id":5844,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5586\/revisions\/5844"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media\/5596"}],"wp:attachment":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media?parent=5586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/categories?post=5586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/tags?post=5586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}