Also taken: http://magazine.redhat.com/2007/12/04/hacking-rpms-with-rpmrebuild/
WARNING: USE AT OWN RISK
- remove non-critical, unmet dependencies in rpm
- get good version of rpmrebuild
- wget ftp://fr2.rpmfind.net/linux/opensuse/ports/update/12.3/noarch/rpmrebuild-2.9-7.4.1.noarch.rpm
- yum localinstall rpmrebuild-2.9-7.4.1.noarch.rpm
- wget http://downloads.sourceforge.net/project/zenoss/zenoss-4.2/zenoss-4.2.4/4.2.4-1897/zenoss_core-4.2.4-1897.el6.x86_64.rpm
- rpmrebuild -e -n -p zenoss_core-4.2.4-1897.el6.x86_64.rpm
- remove lines
- Requires: libgcj
- %dir %attr(0755, root, root) "/etc/sudoers.d"
- # ensure that the system uses the /etc/sudoers.d directory
- SUDOERSD_TOKEN="#includedir /etc/sudoers.d"
- SUDOERSD_FOUND=`/bin/egrep "^$SUDOERSD_TOKEN" /etc/sudoers`
- if [ -z "$SUDOERSD_FOUND" ]; then
- echo "# zenoss rpm, ensure that /etc/sudoers.d loads" >> /etc/sudoers
- echo $SUDOERSD_TOKEN >> /etc/sudoers
- fi
- save file and "continue"
- note place resultant file is created, copy to local working directory
- if you can't find it where it is supposed to be
- yum -y install mlocate
- updatedb
- locate zenoss
- ntp
- ntpq -pn
- make sure ntp is installed and running
- java
- remove openjdk and install oracle java
- yum -y remove java jdk
- wget -N -O jre-6u31-linux-x64-rpm.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=59622
- chmod +x jre-6u31-linux-x64-rpm.bin
- ./jre-6u31-linux-x64-rpm.bin
- verify
- java -version
- echo $JAVA_HOME
- cover missing libgcj, not strictly necessary
- yum -y install ecj
- only for running java classes natively instead of using JVM
- about as obscure as it gets
- Add extra repos
- rpm --import http://dev.zenoss.org/yum/RPM-GPG-KEY-zenoss
- yum-config-manager --enable epel
- yum --nogpgcheck -y localinstall http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
- install some deps
- yum -y install memcached net-snmp
- start some dep services
- service memcached start
- service snmpd start
- chkconfig memcached on
- chkconfig snmpd on
- mysql
- yum -y install mysql-server
- service mysqld start
- chkconfig mysqld on
- install amazon linux compatible zenoss rpm you created above
- yum --nogpgcheck localinstall zenoss-4.2.4-1897.el6.x86_64.rpm
- echo > /opt/zenoss/var/zenpack_actions.txt
- you REALLY don't want these right now, install by-hand later
- start more dep services
- service rabbitmq-server start
- chkconfig rabbitmq-server on
- start and stop zenoss core, dbs and files are created
- service zenoss start;sleep 5;service zenoss stop
- post zenoss updates as zenoss user, then back to root user
- su -l zenoss
- wget --no-check-certificate https://raw.github.com/osu-sig/zenoss-autodeploy-4.2.3/master/secure_zenoss.sh
- sh secure_zenoss.sh
- egrep 'user|password' $ZENHOME/etc/global.conf | grep -v admin
- zodbpw=$(grep zodb-password $ZENHOME/etc/global.conf | awk '{print $2}')
- sed -i.orig "5s/zenoss/$zodbpw/" $ZENHOME/etc/zodb_db_{main,session}.conf
- tail -n +1 $ZENHOME/etc/zodb_db_{main,session}.conf
- exit
- set mysql password for zenoss user using password generated above
- mysql -u root -p
- SET PASSWORD FOR 'zenoss'@'localhost' = PASSWORD('18zmcTgYsA+AjczljwQd');
- sub your password in instead
- create zenoss user for rabbitmq
- vim set-rabbitmq-perms.sh
- grab code below and put in here
- sh set-rabbitmq-perms.sh
- service rabbitmq-server restart
- start zenoss final time
- service zenoss restart
- chkconfig zenoss on
- verify
- su -l zenoss -c 'zenoss status'
- rabbitmqctl -p /zenoss list_queues
- Add this line to the end of /etc/sudo.conf
- #includedir /etc/sudoers.d
- was removed during rpm tweak
NOTE: this is probably not perfect, but very close, please, send corrections
###################################################
## code for set-rabbitmq-perms.sh
#!/usr/bin/env bash
set -e
ZENHOME="/opt/zenoss"
ZENHOME="/opt/zenoss"
VHOSTS="/zenoss"
USER="zenoss"
PASS="grep amqppassword \$ZENHOME/etc/global.conf | awk '{print \$2}'"
if [ $(id -u) -eq 0 ]
then
RABBITMQCTL=$(which rabbitmqctl)
$RABBITMQCTL stop_app
$RABBITMQCTL reset
$RABBITMQCTL start_app
$RABBITMQCTL add_user "$USER" "$(su -l zenoss -c "$PASS")"
for vhost in $VHOSTS; do
$RABBITMQCTL add_vhost "$vhost"
$RABBITMQCTL set_permissions -p "$vhost" "$USER" '.*' '.*' '.*'
done
exit 0
else
echo "Error: Run this script as the root user." >&2
exit 1
After trying to save the file in the rpmrebuild, I get the error:
ReplyDeleterpm: -bb: unknown option
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: package 'zenoss_core-4.2.4-1897.el5.x86_64.rpm' build failed
Let me know if this helps and I'll make it "Step #1": yum groupinstall "Development Tools"
ReplyDeletethis was truly awesome. thanks so much for this!!
ReplyDelete