Difference between revisions of "SUNScholar/Prepare Ubuntu/S06"

From Libopedia
Jump to navigation Jump to search
 
(103 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<center>
 
<center>
'''[[SUNScholar/Prepare Ubuntu|Prepare Ubuntu - Index]]'''
+
  '''[[SUNScholar/Prepare Ubuntu/S07|NEXT - STEP 7]]'''
 
</center>
 
</center>
  
==Step 6. Install PostgreSQL==
+
==Step 6. Install the PostgreSQL database server==
 
DSpace can use the PostgreSQL or Oracle  database server for the main database.
 
DSpace can use the PostgreSQL or Oracle  database server for the main database.
  
 
The following procedure installs the PostgreSQL database server and creates the "dspace" database and "dspace" database user with the very secret dspace database user password.
 
The following procedure installs the PostgreSQL database server and creates the "dspace" database and "dspace" database user with the very secret dspace database user password.
 +
<center>
 +
<font color="red">'''The PostgreSQL database server was chosen because it is open source software and this in keeping with the open access pathos.'''</font>
 +
</center>
  
<font color="red">'''The PostgreSQL database server was chosen because it is open source software and this in keeping with the open access pathos.'''</font>
+
==<font color="red">'''PLEASE NOTE'''</font>==
 +
*Please see critical database connection bug: https://jira.duraspace.org/browse/DS-2563
 +
*http://wiki.lib.sun.ac.za/index.php/SUNScholar/Optimisations/Database
  
==Step 6.1: Install PostgreSQL==
+
==[[SUNScholar/Prepare_Ubuntu/S06/Ubuntu-16.04|For Ubuntu 16.04 LTS]]==
sudo apt-get install postgresql-8.4 libpg-java
+
==[[SUNScholar/Prepare_Ubuntu/S06/Ubuntu-14.04|For Ubuntu 14.04 LTS]]==
  
==Step 6.2: Setup PostgreSQL admin password==
+
==[[SUNScholar/Prepare_Ubuntu/S06/Ubuntu-12.04|For Ubuntu 12.04 LTS]]==
Change database user permissions to "trust" only.
 
sudo sed -i 's/ident/trust/' /etc/postgresql/8.4/main/pg_hba.conf
 
  
sudo sed -i 's/md5/trust/' /etc/postgresql/8.4/main/pg_hba.conf
+
<center>
Restart database server.
+
  '''[[SUNScholar/Prepare Ubuntu/S05|PREVIOUS - STEP 5]]'''
sudo /etc/init.d/postgresql-8.4 restart
+
</center>
Become the postgres user
 
sudo su postgres
 
Open a database shell...
 
psql -U postgres
 
... and set the password:
 
ALTER ROLE postgres WITH PASSWORD 'XXXXXX';
 
'''Note: Use your unique system admin password for this on a production system !'''
 
 
 
Quit the database shell.
 
\q
 
 
 
==Step 6.3: Create the PostgreSQL "dspace" user==
 
Create the "dspace" user with full privileges.
 
createuser -U postgres -d -A -P dspace
 
 
 
If asked the following:
 
Shall the new role be allowed to create more new roles? (y/n) y
 
Answer "y" for yes.
 
 
 
==Step 6.4: Create the PostgreSQL 'dspace' database==
 
Create the "dspace" database with the "dspace" database user as owner.
 
createdb -E UNICODE dspace
 
 
 
Set the dspace database user password.
 
psql -U postgres
 
... and set the password:
 
ALTER ROLE dspace WITH PASSWORD 'XXXXXX';
 
'''Note: Use your unique dspace database password for this on a production system !'''
 
 
 
Let the dspace postgresql database user own the dspace database
 
ALTER DATABASE dspace OWNER TO dspace;
 
 
 
Quit the database shell.
 
\q
 
 
 
We return to the dspace user
 
exit
 
 
 
==Step 6.5: Setup database host and user access permissions==
 
Type the following:
 
sudo echo "## DSpace user access">> /etc/postgresql/8.4/main/pg_hba.conf
 
 
 
sudo echo "host    dspace      dspace      127.0.0.1/32        md5">> /etc/postgresql/8.4/main/pg_hba.conf
 
 
 
==Step 6.6: Setup number of client connections==
 
Edit the postgresql config file:
 
 
 
sudo nano /etc/postgresql/8.4/main/postgresql.conf
 
 
 
Change the number of "max_connections" to 300.
 
 
 
{{NANO}}
 
 
 
==Step 6.7: Increase the kernel shared memory for postgresql connections==
 
Edit the "/etc/sysctl.conf" file:
 
 
 
sudo nano /etc/sysctl.conf
 
 
 
Copy and paste the following to the end of the file:
 
<pre>
 
# Postgres connections
 
kernel.shmmax = 500000000
 
kernel.shmall = 500000000
 
</pre>
 
 
 
{{NANO}}
 
 
 
Type the following in a terminal:
 
 
 
sudo sysctl -p
 
 
 
==Step 6.8: Restart the PostgreSQL server==
 
Type the following:
 
 
 
  sudo /etc/init.d/postgresql-8.4 restart
 
----
 
Below is a screenshot of the yearly DB connections.
 
 
 
[[File:Postgres connections ALL-year.png]]
 
 
 
  '''[[SUNScholar/Prepare Ubuntu/S05|PREVIOUS]]'''
 
  
  '''[[SUNScholar/Prepare Ubuntu/S07|NEXT]]'''
+
[[Category:Installation]]
 +
__NOTOC__

Latest revision as of 14:13, 30 October 2019

 NEXT - STEP 7

Step 6. Install the PostgreSQL database server

DSpace can use the PostgreSQL or Oracle database server for the main database.

The following procedure installs the PostgreSQL database server and creates the "dspace" database and "dspace" database user with the very secret dspace database user password.

The PostgreSQL database server was chosen because it is open source software and this in keeping with the open access pathos.

PLEASE NOTE

For Ubuntu 16.04 LTS

For Ubuntu 14.04 LTS

For Ubuntu 12.04 LTS

PREVIOUS - STEP 5