[Koha-devel] Koha 17 on Centos 7

David Cook dcook at prosentient.com.au
Fri Sep 1 02:46:13 CEST 2017


I have been thinking about creating RPM packages for Koha, but I use openSUSE rather than Fedora/RHEL/CentOS. While they both use RPMs, they don't always share the same filesystem layouts and anything with XS code would need to be compiled on a source system that matches a target system. Plus they have different package repositories available to them. 

But you could learn how the RPM spec file format. It has a special syntax for Perl dependencies which will allow the package manager to try to source Perl dependencies from RPM sources if it can't find them already installed on the system. That would make things faster than installing things one by one from CPAN using cpanm. 

Alternatively, you could leverage the work of others. I think CentOS 7 is based on RHEL 7 which is based on Fedora 19/20? But there is a thing here about Fedora 23 which might be useful: https://wiki.koha-community.org/wiki/Koha_3.22_on_Fedora_23. The Ansible task they've created looks pretty good (https://github.com/nemobis/beic-koha/blob/01c051d3b5c02a6e9f584e8663788096de8c5d39/ansible-koha/tasks/koha-dependencies-fedora.yml) so you could adapt that for your purposes.

You can also look at this email thread: http://koha.1045719.n5.nabble.com/RPMs-for-Koha-Fedora-RHEL-openSUSE-etc-td5904630.html. 

Nicholas van Oudt has a repository of Perl dependencies at https://copr.fedorainfracloud.org/coprs/vanoudt/KOHAExtra/. It looks like they're built for Fedora 25 and Fedora 26 so they might be a bit too new, but you could review it. 

There is an amazing tool called "cpanspec" for building RPM packages from CPAN. I think it's already available in CentOS 7: https://centos.pkgs.org/7/epel-x86_64/cpanspec-1.78-19.el7.noarch.rpm.html. You could probably write a little script to pull the dependencies in text form from Koha and then run each through cpanspec to get a bunch of packages you could put in a Yum repository that you host locally on your CentOS box. Sometimes you need to tidy up the specfiles created by cpanspec  before building a package but overall it's very good. Actually, after you run "make", you should have a META.yml file which specifies all the Perl dependencies. 

Unfortunately, the cpanspec tool in openSUSE is hideously broken last I looked so I don't use it for our Koha and we have to rely on cpanm for managing our dependencies when we can't find packages in openSUSE's repositories.

Oh, another interesting thing about the RPM spec file. You don't actually have to specify your Perl dependencies as I mentioned above. It can autoscan your Koha source to determine your dependencies for you, and thus when you go to install it will auto-resolve everything it can for you.

If I were in your position, I would probably make a RPM specfile for your Koha, and try that out. Then just manually install any remaining dependencies the RPM system can't automagically resolve. 

You may also want to talk to Eric Bégin from inLibro. If I recall correctly, he recently installed Koha on RHEL 7. I think Marcel de Rooy uses Fedora for Koha as well. I don't know what version though. 

Sometimes I think about adding a RPM specfile to Koha master, but without managing a community Yum repository for missing modules, it wouldn't be "out of the box" usable for people. Maybe I should look at adding one anyway. Even if you couldn't build a RPM out of the box, it would give folk like you a leg up...

Finally, I actually have built a specfile for Koha that I use locally on openSUSE, but I use a custom layout and I've already used cpanm to install my dependencies ahead of time. There are a couple of sections from my specfile which might be useful for you which I'll include here:

%build
export LOG_DIR=%{koha_log_dir}
export ZEBRA_DATA_DIR=%{koha_zebra_data_dir}
export ZEBRA_RUN_DIR=%{koha_zebra_run_dir}
export ZEBRA_LOCK_DIR=%{koha_zebra_lock_dir}
export INSTALL_MODE=%{koha_install_mode}
export INSTALL_BASE=%{koha_install_base}
export DB_HOST=%{koha_db_host}
export DB_NAME=%{koha_db_name}
export DB_USER=%{koha_db_user}
export DB_PASS=%{koha_db_pass}
# Make "perl Makefile.PL" be non-interactive.
export PERL_MM_USE_DEFAULT=1
perl Makefile.PL
make

%install
make install DESTDIR=%{buildroot}

The most relevant parts are the PERL_MM_USE_DEFAULT bit as that makes the build process non-interactive. Also, the "make install DESTDIR" bit is important as otherwise the build system won't be able to find your source files. 

Hope that helps a bit! Happy to hear any RPM specfile related questions. I've used specfiles and cpanspec quite a bit for other Perl projects on RHEL, so I probably have answers to any questions you might have about it. 

Really the hardest thing is just finding/making the Perl dependencies as packages. 

Alternatively, you might look at CPAN's functionality. I think Koha 3.20 still had the install-CPAN.pl script. It might be worth reviewing. While I haven't tried it, you might be able to use "cpanm --installdeps ." or something like it just to auto-install the dependencies and then install Koha however you want. 

(If you're using Plack, you can really go down the rabbit hole and maybe look at things like http://search.cpan.org/~miyagawa/Carton-v1.0.28/lib/Carton.pm where it manages and installs your dependencies into a local application specific directory. You'd just need to make sure you're configuring your PERL5LIB correctly for things outside the Plack instance like cronjobs.) 
(Actually, you could probably do this even when using CGI Koha, so long as you configured your Apache using PERl5LIB to point to the local Carton directory. You can specify multiple directories in PERL5LIB by using ":" colon separators. I can't recall the order that directories are added to @INC when using PERL5LIB on a Fedora/RHEL/CentOS system...)

So there's lots of options for things to try! Due to lack of time, I can't really help beyond emails, but I think about this stuff a lot, since I'm a non-Debian Koha user. And I constantly internally debate the merits of using OS packages vs language packages (e.g. provided by CPAN for Perl, pip for Python, etc). 

David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia

Office: 02 9212 0899
Direct: 02 8005 0595

-----Original Message-----
From: koha-devel-bounces at lists.koha-community.org [mailto:koha-devel-bounces at lists.koha-community.org] On Behalf Of Michael Kuhn
Sent: Friday, 1 September 2017 2:08 AM
To: koha-devel at lists.koha-community.org
Subject: Re: [Koha-devel] Koha 17 on Centos 7

Hi Waylon

> Is there instructions somewhere, that tell me how to install koha 17 
> on centos 7?
> 
> Does anyone have any hints? Do i really have to one by one, install 
> all those dependancies that the dependancy script says? or is there a 
> faster way?


Most probably, yes. CentOS is definitely NOT supported by the Koha Community (at the time only Debian GNU/Linux 8 and Ubuntu 16.04 are supported, see https://koha-community.org/download-koha/ ).

I'm trying to collect information about other operating systems resp. 
distributions. About CentOS I found only the following:

1. 
https://wiki.koha-community.org/wiki/Koha_3.10_on_Centos_6.3_x86_64_en
(a very old documentation)

2. https://lists.katipo.co.nz/public/koha/2016-October/046473.html
(someone claiming to have Koha installed on CentOS "just fine")

 From my personal experience, there is nothing better than Debian 8 if you want to use Koha.

Hope this helps.

Best wishes: Michael
--
Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik at adminkuhn.ch · W www.adminkuhn.ch _______________________________________________
Koha-devel mailing list
Koha-devel at lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/




More information about the Koha-devel mailing list