CentOS 7.9.2009 repository configuration

As for year 2025 there is no more updates for CentOS 7.9.2009. Moreover you need to adjust repository file as network locations changed a little bit. So edit /etc/yum.repos.d/CentOS-Base.repo as follows:

[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[updates]
name=CentOS-$releasever - Updates
baseurl=https://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[extras]
name=CentOS-$releasever - Extras
baseurl=https://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[centosplus]
name=CentOS-$releasever - CentOSPlus
baseurl=https://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=0

Then recreate yum cache:

sudo yum clean all
sudo yum makecache

And if necessary:

sudo yum update yum

Now you are good to go with packages installation. If installing rkhunter, remember to install epel-release and then

sudo yum install rkhunter --enablerepo epel

in case you did no enable EPEL to be enable by default which is the most probably situation.

Expand CentOS LVM disk and filesystem

There are two ways of expanding your root filesystem space. It’s either by adding additional volumes or by resizing PV. Let’s try the latter. We have CentOS 7 wth XFS running on Proxmox. First expand drive size with admin UI. Next:

yum install cloud-utils-growpart
growpart /dev/sdX 2
pvresize /dev/sdX2
lvextend -l +100%FREE /dev/mapper/centos-root
# and...
xfs_growfs / # for XFS 
# or
resize2fs /dev/mapper/centos-root

At first after resizing drive you will see in lsblk that the drive should have additional space. At growpart you will see your partition expands. At pvresize there is no change. Change happens on lvextend, so you will see you LVM increases in space. To see filesystem change in df you need to run either xfs_growfs or resize2fs depending on your filesystem you’re running on.

Extending CentOS7 partition on Azure

Using CentOS7 templates on Azure could result in lack of LVM, swap and non auto-extendable partitions. Some other templates have such feature, but not all of them. In case you assigned bigger disk in Azure portal you need still to do few things. First delete /dev/sda2 partition:

fdisk /dev/sda
d
2
w

Then reboot to apply.

yum install cloud-utils-growpart -y
growpart /dev/sda 1
xfs_growfs /dev/sda1

Installing PostgreSQL 14 on CentOS 7

PostgreSQL 14 has few improvements over previous versions, especially older ones, like 9.6. This includes automatic data direction using partitioning. So, let’s install it on CentOS 7.

yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql14-server postgresql14
/usr/pgsql-14/bin/postgresql-14-setup initdb
systemctl enable postgresql-14
service postgresql-14 start

Then you should login to the database and set password:

sudo -u postgres -i
psql
\password

Basic configuration includes firewall setup (if it’s active), access control and performance settings:

/var/lib/pgsql/14/data/pg_hba.conf
/var/lib/pgsql/14/data/postgresql.auto.conf

I strongly recommend visiting pgtune.leopard.in.ua for tuning parameters. Last thing is to set interface address on which server will be listening, it’s set in:

/var/lib/pgsql/14/data/postgresql.conf

Now you are good to go.