Post

Install Foreman with Katello

Install Foreman with Katello plugin for content management using an external database

Install Foreman with Katello

Overview

After scrapping every bit of information i could find on how to install Foreman in my home lab, i decided to make a guide for other pshycos out there that wish to go down that rabbit hole.

In this guide you will see:

  • How to install foreman with katello plugin on an external DB
  • How to Install some optional functionality

Everything on this guide has been tested with Foreman 3.14 and Katello 4.16.

Prepare External Database

I opted for a an external DB, because it makes more sense in my setup. If you want to go with the bundled DB skip this step.

According to the official documentation in order to use an external DB you have to first install the bundled version, migrate the schema and reconfigure foreman to use the external DB. I found that you can skip that and do a fresh install direcly on an external DB.

Officialy, foreman supports PostgreSQL version 12 and 13, but in my instance I’m using version 15 without issue. If you not sure go with 13.

PostgreSQL 12-13

  • Install a new instance of PostgreSQL on a separate machine or use an existing instance like i did.
  • Create 3 separate databases on hour postgresql server with their respective users and passwords. Make also sure that postgres configuration allows remote access from these users
    • candlepin
    • foreman
    • pulpecore
  • On the managed instance foreman-installer installs the plpgsql, evr and hstore extensions so make sure you have them on your instance as well. Foreman wont work without those.

PostgreSQL 15

In case you decide to go with version 15, you should know that you will have to compile the evr extention yourself.

For version 15 the procedure is exactly the same with some extra steps.

  • Install postgresql-devel, postgresql-server-devel , postgresql-contrib, gcc and make

    1
    
      dnf install postgresq-devel gcc make postgresql-server-devel postgresql-contrib
    
  • Clone postgresql-evr repository and compile it

    1
    2
    3
    
      cd postgresql-evr/
      make
      make install
    
  • Restart postgresql

    1
    
      systemctl restart postgresql
    
  • Login into the DB and create the missing extention.

Install foreman with katello

We can install everything with a single command.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
foreman-installer --scenario katello \ 
    --katello-candlepin-manage-db false \ # This flag is used since we are using and external DB
    --katello-candlepin-db-host postgres.domain.com \ # Our DB host, you can also use IP instead of FQDN 
    --katello-candlepin-db-name candlepin \ # candlepin DB schema name 
    --katello-candlepin-db-user candlepin \ # candlepin DB schema user 
    --katello-candlepin-db-password changeme! \ # candlepin DB schema password 
    --foreman-proxy-content-pulpcore-manage-postgresql false \  # This flag is used since we are using and external DB
    --foreman-proxy-content-pulpcore-postgresql-host postgres.domain.com \ # Our DB host, you can also use IP instead of FQDN 
    --foreman-proxy-content-pulpcore-postgresql-db-name pulpcore \ # pulpcore DB schema name 
    --foreman-proxy-content-pulpcore-postgresql-user pulp \ # pulpcore DB schema user 
    --foreman-proxy-content-pulpcore-postgresql-password changeme! \ # pulpcore DB schema password 
    --foreman-db-manage false --foreman-db-host postgres.domain.com \ # Our DB host, you can also use IP instead of FQDN 
    --foreman-db-database foreman \ # foreman DB schema name 
    --foreman-db-username foreman \ # foreman DB schema user 
    --foreman-db-password changeme! \ # foreman DB schema password 
    --tuning development # tuning profile based on our resources

If you chose to use the internal DB instead the command is much simpler.

1
2
foreman-installer --scenario katello \ 
    --tuning development # tuning profile based on our resources

The --tuning development flag is used here in order to bypass the installers resource contraints. In a production enviroment this should not be used.

Optional: Install additional plugins.

1
2
3
4
5
6
foreman-installer --scenario katello \
    --enable-foreman-plugin-ansible \
    --enable-foreman-proxy-plugin-ansible \
    --enable-foreman-plugin-remote-execution \
    --enable-foreman-plugin-openscap \
    --enable-foreman-plugin-rh-cloud

Conclusion

You should now have a functional Foreman installation. Check the installation log for the login password.

This post is licensed under CC BY 4.0 by the author.