<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PostgreSQL &#8211; Hostry Help Center</title>
	<atom:link href="https://help.hostry.com/article-tags/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.hostry.com</link>
	<description>Full information on how to use HOSTRY, provided by 24/7 community based support</description>
	<lastBuildDate>Wed, 11 Aug 2021 06:59:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.13</generator>

<image>
	<url>https://help.hostry.com/wp-content/uploads/cache/2021/01/cropped-apple-icon-180x180-1/836712163.png</url>
	<title>PostgreSQL &#8211; Hostry Help Center</title>
	<link>https://help.hostry.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Install PostGIS Extension for PostgreSQL on Ubuntu</title>
		<link>https://help.hostry.com/knowledge-base/how-to-install-postgis-extension-for-postgresql-on-ubuntu/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-install-postgis-extension-for-postgresql-on-ubuntu/#respond</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Thu, 13 Aug 2020 08:11:49 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=1917</guid>

					<description><![CDATA[PostgreSQ is a free open source database with extensions available to extend its capabilities. PostGIS is a spatial database extension that provides PostgreSQL with location and geography capabilities. PostGIS adds a POINT datatype for location and can return location radii and can return location radiuses and distances using relevant queries [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong><a href="https://www.postgresql.org/">PostgreSQ </a></strong>is a free open source database with extensions available to extend its capabilities. PostGIS is a spatial database extension that provides PostgreSQL with location and geography capabilities. PostGIS adds a POINT datatype for location and can return location radii  and can return location radiuses and distances using relevant queries </p>



<h2 id="configure-a-repository" >Configure a repository</h2>



<p>Install the required Gnu Privacy Guard dependency</p>



<p><code>$ sudo apt -y install gnupg2 </code></p>



<p>Import the PGP signing key for the given repository</p>



<p><code>$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - </code></p>



<p>Add PostgreSQL apt repository</p>



<p><code>$ echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list </code></p>



<h2 id="install-postgresql-and-postgis" >Install PostgreSQL and PostGIS</h2>



<p>In this step, you must first install PostgreSQL</p>



<p><code>$ sudo apt -y install postgresql-12 postgresql-client-12 </code></p>



<p>Then install PostGIS</p>



<p><code>$ sudo apt install postgis postgresql-12-postgis-3 </code></p>



<p>After that, install all the necessary control packages</p>



<pre class="wp-block-code"><code>$ sudo apt-get install postgresql-12-postgis-3-scripts</code></pre>



<h2 id="log-into-postgresql-and-enable-postgis" >Log into PostgreSQL and enable PostGIS</h2>



<p>First, log in as superuser</p>



<p><code>$ sudo su - postgres </code></p>



<p>Next, create a new PostgreSQL user</p>



<p><code>$ createuser exampleuser </code></p>



<p>After that, set a password for the new user</p>



<p><code>$ psql -c "alter user exampleuser with password 'yourPassword'" </code></p>



<p>Create a new database</p>



<p><code>$ createdb my_db -O exampleuser </code></p>



<p>Connect to database</p>



<pre class="wp-block-code"><code>$ psql -d my_db</code></pre>



<p>Enable PostGIS Database Extension</p>



<pre class="wp-block-code"><code>my_db=# CREATE EXTENSION postgis;</code></pre>



<p>Test the PostGIS extension</p>



<pre class="wp-block-code"><code>my_db=# SELECT PostGIS_version();</code></pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-install-postgis-extension-for-postgresql-on-ubuntu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Make Backup And Restore PostgreSQL Databases on Ubuntu 18.04</title>
		<link>https://help.hostry.com/knowledge-base/how-to-make-backup-and-restore-postgresql-databases-on-ubuntu-18-04/</link>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Thu, 17 Oct 2019 06:22:13 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=799</guid>

					<description><![CDATA[PostgreSQL is a open source database management system that can be used to store information related to websites. This system exists in implementations for many UNIX-like platforms, including AIX, various BSD-systems, HP-UX, IRIX, Linux, macOS, Solaris / OpenSolaris, Tru64, QNX, as well as for Microsoft Windows. The most important task [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong><em><a href="https://en.wikipedia.org/wiki/PostgreSQL">PostgreSQL</a></em></strong> is a open source database management system that can be used to store information related to websites. This system exists in implementations for many UNIX-like platforms, including AIX, various BSD-systems, HP-UX, IRIX, Linux, macOS, Solaris / OpenSolaris, Tru64, QNX, as well as for Microsoft Windows. </p>



<p>The most important task of the administrator is regular backup, it is an integral part of working with databases. The first thing to start is <strong>updating all system packages</strong></p>



<h2 id="updating-system-packages" >Updating System Packages</h2>



<p>Before starting, update the packages on your server</p>



<pre class="wp-block-code"><code>sudo apt-get update -y
sudo apt-get upgrade -y</code></pre>



<h2 id="postgresql-installation" >PostgreSQL installation</h2>



<p>PostgreSQL is available in the Ubuntu 18.04 repository and can be installed very simply with the following command:</p>



<pre class="wp-block-code"><code>sudo apt-get install postgresql postgresql-contrib</code></pre>



<p>Then you should start the <strong>postgresql</strong> service and <em>enable</em> it at boot time:</p>



<pre class="wp-block-code"><code>sudo systemctl start postgresql
sudo systemctl enable postgresql</code></pre>



<h2 id="backup-instructions" >Backup Instructions</h2>



<p>PostgreSQL comes with the <strong>pg_dump</strong> utility for calling information from the database to a file. You can run this utility from the command line interface. For example, if you want to back up one database, run the following command:</p>



<pre class="wp-block-code"><code>sudo pg_dump -U user_name database_name &gt; backup_file</code></pre>



<p><strong>IMPORTANT</strong>! The command must be run as root.</p>



<p>You can follow another way: backup the database by logging in as a postgres user:</p>



<pre class="wp-block-code"><code>sudo su - postgres
pg_dump postgres &gt; postgres.bak</code></pre>



<p>This command (which is indicated above, respectively) backs up the default database postgres.</p>



<p>Also, using the command below, it is possible to backup a remote database:</p>



<pre class="wp-block-code"><code>pg_dump -U user_name -h remote_ip_address -p remote_port database_name &gt; backup_file</code></pre>



<p>If you want to backup all the databases on your system, then <strong>pg_dumpall</strong> then you can use:</p>



<pre class="wp-block-code"><code>sudo pg_dumpall -U user_name &gt; backup_file</code></pre>



<h2 id="restore-instructions" >Restore Instructions</h2>



<p>Next, we will discuss how to restore the database created by the pg_dump command using the psql command, but first you need to create a empty base with<strong> name new_database</strong></p>



<pre class="wp-block-code"><code>sudo -u postgres psql
createdb -T template0 new_database</code></pre>



<p>Then you need to redirect the database dump caused by backup_files with the following command:</p>



<pre class="wp-block-code"><code>psql new_database &lt; backup_file</code></pre>



<p>It happens that errors are made during the backup process, and you urgently need to stop the recovery process when an error occurs, run the following command:</p>



<pre class="wp-block-code"><code>psql --set ON_ERROR_STOP=on new_database &lt; backup_file</code></pre>



<p>To restore the databases created by the pg_dumpall command, transfer the file to sql. You can use this command:</p>



<pre class="wp-block-code"><code>psql -U user_name -f backup_file   </code></pre>



<p>We recommend that you regularly store and <strong><a href="https://hostry.com/blog/the-crucial-importance-of-backup/">back up</a></strong>!</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
