Reply
New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

RPM's for UniFi Controller

[ Edited ]

Hello

I've built RPM packages for UniFi 3.x

Currently It's compatible with systemd-aware distros like:

  • OpenSuse 12.2 and newer
  • Fedora 15 and newer
  • RHEL 7
  • CentOS 7

A bit later I'll add support for systemv/upstart distros too (i.e. Centos/RHEL 6.x)

rpm spec + systemd source files attached

Short build howto for newbies:

  1. Install rpm-build package 
    Fedora/RHEL: yum install rpm-build
    OpenSuse: zypper install rpm-build
  2. decompress and copy unifi.spec to ~/rpmbuild/SPECS/
  3. copy unifi.service to ~/rpmbuild/SOURCES/
  4. download UniFi.unix.zip and copy to ~/rpmbuild/SOURCES/
  5. change version string in unifi.spec to match the version of file downloaded
  6. run rpmbuild -bb ~/rpmbuild/unifi.spec
  7. built rpm package will be listed after process

I will push updates to My GitHub Account

Feedback is appreciated

Attachment
New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

p.s. trouble attaching spec file, you can download it from here: https://raw2.github.com/GioMac/SPEC/master/unifi.spec

New Member
Posts: 4
Registered: ‎08-18-2014

Re: RPM's for UniFi Controller

Hi.

I kindly need your help in installing Unifi Controller on Fedora 20.

I have tried to follow your steps but i am stuck at ~/rpmbuild/SPECS. cant locate this directory.

 

 

Sammy 

New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

mkdir ~/rpmbuild/SPECS ~/rpmbuild/SOURCES
New Member
Posts: 4
Registered: ‎08-18-2014

Re: RPM's for UniFi Controller

Hi

Am getting this error

 

mkdir: cannot create directory ‘/root/rpmbuild/SPECS’: No such file or directory

am i missing a step......

Sammy

New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

God Man Very Happy

mkdir -p ~/rpmbuild/SPECS ~/rpmbuild/SOURCES
New Member
Posts: 4
Registered: ‎08-18-2014

Re: RPM's for UniFi Controller

Done

Thanks alot

 

New Member
Posts: 4
Registered: ‎08-18-2014

Re: RPM's for UniFi Controller

Is this ok

 

[root@localhost user]# rpmbuild -bb ~/rpmbuild/SPECS/unifi.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ihmDPf
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf UniFi
+ /usr/bin/unzip -qq /root/rpmbuild/SOURCES/UniFi.unix.zip
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd UniFi
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.45rRU7
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd UniFi
+ rm -rf /root/rpmbuild/BUILDROOT/unifi-3.1.6b-0.fc19.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT/unifi-3.1.6b-0.fc19.x86_64/opt/unifi/
+ rm -f readme.txt
+ cp -a bin conf data dl lib webapps /root/rpmbuild/BUILDROOT/unifi-3.1.6b-0.fc19.x86_64/opt/unifi/
+ install -D -m 644 /root/rpmbuild/SOURCES/unifi.service /root/rpmbuild/BUILDROOT/unifi-3.1.6b-0.fc19.x86_64/usr/lib/systemd/system/unifi.service
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/unifi-3.1.6b-0.fc19.x86_64
error: Installed (but unpackaged) file(s) found:
/opt/unifi/bin/mongod
/opt/unifi/conf/catalina.policy
/opt/unifi/conf/catalina.properties
/opt/unifi/conf/context.xml
/opt/unifi/conf/server.xml
/opt/unifi/conf/tomcat-users.xml
/opt/unifi/conf/web.xml
/opt/unifi/data/system.properties
/opt/unifi/dl/firmware/BZ2/2.2.5.1080/firmware.bin
/opt/unifi/dl/firmware/bundles.json
/opt/unifi/lib/MRJAdapter.jar
/opt/unifi/lib/ace.jar
/opt/unifi/lib/annotations-api.jar
/opt/unifi/lib/asm.jar
/opt/unifi/lib/bootstrap.jar
/opt/unifi/lib/catalina-ant.jar
/opt/unifi/lib/catalina-ha.jar
/opt/unifi/lib/catalina-tribes.jar
/opt/unifi/lib/catalina.jar
/opt/unifi/lib/cglib.jar
/opt/unifi/lib/commons-beanutils.jar
/opt/unifi/lib/commons-codec-1.4.jar
/opt/unifi/lib/commons-collections.jar
/opt/unifi/lib/commons-daemon.jar
/opt/unifi/lib/commons-digester.jar
/opt/unifi/lib/commons-httpclient-3.1.jar
/opt/unifi/lib/commons-lang.jar
/opt/unifi/lib/commons-logging.jar
/opt/unifi/lib/dom4j.jar
/opt/unifi/lib/el-api.jar
/opt/unifi/lib/jasper-el.jar
/opt/unifi/lib/jasper-jdt.jar
/opt/unifi/lib/jasper.jar
/opt/unifi/lib/javassist.jar
/opt/unifi/lib/jmdns.jar
/opt/unifi/lib/jsp-api.jar
/opt/unifi/lib/jstl.jar
/opt/unifi/lib/jstun-0.7.3.jar
/opt/unifi/lib/jul-log4j-bridge.jar
/opt/unifi/lib/log4j.jar
/opt/unifi/lib/mail.jar
/opt/unifi/lib/mongo.jar
/opt/unifi/lib/org.springframework.config.java-1.0.0.M4.jar
/opt/unifi/lib/quartz-all-1.6.1.jar
/opt/unifi/lib/servlet-api.jar
/opt/unifi/lib/slf4j-api.jar
/opt/unifi/lib/slf4j-log4j12.jar
/opt/unifi/lib/spring-aop-2.5.6.jar
/opt/unifi/lib/spring-beans-2.5.6.jar
/opt/unifi/lib/spring-context-2.5.6.jar
/opt/unifi/lib/spring-context-support-2.5.6.jar
/opt/unifi/lib/spring-core-2.5.6.jar
/opt/unifi/lib/spring-web-2.5.6.jar
/opt/unifi/lib/sshj.jar
/opt/unifi/lib/standard.jar
/opt/unifi/lib/tomcat-coyote.jar
/opt/unifi/lib/tomcat-dbcp.jar
/opt/unifi/lib/tomcat-i18n-es.jar
/opt/unifi/lib/tomcat-i18n-fr.jar
/opt/unifi/lib/tomcat-i18n-ja.jar
/opt/unifi/lib/tomcat-juli-adapters.jar
/opt/unifi/lib/tomcat-juli.jar
/opt/unifi/webapps/ROOT.war
/usr/lib/systemd/system/unifi.service


RPM build errors:
Installed (but unpackaged) file(s) found:
/opt/unifi/bin/mongod
/opt/unifi/conf/catalina.policy
/opt/unifi/conf/catalina.properties
/opt/unifi/conf/context.xml
/opt/unifi/conf/server.xml
/opt/unifi/conf/tomcat-users.xml
/opt/unifi/conf/web.xml
/opt/unifi/data/system.properties
/opt/unifi/dl/firmware/BZ2/2.2.5.1080/firmware.bin
/opt/unifi/dl/firmware/bundles.json
/opt/unifi/lib/MRJAdapter.jar
/opt/unifi/lib/ace.jar
/opt/unifi/lib/annotations-api.jar
/opt/unifi/lib/asm.jar
/opt/unifi/lib/bootstrap.jar
/opt/unifi/lib/catalina-ant.jar
/opt/unifi/lib/catalina-ha.jar
/opt/unifi/lib/catalina-tribes.jar
/opt/unifi/lib/catalina.jar
/opt/unifi/lib/cglib.jar
/opt/unifi/lib/commons-beanutils.jar
/opt/unifi/lib/commons-codec-1.4.jar
/opt/unifi/lib/commons-collections.jar
/opt/unifi/lib/commons-daemon.jar
/opt/unifi/lib/commons-digester.jar
/opt/unifi/lib/commons-httpclient-3.1.jar
/opt/unifi/lib/commons-lang.jar
/opt/unifi/lib/commons-logging.jar
/opt/unifi/lib/dom4j.jar
/opt/unifi/lib/el-api.jar
/opt/unifi/lib/jasper-el.jar
/opt/unifi/lib/jasper-jdt.jar
/opt/unifi/lib/jasper.jar
/opt/unifi/lib/javassist.jar
/opt/unifi/lib/jmdns.jar
/opt/unifi/lib/jsp-api.jar
/opt/unifi/lib/jstl.jar
/opt/unifi/lib/jstun-0.7.3.jar
/opt/unifi/lib/jul-log4j-bridge.jar
/opt/unifi/lib/log4j.jar
/opt/unifi/lib/mail.jar
/opt/unifi/lib/mongo.jar
/opt/unifi/lib/org.springframework.config.java-1.0.0.M4.jar
/opt/unifi/lib/quartz-all-1.6.1.jar
/opt/unifi/lib/servlet-api.jar
/opt/unifi/lib/slf4j-api.jar
/opt/unifi/lib/slf4j-log4j12.jar
/opt/unifi/lib/spring-aop-2.5.6.jar
/opt/unifi/lib/spring-beans-2.5.6.jar
/opt/unifi/lib/spring-context-2.5.6.jar
/opt/unifi/lib/spring-context-support-2.5.6.jar
/opt/unifi/lib/spring-core-2.5.6.jar
/opt/unifi/lib/spring-web-2.5.6.jar
/opt/unifi/lib/sshj.jar
/opt/unifi/lib/standard.jar
/opt/unifi/lib/tomcat-coyote.jar
/opt/unifi/lib/tomcat-dbcp.jar
/opt/unifi/lib/tomcat-i18n-es.jar
/opt/unifi/lib/tomcat-i18n-fr.jar
/opt/unifi/lib/tomcat-i18n-ja.jar
/opt/unifi/lib/tomcat-juli-adapters.jar
/opt/unifi/lib/tomcat-juli.jar
/opt/unifi/webapps/ROOT.war
/usr/lib/systemd/system/unifi.service

New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

Nope, there's definitely something wrong with the SPEC file, but files missing are specified in the file.

Re-download and check again

New Member
Posts: 12
Registered: ‎11-06-2013
Kudos: 2

Re: RPM's for UniFi Controller

I've been working on a spec as well, for pre-systemd distros (mainly EL6 and its derivatives). I was going to post it after getting most of the build and install quirks under control, but I may turn my attention to packaging 4.1.x instead.

 

I had a couple of design goals in mind:

 

1. Bring the package closer to FHS compliance (i.e.: Log files in /var/log/UniFi). Right now this is done by putting symlinks in /opt/UniFi, but if there's an undocumented setting in system.preferences, that would be more robust. (Symlinks might still stay for ease of support.)

 

2. Use only packages from EL and EPEL. While EPEL's mongodb is slightly older than the developer's own packages, it works perfectly for the controller. Same for Java-- No need to get Oracle's version when OpenJDK works.

 

3. Make it possible to create an RPM from the zip distribution using rpmbuild's -tb option. Doable, except UBNT doesn't supply an initscript in the zip distro. Not sure about the deb package since I don't have a Debian-type system running right now.

 

Emerging Member
Posts: 79
Registered: ‎07-11-2014
Kudos: 11
Solutions: 1

Re: RPM's for UniFi Controller

Hi

 

I just tried to build the RPM on my OpenSuse 13.2 with the spec-file you posted on GitHub. However, i'm getting the following error:

 

unifi-controller-test:~ # rpmbuild -bb ~/rpmbuild/SPECS/unifi.spec
error: File /usr/src/packages/SOURCES/UniFi.unix.zip: No such file or directory

 

 

 

Whats the mistake here, there is no path /usr/src/packages.... referenced in the SPECS file (like you posted on GitHub)?

 

Best,

 

Thomas

New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

Good point, will move to that with RHEL6 support
New Member
Posts: 7
Registered: ‎01-16-2014
Kudos: 1

Re: RPM's for UniFi Controller

For opensuse files will be placed under /usr/src/ instead of ~/rpmbuild/
Emerging Member
Posts: 79
Registered: ‎07-11-2014
Kudos: 11
Solutions: 1

Re: RPM's for UniFi Controller

Hi

 

I managed to compile the package for OpenSuSe 13.2 but when i try to install i get:

 

error: Failed dependencies:
        mongodb-server is needed by unifi-3.2.7-0%{dist}.x86_64
        java is needed by unifi-3.2.7-0%{dist}.x86_64
        systemd-units is needed by unifi-3.2.7-0%{dist}.x86_64

 

-There is no "systemd-units" package for OpenSuse 13.2 available, what is this?

 

-There is no "java" package available.However can i use "java-1_8_0-openjdk"? Is there a metapackage available that always depends on the most recent OpenJDK Java version?

 

-There is no "mongodb-server" package available.

I used this repo "http://software.opensuse.org/download.html?project=server:database&package=mongodb" and then installed the package "mongodb".

 

So how can i solve the 2 remainging problems above?

 

Member
Posts: 117
Registered: ‎05-12-2014
Kudos: 22

Re: RPM's for UniFi Controller

I'm trying to install this on a fresh Fedora 19 install and I get the following (I know I still need to change the hostname).  Any ideas what could cause it?

[root@localhost SPECS]# rpmbuild -bb ~/rpmbuild/SPECS/unifi.spec
warning: bogus date in %changelog: Sat Dec 17 2014 George Machitidze <giomac@gmail.com>
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.9Jsj0c
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf UniFi
+ /usr/bin/unzip -qq /root/rpmbuild/SOURCES/UniFi.unix.zip
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd UniFi
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.7USJlk
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd UniFi
+ rm -rf /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386
+ mkdir -p /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/opt/unifi/
+ rm -f readme.txt
+ cp -a bin conf dl lib webapps /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/opt/unifi/
+ install -D -m 644 /root/rpmbuild/SOURCES/unifi.service /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/usr/lib/systemd/system/unifi.service
install: cannot stat '/root/rpmbuild/SOURCES/unifi.service': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.7USJlk (%install)


RPM build errors:
    bogus date in %changelog: Sat Dec 17 2014 George Machitidze <giomac@gmail.com>
    Bad exit status from /var/tmp/rpm-tmp.7USJlk (%install)
[root@localhost SPECS]# cd
[root@localhost ~]# rpmbuild -bb ~/rpmbuild/SPECS/unifi.spec
warning: bogus date in %changelog: Sat Dec 17 2014 George Machitidze <giomac@gmail.com>
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.3wzF4G
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf UniFi
+ /usr/bin/unzip -qq /root/rpmbuild/SOURCES/UniFi.unix.zip
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd UniFi
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.zVCQ6j
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd UniFi
+ rm -rf /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386
+ mkdir -p /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/opt/unifi/
+ rm -f readme.txt
+ cp -a bin conf dl lib webapps /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/opt/unifi/
+ install -D -m 644 /root/rpmbuild/SOURCES/unifi.service /root/rpmbuild/BUILDROOT/unifi-3.2.7-0.fc19.i386/usr/lib/systemd/system/unifi.service
install: cannot stat '/root/rpmbuild/SOURCES/unifi.service': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.zVCQ6j (%install)


RPM build errors:
    bogus date in %changelog: Sat Dec 17 2014 George Machitidze <giomac@gmail.com>
    Bad exit status from /var/tmp/rpm-tmp.zVCQ6j (%install)

 

New Member
Posts: 2
Registered: ‎09-17-2016

Re: RPM's for UniFi Controller

rpmbuild -bb ~/rpmbuild/SPECS/unifi.spec
error: line 1: Unknown tag: <!DOCTYPE html>

 

Thats all Im getting, when i try to download this from Github seesm this project is no longer supported by github

 

Reply