Migrate CentOS 7 to AlmaLinux 8

The steps are taken from this page https://wiki.almalinux.org/elevate/ELevating-CentOS7-to-AlmaLinux-9.html

To upgrade to AlmaLinux 9, you will need to migrate to AlmaLinux 8 first.

sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
sudo yum upgrade -y

Once yum finishes, reboot

sudo reboot

Now install elevate-release and leapp packages

sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm
sudo yum install -y leapp-upgrade leapp-data-almalinux

Let’s run a pre upgrade check to see if there are any errors.

sudo leapp preupgrade

If everything checked out ok, proceed with the upgrade.

sudo leapp upgrade

Once finished, reboot.

sudo reboot

Once the system is booted, verify it upgraded.

cat /etc/*release

Problems

https://wiki.almalinux.org/elevate/ELevate-frequent-issues

LUKS

If you are using LUKS and encounter an error, check out the following link.

https://www.it-hure.de/2024/02/update-alma-rhel-with-leapp-and-luks/

You can disable the check with the following command.

rm -rf /usr/share/leapp-repository/repositories/system_upgrade/common/actors/inhibitwhenluks

More space needed on / filesystem

Try setting LEAPP_OVL_SIZE to 4096

export LEAPP_OVL_SIZE=4096

Then launch the upgrade with

sudo --preserve-env leapp upgrade

https://forums.almalinux.org/t/at-least-48mb-more-space-needed-on-the-filesystem-running-leapp-upgrade/3808/2

You can also try removing files to create more free space.

https://github.com/oamg/leapp/issues/778

Upgrading to 8.8 (Or 8.4)

For the same reason, we recommend upgrading your CentOS 7 machine to AlmaLinux OS version 8.8. To do so, you need to navigate to the /etc/leapp/files/ directory and edit the leapp_upgrade_repositories.repo to lower the AlmaLinux version in baseurl/mirror to 8.8.

The 8.8 repositories are archived. To upgrade to AlmaLinux 8.8, change ‘/etc/leapp/leapp_upgrade_repositories.repo” to the following.

[almalinux8-BaseOS]
name=AlmaLinux 8 - BaseOS
baseurl=https://vault.almalinux.org/8.8/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

[almalinux8-AppStream]
name=AlmaLinux 8 - AppStream
baseurl=https://vault.almalinux.org/8.8/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

[almalinux8-PowerTools]
name=AlmaLinux 8 - PowerTools
baseurl=https://vault.almalinux.org/8.8/PowerTools/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

[almalinux8-HighAvailability]
name=AlmaLinux 8 - HighAvailability
baseurl=https://vault.almalinux.org/8.8/HighAvailability/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

[almalinux8-ResilientStorage]
name=AlmaLinux 8 - ResilientStorage
baseurl=https://vault.almalinux.org/8.8/ResilientStorage/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

[almalinux8-Extras]
name=AlmaLinux 8 - Extras
baseurl=https://vault.almalinux.org/8.8/extras/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux

If you have issues, you may consider upgrading to 8.4 first. To do that, change 8.8 to 8.4, and comment out the ResilientStorage section.

GPG Key failing after upgrade

Try importing the AlmaLinux 8 GPG key

rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

https://almalinux.org/blog/2023-12-20-almalinux-8-key-update

How to Install Zenoss 5 on CentOS 7

Note:

  1. This is not a comprehensive guide, if you need more info, refer to the installation manual here.
  2. This assumes that all your partitions are going to be on one drive

Installing CentOS 7

Note: If you have issues installing CentOS via the default install interface, try using the Fallback graphics mode, found in the Grub boot menu under “trubbleshooting”.

Install CentOS like you normally would, just be sure to leave at least 60GB of free space for Docker/Zenoss

2

You can Select Automatic Partitioning, but you will need to make additional space available.  I just configured it manually.3

 Note that I have about 75GB of free space, this will be used for “/var/lib/docker” and “/opt/serviced/var/volumes”.  We’ll set these up later on.1

You don’t necessarily need to setup a user, but you can if you want to.  4

Once your finished reboot and login.5

 

Configuring CentOS for Zenoss

Setup network

You will need to setup your network settings.  Refer to this post to set a static IP address if needed.

 

Note: In CentOS 7 ifconfig is not installed by default.  If you need to check the IP address use the following command.

ip addr sh

After your connected to the internet you can install ifconfig with

yum install -y net-tools

Setup Hostname

Zenoss seems to have issues if you change the hostname after it is installed so be sure to set up the hostname before you start installing zenoss.

Check current hostname

hostname

Change the hostname.  Replace “newhostname” with your new hostname.

hostnamectl set-hostname newhostname

After you finish configuring the hostname, add it to “/etc/hosts” with the following command.  Change the IP address and the hostname “zenoss” to your systems IP address and hostname.

echo "192.168.56.101   zenoss" >> /etc/hosts

Update your system

yum update -y

Disable Firewall

systemctl stop firewalld && systemctl disable firewalld

Enable persistent log storage

mkdir -p /var/log/journal && systemctl restart systemd-journald

Create two Btrfs file systems

First create two normal linux partitions using your favorite disk utility.  I am using cfdisk.  Each partition should be over 30GB.

cfdisk /dev/sda

6

Create two Primary partitions and put them at the end and then write and exit.

7

Take note of the two new partitions names.  Mine are “sda4” and “sda3”.

After the above changes are made, it would be a good idea to reboot the machine so the partition table can be updated.

reboot

Now we will reformat the two partitions as Btrfs

Create mount point.

mkdir -p /var/lib/docker /opt/serviced/var/volumes

Change “/dev/sda3” and “/dev/sda4” to your partitions names if they are different.

DOCKER_PART=/dev/sda3
APP_PART=/dev/sda4
mkfs -t btrfs --nodiscard $DOCKER_PART
mkfs -t btrfs --nodiscard $APP_PART

Add the new file systems to fstab, so they automatically mount on boot.

APP_PATH="/opt/serviced/var/volumes"
echo "$DOCKER_PART /var/lib/docker btrfs rw,noatime,nodatacow 0 0" >> /etc/fstab
echo "$APP_PART $APP_PATH btrfs rw,noatime,nodatacow 0 0" >> /etc/fstab

Mount the new filesystems, and make sure that they mounted

mount -a
if [[ `mount | egrep 'docker|serviced'` ]]; then echo "Mounted" ; else echo "Not Mounted" ; fi

You can manually check by running the following command.

mount | egrep 'docker|serviced'

you should receive something like the following

/dev/sda3 on /var/lib/docker type btrfs (rw,noatime,seclabel,nodatasum,nodatacow,space_cache)
/dev/sda4 on /opt/serviced/var/volumes type btrfs (rw,noatime,seclabel,nodatasum,nodatacow,space_cache)

Disable SELinux

By default SELinux is installed and enabled.  To disable SELinux either edit the config file “/etc/selinux/config” and change “SELINUX=enforcing” to “SELINUX=disabled”, or you can run the following command.

EXT=$(date +"%j-%H%M%S")
sudo sed -i.${EXT} -e 's/^SELINUX=.*/SELINUX=disabled/g' \
/etc/selinux/config && \
grep '^SELINUX=' /etc/selinux/config

Enable Dnsmasq

systemctl enable dnsmasq && systemctl start dnsmasq

Install and Configure NTP

yum install -y ntp && systemctl enable ntpd

Have NTP start on system boot and then start NTP

echo "systemctl start ntpd" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
systemctl start ntpd

Download and install the Zenoss repository

rpm -ivh http://get.zenoss.io/yum/zenoss-repo-1-1.x86_64.rpm
yum clean all

Final Reboot

reboot

 

Installing Zenoss

 

Once your logged back into the system start installing zenoss

Install the Zenoss-core service and start docker

yum --enablerepo=zenoss-stable install -y zenoss-core-service
systemctl start docker

Add the Btrfs and DNS flags to the Docker startup options

Identify ip for docker

ip addr | grep -A 2 'docker0:' | grep inet

Add the docker startup options.  Change the ip address if needed.  It should match the one from the previous command.

echo 'DOCKER_OPTS="-s btrfs --dns=172.17.42.1"' >> /etc/sysconfig/docker

Change the volume type for application data

You can manually edit the serviced file “/etc/default/serviced” and change the variable “SERVICED_FS_TYPE” from “rsync” to “btrfs” or run the following command.

EXT=$(date +"%j-%H%M%S")
 sudo sed -i.${EXT} \
 -e 's|^#[^S]*\(SERVICED_FS_TYPE=\).*$|\1btrfs|' \
 /etc/default/serviced

Restart docker

systemctl stop docker && systemctl start docker

Start the control center

systemctl start serviced

you can monitor the process with

journalctl -u serviced -f

Serviced has about 5-10 minutes worth of work to do before you’ll be able to login to the Control Center interface.  If the service fails to start, reboot the server.

Setting up name resolution

To setup name resolution on you local computer just add the following line to your “hosts” file.  On Linux and OS X this is located in “/etc/hosts” On Windows machines it is under “\Windows\Sytem32\Drivers\etc\hosts”

192.168.56.101 hostname zenoss5.hostname hbase.hostname opentsdb.hostname rabbitmq.hostname

Be sure to change the IP address and “hostname”  to the IP address and hostname of your server.  You also might need administrative privileges to edit the hosts file.

10

Logging into the Control Center.

Now open up a web browser and go the following URL.  Change the IP address to your servers IP.

https://192.168.56.101

Login with the Zenoss server root username and password.  If you want to setup a user other then root, please refer to the Zenoss Installation guide here.

11

Change the hostname to your Zenoss server hostname12

Select the check boxes in the next two steps.13 14

Give it a deployment id and deploy it.15 16

Once it is deployed Make sure that it is started.  Once it finishes go log into Zenoss.  It can take awhile for Zenoss to start up, depending on your hardware, so be patient.

The Direct URL for Zenoss is

https://zenoss5.hostname