Forums

Resolved
0 votes
I'm having trouble installing Postgresql on ClearOS. Since it is not in the ClearOS repository, what release of CentOS or Redhat repository should I use? And how do I add it?

James
Friday, February 21 2014, 11:56 AM
Share this post:
Responses (3)
  • Accepted Answer

    Thursday, August 17 2023, 05:39 AM - #Permalink
    Resolved
    0 votes
    If you're trying to install PostgreSQL on ClearOS and it's not available in the ClearOS repository, you can use CentOS or RHEL repositories to get the package. ClearOS is based on CentOS, so using a CentOS repository should generally be compatible. Here's a step-by-step solution:

    Determine the version of ClearOS: First, you should determine the version of ClearOS you're running. This is important because you'd want to match it with the closest version of CentOS.

    cat /etc/clearos-release


    Adding the CentOS Repository:

    If you're running ClearOS 7, for instance, you'd want to use the CentOS 7 repositories.
    First, you can back up your current repo file (for safety) and then add the CentOS repository.

    cp /etc/yum.repos.d/ClearOS.repo /etc/yum.repos.d/ClearOS.repo.backup


    Now, create a new repo file for CentOS:

    nano /etc/yum.repos.d/CentOS.repo


    Add the following contents for CentOS 7 (adjust for other versions accordingly):

    [centos]
    name=CentOS-$releasever - Base
    baseurl=http://mirror.centos.org/centos/7/os/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7


    Save and close the file.

    Installing PostgreSQL:
    Before you install PostgreSQL, you might want to import the official GPG key of the PostgreSQL Global Development Group (PGDG).

    rpm --import https://www.postgresql.org/media/keys/ACCC4CF8.asc

    Now, to install PostgreSQL:

    yum install postgresql-server postgresql-contrib


    Initializing the database and enabling the service:


    postgresql-setup initdb
    systemctl start postgresql
    systemctl enable postgresql


    Securing the Installation:
    After installation, it's a good idea to run the PostgreSQL post-installation utility to secure your new PostgreSQL installation:

    sudo -u postgres psql


    Then set the password for the "postgres" user:


    \password postgres

    Enter your desired password and then exit the prompt:

    \q

    Firewall Configuration:
    If you want to allow external connections to your PostgreSQL server, make sure to adjust the firewall settings on ClearOS.

    Adjusting the Repository:
    After you're done installing PostgreSQL, it might be a good idea to disable the CentOS repository (to prevent potential conflicts in the future):

    sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS.repo

    This should help you get PostgreSQL installed on ClearOS. Remember to always backup any configuration changes and be cautious when working with system-level repositories and configurations.


    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    Monday, August 07 2023, 01:45 AM - #Permalink
    Resolved
    0 votes
    CentOS 8 reached end-of-life (EOL pizza tower) in December 2021, forcing millions of sysadmins to rethink OS strategies for servers and virtual machines. Those not on board with "upgrading" to the new CentOS Stream (Red Hat's rolling release platform that's not a good option for a production server) have two choices: run the EOL version of the OS or look for CentOS alternatives.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, February 21 2014, 01:28 PM - #Permalink
    Resolved
    0 votes
    They are there... you just need to enable another ClearOS repository

    try this... yum --enablerepo=clearos-core search postgresql
    The reply is currently minimized Show
Your Reply