0

I'm trying to install PostgreSQL 9.5 on CentOS 7.

I've searched online and to get access to the 9.5 RPMs it requires installation of pgdg95 via the following command:

sudo rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm

I'm installing PostgreSQL 9.5 via my own PostgreSQL RPM. The RPM I'm installing contains my own scripts and I will use the rpm-maven-plugin to map them to server. I'm also using this plugin to install the PostgreSQL 9.5 packages by adding them to the <requires> section of the POM.xml configuration.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>rpm-maven-plugin</artifactId>
    <version>2.1.5</version>
    <extensions>true</extensions>
    <configuration>
        <license>GPL (c) 2005, SWWDC</license>
        <distribution>distro</distribution>
        <group>group</group>
        <requires>
            <require>postgresql95-server</require>
            <require>postgresql95-contrib</require>
            <require>postgresql95-plpython</require>
        </requires>

        <mappings>
        </mappings>

        <prepareScriptlet>
            <scriptFile>src/scripts/prepinstall.sh</scriptFile>
        </prepareScriptlet>
        <preinstallScriptlet>      
            <scriptFile>src/scripts/preinstall.sh</scriptFile>
        </preinstallScriptlet>
        <postinstallScriptlet>
            <scriptFile>src/scripts/postinstall.sh</scriptFile>
        </postinstallScriptlet>
    </configuration>
</plugin>

As you can see, I've added both a pre-install and prep-install script to the package which are automatically run during YUM installing the package. The problem is that the requires runs before both of these scripts and they fail because the pgdg95 RPM is not installed.

How can I run the command at the start of the question before the require'd RPMs are installed? Prep/pre install scripts don't seem to work as the requires is running before them.

0

The solution I implemented was to add the repo at installation time using the following line within the kickstart:

repo --name="PostgreSQL" --baseurl="http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/"

and then to add in the POM.xml:

<requires>pgdg-centos95-9.5-2.noarch.rpm</requires>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.