📜 ⬆️ ⬇️

We collect RPM-package for CentOS 6.4 x64

All strongly welcome! :)

I want to share the experience of building RPM packages in CentOS 6.4 x64. I like this system, everything is simple, there is a lot of information. Yes, and on most of our services (a small hosting company) it is installed.

On a working server, do not build packages, why do you need extra packages? I created a virtual machine, there I do.
')
Today we are going to build PHP-5.5.4 which came out just a day ago. Why PHP? Because with its assembly I suffered most of all: there was no normal spec-file, then there were errors in it (when I myself added / corrected something). In short, grief, I devoured with him for more than a week. And the solution was born in the throes of how to properly build the package for PHP.

Well, well, dear, to the point!

1. Install the OS. We take into account that all actions with installation and updating are performed by root, therefore we do not use sudo. Now let's upgrade and reboot:
yum update -y && shutdown -r now 


2. We connect additional repositories. I use a few, this:

 rpm -ivh --nosignature http://rpm.axivo.com/redhat/axivo-release-6-1.noarch.rpm && rpm -ihv http://centos.alt.ru/repository/centos/6/x86_64/centalt-release-6-1.noarch.rpm 


Do
 yum update -y 


3. Now install all the good, without which we will never build PHP.
From CentALT first:
 yum install -y libcurl-devel pam-devel sqlite-devel libedit-devel libtool-ltdl-devel libc-client-devel --enablerepo=CentALT 


Then from Axivo:

 yum -y install postgresql-devel unixODBC-devel net-snmp-devel libxslt-devel libxml2-devel aspell-devel enchant-devel libicu-devel mariadb-server mariadb-devel t1lib-devel libjpeg-devel libpng-devel freetype-devel libXpm-devel libvpx-devel gmp-devel tokyocabinet-devel libmcrypt-devel libtidy-devel freetds-devel recode-devel --enablerepo=axivo 


So, let's check the openssl version:

 openssl version 


If not 1.0.1e, then do this:

 yum install -y openssl openssl-devel--enablerepo=axivo 


Now install the necessary for immediate assembly:

 yum groupinstall -y "Development Tools" && yum install rpmdevtools 


4. Now we will create the necessary environment for the assembly. The actions below need to be performed by a regular user, not by root, this is a very important point.

We do this like this:
 rpmdev-setuptree 


This command will create a directory with the following subdirectories:
 + rpmbuild -BUILD -BUILDROOT -RPMS -SOURCES -SPECS -SRPM 


This BUILD will unpack the files from the source archive. RPMS will have your rpm packages. Here SOURCES place all sources with configs. SPECS - contains a spec file that has instructions for building. This is the most important part to build a package. SRPM - contains the * .src.rpm file - the source of the rpm-package. We can distribute it together with rpm-packages, it is who needs something to add / remove from the future package. Contains a spec-file, source code for the assembly.

I will not upload the whole spec-file here, for there are as many as 1200 lines, so I suggest downloading the archive download here
I thought that you could just remake the spec-file from the sources of the rpm-package php-5.4, but it was not there! A lot of pitfalls that are very difficult to solve. I found the necessary src.rpm version 5.5 in the Remi repositories, and reworked it for a new version. And everything turned out.

So, suppose that all the source code you downloaded, unpacked into your home directory. Then go to the SPEC directory and execute the following command to build the rpm package along with src.rpm:
 rpmbuild -ba php55.spec 


I went to the assembly. It will take a long time, depending on the power of the computer. It took me about 40 minutes.

If a new version of PHP is released (say 5.5. *), Then download the bz2-archive into the folder with the source code (remember, this is SOURCES), edit the SPECS / php55.spec file. Change the "Version: 5.5.4" to the desired version. And you can collect new.

Already assembled packages can be downloaded here.

PS Updating on one of the servers from version 5.4 to 5.5.4, nothing terrible happened. The only thing the client got was “Depraceted: preg_replace () / e”, which was fixed by easily replacing preg_replace () / e with preg_replace_callback () .

All creative Uzbeks :)

Source: https://habr.com/ru/post/194482/


All Articles