Here is what one needs to do to upgrade CentOS 6 to CentOS 7 for the
foreman server.
1. Install a new CentOS 7 server with the same version of The Foreman
that is installed on the CentOS 6 server, including all plugins
2. Discover the version of PostgreSQL that is installed on the CentOS 7
server, and used by The Foreman (rpm -qa | grep postgres)
3. Download this version of the tar and zipped binary distribution of
the PostgreSQL server onto the CentOS 6 server
- https://www.postgresql.org/download/linux/ (clicking on "
download a *tag.gz archive* of the binaries, ..." is a link to the
following URL)
- https://www.enterprisedb.com/download-postgresql-binaries
4. Shutdown services (not PostgreSQL) on the CentOS 6 server
5. On the CentOS 6 server, extract this tar and zipped PostgreSQL
distribution into a directory named '/usr/local/src/pgsql/'
6. Backup the CentOS 6 Foreman server as described in the foreman
documentation, except for PostgreSQL
7. Next, backup The Foreman's PostgreSQL database on the CentOS 6 server
with the following command series (Postgres calls `-Fc` a "custom dump")
-
- su postgres
- /usr/local/src/pgsql/bin/pg_dump -Fc foreman >
/tmp/pg_centos6server_foremanFc-20170814.dump
8. restore the postgres dump to centos 7 postgres server (Restoring the
dump file wants to create the database, but it doesn't, so we create it and
endure the resulting error message during the restore operation as shown
here)
- su - postgres
- dropdb foreman
- createdb foreman
- g_restore -C -d foreman
/tmp/pg_centos6server_foremanFc-20170814.dump
-
- You will see the following output, but the restore will still
complete:
- could not change directory to "/root"
- pg_restore: [archiver (db)] Error while PROCESSING TOC:
- pg_restore: [archiver (db)] Error from TOC entry 2897; 1262
16385 DATABASE foreman foreman
- pg_restore: [archiver (db)] could not execute query: ERROR:
database "foreman" already exists
- Command was: CREATE DATABASE foreman WITH TEMPLATE =
template0 ENCODING = 'SQL_ASCII' LC_COLLATE = 'C' LC_CTYPE = 'C';
- WARNING: errors ignored on restore: 1
9. Your Foreman server is now migrated from CentOS 6 to CentOS 7.
If this is your puppet master and/or certificate authority, you may want to
perform these additional steps
1. copy over the host configuration from centos 6 to 7 server, if you do
not want them to be rebuilt
- rsync -av /var/lib/puppet/yaml/
root@yourcentos7server:/var/lib/puppet/yaml/
2. On the Puppet Master, if necessary, create a new SSL Certificate
for the centos 7 server with DNS Alt Name
1. https://docs.puppet.com/pe/latest/regenerate_certs_master.html
2. puppet cert clean yourcentos7server
3. puppet cert generate yourcentos7server
--dns_alt_names=puppet,puppet.example.com,foreman.example.com
4. restart services
3. On Puppet Slaves, if necessary, create a new SSL Certificate with DNS
Alt Name
1. add dns_alt_names to [main] section in /etc/puppet/puppet.conf
2. change the puppet master server to the yourcentos7server in
/etc/puppet/puppet.conf
3. puppet agent -t (generates new cert)
1. sign this cert on the master, if not autosigned
4. restart services
4. On CentOS 7 server, ensure the httpd, foreman, and foreman-proxy
services are enabled; also ensure firewalld settings are correct
-RG
On Monday, February 8, 2016 at 10:09:50 AM UTC-6, Gato Pardo wrote:
>
>
> Hello!
>
> We have been using Foreman for quite a while and we're very happy with it
> This may be the first time we try to do something that is not already
> documented.
>
> We're currently using Foreman 1.10.1 in a CentOS 6 machine, but now time
> comes to upgrade to CentOS 7 since we're standardizing all machines in the
> new OS.
>
> I tried to migrate the server, with the backup - restore process as shown
> in the documentation (0). The result is not 100% correct, although I would
> say it mostly works since our installation is pretty simple (we use Foreman
> for the ENC and report visualization mostly).
>
> I've got a bunch of database errors when importing the backup like:
>
> pg_restore: [archiver (db)] could not execute query: ERROR: constraint
> "user_roles_role_id_fk" for relation "user_roles" already exists
> Command was: ALTER TABLE ONLY user_roles
> ADD CONSTRAINT user_roles_role_id_fk FOREIGN KEY (role_id) REFERENCES
> roles(id);
>
> I wasn't able to find any documentation or experiences, so would anyone
> have some experience with that kind of upgrade? May I had been impacted by
> the PostgreSQL migration (8.4 to 9.2)?
>
> Any tip would be really appreciated!
>
> Cheers!
>
> (0)
> http://theforeman.org/manuals/1.10/index.html#5.5Backup,RecoveryandMigration
>
--
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.