Changes

From SME Server
Jump to navigationJump to search
Line 29: Line 29:     
Only '''1''' service script has been installed on your base SME Server which is '''/etc/rc.d/init.d/postgresql92-postgresql'''. This script will start and stop the installed application.
 
Only '''1''' service script has been installed on your base SME Server which is '''/etc/rc.d/init.d/postgresql92-postgresql'''. This script will start and stop the installed application.
 +
    
====Test installed application====
 
====Test installed application====
Line 41: Line 42:     
=== Database location ===
 
=== Database location ===
By default postgresql stores it's data in the environment under /opt/rh/postgresql92. We want to a different location for the data, for we want to make sure the data is being backed up by the default backup mechanisms of SME Server. The chosen location is '''/home/e-smith/files/pgsql/data'''
+
By default postgresql stores it's data in the environment under /opt/rh/postgresql92. We want a different location for the data, for we want to make sure the data is being backed up by the default backup mechanisms of SME Server. The chosen location is '''/home/e-smith/files/pgsql/data'''
    
To be able to do this, we need to create a file as described below, which is the postgresql way of settings variables:
 
To be able to do this, we need to create a file as described below, which is the postgresql way of settings variables:
  mkdir -p /opt/rh/postgresql92/root/etc/sysconfig/pgsql
+
  mkdir -p /opt/rh/rh-postgresql92/root/etc/sysconfig/pgsql
  echo PGDATA=/home/e-smith/files/pgsql/data > /opt/rh/postgresql92/root/etc/sysconfig/pgsql/postgresql92-postgres
+
  echo PGDATA=/home/e-smith/files/pgsql/data > /opt/rh/rh-postgresql92/root/etc/sysconfig/pgsql/postgresql92-postgresql
    
{{Note box|Just like MySQL, Postgresql needs pre-backup and pre-restore actions. New actions have to developed to make this possible. Once this is the case, the databases location will have to change to the default /var/lib/pgsql}}
 
{{Note box|Just like MySQL, Postgresql needs pre-backup and pre-restore actions. New actions have to developed to make this possible. Once this is the case, the databases location will have to change to the default /var/lib/pgsql}}
Line 52: Line 53:  
====Initialize database====
 
====Initialize database====
 
PostgreSQL requires the initialization of the database environment. This can be done by the following command:
 
PostgreSQL requires the initialization of the database environment. This can be done by the following command:
  /etc/rc.d/init.d/postgresql92-postgresql initdb
+
  /etc/rc.d/init.d/rh-postgresql92-postgresql initdb
 
  −
 
  −
===Start/Stop PostgreSQL===
  −
PostgreSQL is now installed and initialized, and can be started and stopped manually via:
  −
/etc/rc.d/init.d/postgresql92-postgres start
  −
and
  −
/etc/rc.d/init.d/postgresql92-postgres stop
  −
 
      
====Start/Stop PostgreSQL as a system service====
 
====Start/Stop PostgreSQL as a system service====
Line 79: Line 72:  
  signal-event remoteaccess-update
 
  signal-event remoteaccess-update
 
You can toggle between private and public access followed by the remoteaccess-update command.
 
You can toggle between private and public access followed by the remoteaccess-update command.
      
===Enable the postgresql92 environment at boot time===
 
===Enable the postgresql92 environment at boot time===
The preferred way to enable scl postgresql environment permanently at logout or (re)boot is to add a custom script called 'enablepostgresql92.sh' to /etc/profiles.d/ directory with the following content and make it executable.
+
The preferred way to enable scl postgresql environment permanently at logout or (re)boot is to add a custom script called 'enablepostgresql92.sh' to /etc/profile.d/ directory with the following content and make it executable.
    
  #!/bin/sh
 
  #!/bin/sh
 
  source /opt/rh/postgresql92/enable
 
  source /opt/rh/postgresql92/enable
 
  export X_SCLS="`scl enable postgresql92 'echo $X_SCLS'`"
 
  export X_SCLS="`scl enable postgresql92 'echo $X_SCLS'`"
 +
 +
This will take effect after a logout/login as root or reboot. The simplest way is to log out from the console at this time and login again as root.
 +
 +
 +
===Possible bug and solution===
 +
It seems that the scl-postgresql92 pckages do not create 2 additional directories within the postgresql92 environment. We need to create them manually:
 +
mkdir -p /opt/rh/postgresql92/root/var/lock/subsys/
 +
mkdir -p /opt/rh/postgresql92/root/var/run/
 +
 +
 +
===Start/Stop PostgreSQL manually===
 +
PostgreSQL is now installed and initialized, and can be started and stopped manually via:
 +
/etc/rc.d/init.d/postgresql92-postgresql start
 +
and
 +
/etc/rc.d/init.d/postgresql92-postgresql stop
      Line 98: Line 105:  
  su postgres
 
  su postgres
 
  psql
 
  psql
 +
 +
 +
== Uninstall ==
 +
To remove the scl postgresql92 environment:
 +
/etc/rc.d/init.d/postgresql92-postgresql stop
 +
yum remove \
 +
postgresql92* audit-libs-python libcgroup \
 +
libselinux-python libsemanage-python \
 +
policycoreutils-python setools libs setools-libs-python
 +
config delete postgresql92-postgresql
 +
rm -f /etc/profile.d/enablepostgresql92.sh
 +
rm -f /etc/rc7.d/S64postgresql92-postgresql
 +
All data will still be present in /home/e-smith/files/pgsql/data and can be transferred to another machine, archived or deleted manually. When re-used with another instance of scl-postgresql92, the step regarding initdb can be ommited for the data structure and data is already available.
     

Navigation menu