<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.lib.sun.ac.za/index.php?action=history&amp;feed=atom&amp;title=SUNScholar%2FPrepare_Ubuntu%2FS06%2FUbuntu-16.04</id>
	<title>SUNScholar/Prepare Ubuntu/S06/Ubuntu-16.04 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.lib.sun.ac.za/index.php?action=history&amp;feed=atom&amp;title=SUNScholar%2FPrepare_Ubuntu%2FS06%2FUbuntu-16.04"/>
	<link rel="alternate" type="text/html" href="http://wiki.lib.sun.ac.za/index.php?title=SUNScholar/Prepare_Ubuntu/S06/Ubuntu-16.04&amp;action=history"/>
	<updated>2026-05-14T18:52:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.2</generator>
	<entry>
		<id>http://wiki.lib.sun.ac.za/index.php?title=SUNScholar/Prepare_Ubuntu/S06/Ubuntu-16.04&amp;diff=45662&amp;oldid=prev</id>
		<title>Ivdl: Created page with &quot;&lt;center&gt;  '''BACK TO STEP 6''' &lt;/center&gt;  ==Step 6.1: Increase the kernel shared memory for PostgreSQL server client connections== Edit the &quot;...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.lib.sun.ac.za/index.php?title=SUNScholar/Prepare_Ubuntu/S06/Ubuntu-16.04&amp;diff=45662&amp;oldid=prev"/>
		<updated>2019-10-30T12:15:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;center&amp;gt;  &amp;#039;&amp;#039;&amp;#039;&lt;a href=&quot;/index.php/SUNScholar/Prepare_Ubuntu/S06&quot; title=&quot;SUNScholar/Prepare Ubuntu/S06&quot;&gt;BACK TO STEP 6&lt;/a&gt;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/center&amp;gt;  ==Step 6.1: Increase the kernel shared memory for PostgreSQL server client connections== Edit the &amp;quot;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;center&amp;gt;&lt;br /&gt;
 '''[[SUNScholar/Prepare_Ubuntu/S06|BACK TO STEP 6]]'''&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Step 6.1: Increase the kernel shared memory for PostgreSQL server client connections==&lt;br /&gt;
Edit the &amp;quot;/etc/sysctl.conf&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/sysctl.conf&lt;br /&gt;
&lt;br /&gt;
Copy and paste the following '''to the end of the file''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# For PostgreSQL server client connections&lt;br /&gt;
kernel.shmmax = 500000000&lt;br /&gt;
kernel.shmall = 500000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the file.&lt;br /&gt;
----&lt;br /&gt;
Also see: http://www.postgresql.org/docs/9.5/static/kernel-resources.html&lt;br /&gt;
&lt;br /&gt;
Type the following in a terminal:&lt;br /&gt;
&lt;br /&gt;
 sudo sysctl -p&lt;br /&gt;
&lt;br /&gt;
==Step 6.2: Install PostgreSQL server software==&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install postgresql-9.5 postgresql-contrib-9.5 libpg-java&lt;br /&gt;
&lt;br /&gt;
==Step 6.3: Setup the PostgreSQL server host based access permissions==&lt;br /&gt;
See official documentation links below for detailed information about the '''&amp;quot;pg_hba.conf&amp;quot;''' file.&lt;br /&gt;
*http://www.postgresql.org/docs/9.5/static/auth-pg-hba-conf.html&lt;br /&gt;
*https://wiki.duraspace.org/display/DSDOC4x/Installing+DSpace#InstallingDSpace-RelationalDatabase:%28PostgreSQLorOracle%29&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
 '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Check these host based permissions carefully. Remember security on your server is your responsibility!&amp;lt;/font&amp;gt;'''&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
Change database user permissions to &amp;quot;trust&amp;quot; only.&lt;br /&gt;
 sudo sed -i 's/ident/trust/' /etc/postgresql/9.5/main/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
 sudo sed -i 's/md5/trust/' /etc/postgresql/9.5/main/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
 sudo sed -i 's/peer/trust/' /etc/postgresql/9.5/main/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
See example below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# DO NOT DISABLE!&lt;br /&gt;
# If you change this first entry you will need to make sure that the&lt;br /&gt;
# database superuser can access the database using some other method.&lt;br /&gt;
# Noninteractive access to all databases is required during automatic&lt;br /&gt;
# maintenance (custom daily cronjobs, replication, and similar tasks).&lt;br /&gt;
#&lt;br /&gt;
# Database administrative login by Unix domain socket&lt;br /&gt;
local   all             postgres                                trust&lt;br /&gt;
&lt;br /&gt;
# TYPE  DATABASE        USER            ADDRESS                 METHOD&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;local&amp;quot; is for Unix domain socket connections only&lt;br /&gt;
local   all             all                                     trust&lt;br /&gt;
# IPv4 local connections:&lt;br /&gt;
host    all             all             127.0.0.1/32            trust&lt;br /&gt;
# IPv6 local connections:&lt;br /&gt;
host    all             all             ::1/128                 trust&lt;br /&gt;
# Allow replication connections from localhost, by a user with the&lt;br /&gt;
# replication privilege.&lt;br /&gt;
#local   replication     postgres                                trust&lt;br /&gt;
#host    replication     postgres        127.0.0.1/32            trust&lt;br /&gt;
#host    replication     postgres        ::1/128                 trust&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart database server.&lt;br /&gt;
&lt;br /&gt;
 sudo service postgresql restart&lt;br /&gt;
&lt;br /&gt;
==Step 6.4: Create the PostgreSQL &amp;quot;dspace&amp;quot; DB user==&lt;br /&gt;
Create the &amp;quot;dspace&amp;quot; DB user with full privileges.&lt;br /&gt;
 sudo createuser -U postgres -d -A -P dspace&lt;br /&gt;
&lt;br /&gt;
Answer &amp;quot;y&amp;quot; for yes, for any of the user creation questions.&lt;br /&gt;
&lt;br /&gt;
==Step 6.5: Create the PostgreSQL &amp;quot;dspace&amp;quot; database==&lt;br /&gt;
Enter the Ubuntu server postgres user shell.&lt;br /&gt;
 sudo su - postgres&lt;br /&gt;
&lt;br /&gt;
Create the &amp;quot;dspace&amp;quot; database.&lt;br /&gt;
 createdb -E UNICODE dspace&lt;br /&gt;
&lt;br /&gt;
==Step 6.6: Setup PostgreSQL dspace DB user password, ownership and privileges==&lt;br /&gt;
Connect to the PostgreSQL database server and enter a PostgreSQL database server shell.&lt;br /&gt;
 psql -U postgres -d dspace&lt;br /&gt;
&lt;br /&gt;
:Set the dspace DB user password:&amp;lt;br&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;SECURITY WARNING: Use your unique dspace database password for this on a production system !&amp;lt;/font&amp;gt;'''&lt;br /&gt;
 ALTER ROLE dspace WITH PASSWORD 'XXXXXX';&lt;br /&gt;
&lt;br /&gt;
:Let the dspace DB user own the dspace database&lt;br /&gt;
 ALTER DATABASE dspace OWNER TO dspace;&lt;br /&gt;
&lt;br /&gt;
:Grant all privileges for the dspace database to the dspace DB user&lt;br /&gt;
 GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace;&lt;br /&gt;
&lt;br /&gt;
:Add the &amp;quot;crypto&amp;quot; extension to the &amp;quot;dspace&amp;quot; database.&lt;br /&gt;
 CREATE EXTENSION pgcrypto;&lt;br /&gt;
&lt;br /&gt;
:Quit the database shell.&lt;br /&gt;
 \q&lt;br /&gt;
&lt;br /&gt;
We exit from PostgreSQL database server postgres user shell and return to the Ubuntu server dspace user shell.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
==Step 6.7: Setup the PostgreSQL server host based access permissions to the dspace database==&lt;br /&gt;
Type the following:&lt;br /&gt;
&lt;br /&gt;
 sudo -i&lt;br /&gt;
&lt;br /&gt;
 sudo echo &amp;quot;## DSpace DB user access&amp;quot;&amp;gt;&amp;gt; /etc/postgresql/9.5/main/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
 sudo echo &amp;quot;host    dspace       dspace      127.0.0.1/32         md5&amp;quot; &amp;gt;&amp;gt; /etc/postgresql/9.5/main/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
==Step 6.8: Setup maximum number of PostgreSQL server client connections==&lt;br /&gt;
&lt;br /&gt;
Edit the postgresql config file:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/postgresql/9.5/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Change the number of &amp;quot;max_connections&amp;quot; to 300. ''Please note: If you get connection errors, then adjust this value!''&lt;br /&gt;
&lt;br /&gt;
Save and exit the file.&lt;br /&gt;
&lt;br /&gt;
==Step 6.9: Restart the PostgreSQL server==&lt;br /&gt;
Type the following:&lt;br /&gt;
&lt;br /&gt;
 sudo service postgresql restart&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*http://www.postgresql.org/about/featurematrix&lt;br /&gt;
*http://manage.jujucharms.com/charms/trusty/postgresql&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Ivdl</name></author>
		
	</entry>
</feed>