Difference between revisions of "SUNScholar/Prepare Ubuntu/S06"
| Line 14: | Line 14: | ||
sudo apt-get install postgresql libpg-java | sudo apt-get install postgresql libpg-java | ||
| − | ==Step 6.2: Setup PostgreSQL host permissions== | + | ==Step 6.2: Setup the PostgreSQL server host based access permissions== |
Change database user permissions to "trust" only. | Change database user permissions to "trust" only. | ||
sudo sed -i 's/ident/trust/' /etc/postgresql/9.1/main/pg_hba.conf | sudo sed -i 's/ident/trust/' /etc/postgresql/9.1/main/pg_hba.conf | ||
| Line 49: | Line 49: | ||
sudo /etc/init.d/postgresql restart | sudo /etc/init.d/postgresql restart | ||
| + | |||
==Step 6.3: Create the PostgreSQL "dspace" DB user== | ==Step 6.3: Create the PostgreSQL "dspace" DB user== | ||
Create the "dspace" DB user with full privileges. | Create the "dspace" DB user with full privileges. | ||
Revision as of 12:07, 21 August 2014
STEP 7
Contents
- 1 Step 6. Install PostgreSQL
- 2 Step 6.1: Install PostgreSQL
- 3 Step 6.2: Setup the PostgreSQL server host based access permissions
- 4 Step 6.3: Create the PostgreSQL "dspace" DB user
- 5 Step 6.4: Create the PostgreSQL "dspace" database
- 6 Step 6.5: Setup PostgreSQL DB user passwords
- 7 Step 6.6: Setup the database host based access permissions
- 8 Step 6.7: Setup number of client connections
- 9 Step 6.8: Increase the kernel shared memory for postgresql connections
- 10 Step 6.9: Restart the PostgreSQL server
Step 6. Install PostgreSQL
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.
Step 6.1: Install PostgreSQL
sudo apt-get install postgresql libpg-java
Step 6.2: Setup the PostgreSQL server host based access permissions
Change database user permissions to "trust" only.
sudo sed -i 's/ident/trust/' /etc/postgresql/9.1/main/pg_hba.conf
sudo sed -i 's/md5/trust/' /etc/postgresql/9.1/main/pg_hba.conf
See example below.
# DO NOT DISABLE! # If you change this first entry you will need to make sure that the # database superuser can access the database using some other method. # Noninteractive access to all databases is required during automatic # maintenance (custom daily cronjobs, replication, and similar tasks). # # Database administrative login by Unix domain socket local all postgres trust # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust # Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres peer #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust
Restart database server.
sudo /etc/init.d/postgresql restart
Step 6.3: Create the PostgreSQL "dspace" DB user
Create the "dspace" DB user with full privileges.
sudo createuser -U postgres -d -A -P dspace
Answer "y" for yes, for any of the user creation questions.
Step 6.4: Create the PostgreSQL "dspace" database
Create the "dspace" database.
sudo createdb -E UNICODE dspace
Step 6.5: Setup PostgreSQL DB user passwords
- Enter the Ubuntu server postgres user shell.
sudo su - postgres
- Connect to the PostgreSQL database server and enter a PostgreSQL database server shell.
psql -U postgres
- Set the postgres DB user password:
Note: Use your unique system admin password for this on a production system !
ALTER ROLE postgres WITH PASSWORD 'XXXXXX';
- Set the dspace DB user password:
Note: Use your unique dspace database password for this on a production system !
ALTER ROLE dspace WITH PASSWORD 'XXXXXX';
- Let the dspace DB user own the dspace database
ALTER DATABASE dspace OWNER TO dspace;
- Grant all privileges for the dspace database to the dspace DB user
GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace;
- Quit the database shell.
\q
- We exit from PostgreSQL database server postgres user shell and return to the Ubuntu server dspace user shell.
exit
Step 6.6: Setup the database host based access permissions
Type the following:
sudo -i
sudo echo "## DSpace user access">> /etc/postgresql/9.1/main/pg_hba.conf
sudo echo "host dspace dspace 127.0.0.1/32 md5">> /etc/postgresql/9.1/main/pg_hba.conf
exit
Step 6.7: Setup number of client connections
Edit the postgresql config file:
sudo nano /etc/postgresql/9.1/main/postgresql.conf
Change the number of "max_connections" to 300.
- NANO Editor Help
| CTL+O | = Save the file and then press Enter |
| CTL+X | = Exit "nano" |
| CTL+K | = Delete line |
| CTL+U | = Undelete line |
| CTL+W | = Search for %%string%% |
| CTL+\ | = Search for %%string%% and replace with $$string$$ |
| CTL+C | = Show line numbers |
More info = http://en.wikipedia.org/wiki/Nano_(text_editor)
Edit the "/etc/sysctl.conf" file:
sudo nano /etc/sysctl.conf
Copy and paste the following to the end of the file:
# Postgres connections kernel.shmmax = 500000000 kernel.shmall = 500000000
- NANO Editor Help
| CTL+O | = Save the file and then press Enter |
| CTL+X | = Exit "nano" |
| CTL+K | = Delete line |
| CTL+U | = Undelete line |
| CTL+W | = Search for %%string%% |
| CTL+\ | = Search for %%string%% and replace with $$string$$ |
| CTL+C | = Show line numbers |
More info = http://en.wikipedia.org/wiki/Nano_(text_editor)
Type the following in a terminal:
sudo sysctl -p
Step 6.9: Restart the PostgreSQL server
Type the following:
sudo /etc/init.d/postgresql restart