This page describes how to install Candlepin using the rpms. If you are building from source, please see Developer Deployment.
The following instructions assume use of RHEL/Fedora (tested on EL5/6 and Fedora 20/21). It maybe be possible to install on other distributions by adapting the steps as necessary.
Install PostgresSQL.
$ sudo yum install -y postgresql-server postgresql
Initialize PostgreSQL.
$ sudo postgresql-setup initdb # Fedora
$ sudo /sbin/service postgresql initdb # RHEL/CentOS
Update /var/lib/pgsql/data/pg_hba.conf
to be trust instead of ident:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
Enable and start the PostgreSQL server.
$ sudo chkconfig postgresql on
$ sudo /sbin/service postgresql start
Configure the yum repo,
$ wget -O /etc/yum.repos.d/fedora-candlepin.repo http://repos.fedorapeople.org/repos/candlepin/candlepin/fedora-candlepin.repo
OR
$ wget -O /etc/yum.repos.d/epel-candlepin.repo http://repos.fedorapeople.org/repos/candlepin/candlepin/epel-candlepin.repo
Enable EPEL repository. Note: this step is necessary only at RedHat/CentOS.
$ sudo yum -y install epel-release
Install Candlepin
$ sudo yum install candlepin-tomcat6
Make sure you have OpenJDK 1.6 java configured as the default system-wide
java platform using java -version
. If not set it as the default:
$ sudo update-alternatives --config java
Create the candlepin user:
$ sudo su - postgres -c 'createuser -dls candlepin'
Setup candlepin
$ sudo /usr/share/candlepin/cpsetup
Verify Candlepin is running:
$ curl -k -u admin:admin https://localhost:8443/candlepin/status
For the most part, cpsetup
should JUST WORK (TM), here is an example of a successful run of cpsetup
:
# /usr/share/candlepin/cpsetup
Dropping candlepin database
Creating candlepin database
Loading candlepin schema
Writing configuration file
Creating CA private key password
Creating CA private key
Creating CA public key
Creating CA certificate
Waiting for tomcat to restart...
Candlepin has been configured.
There are occasions where you might run into some problems. Below is a set of common problems you might experience.
If you see this error:
Dropping candlepin database
########## ERROR ############
Error running command: dropdb -U candlepin candlepin
Status code: 256
Command output: dropdb: could not connect to database postgres: could not connect to server:
then start PostgreSQL:
$ sudo /sbin/service postgresql start
If you see this error:
########## ERROR ############
Error running command: dropdb -U candlepin candlepin
Status code: 256
Command output: dropdb: could not connect to database postgres: FATAL: Ident authentication failed for user "candlepin"
then create the PostgreSQL user:
$ sudo su - postgres -c 'createuser -dls candlepin'
Sometimes re-running cpsetup
might result in the following error meaning that
either the user is logged into the database using a database client i.e. psql
or candlepin application is still running (most likely).
Dropping candlepin database
########## ERROR ############
Error running command: dropdb -U candlepin candlepin
Status code: 256
Command output: dropdb: database removal failed: ERROR: database "candlepin" is being accessed by other users
DETAIL: There are 1 other session(s) using the database.
Most of the time this is a result of the candlepin webapp still running, restart tomcat
$ sudo /sbin/service tomcat6 stop
If you are using a database client, quit the database client.
candlepin=# \q
Candlepin currently expects that the database is configured in trust mode (i.e. no password required). If you see the following error, please check the PostgreSQLTips for help.
Dropping candlepin database
########## ERROR ############
Error running command: dropdb -U candlepin candlepin
Status code: 256
Command output: dropdb: could not connect to database postgres: FATAL: Ident authentication failed for user "candlepin"
tomcat6 installs java-1.5.0-gcj instead of java-1.6.0-openjdk and sets some incorrect permissions which may lead to the following error during cpsetup:
########## ERROR ############
Error running command: wget -qO- http://localhost:8080/candlepin/admin/init
Status code: 2048
Command output:
Traceback (most recent call last):
File "/usr/share/candlepin/cpsetup", line 215, in <module>
main(sys.argv[1:])
File "/usr/share/candlepin/cpsetup", line 207, in main
run_command("wget -qO- http://localhost:8080/candlepin/admin/init")
File "/usr/share/candlepin/cpsetup", line 34, in run_command
raise Exception("Error running command")
Exception: Error running command
Please make sure that you have installed java-1.6.x-openjdk and check if permissions are correct for tomcat6, as noted in Red Hat Bugzilla 708694