<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Admon Home &#187; rpm</title>
	<atom:link href="http://www.admon.org/tag/rpm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.admon.org</link>
	<description>Linux System Administration</description>
	<lastBuildDate>Sat, 19 May 2012 03:36:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Nginx 1.0.6 RPM package SPEC file</title>
		<link>http://www.admon.org/nginx-1-0-6-rpm-package-spec-file/</link>
		<comments>http://www.admon.org/nginx-1-0-6-rpm-package-spec-file/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 13:07:39 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[spec file]]></category>

		<guid isPermaLink="false">http://www.admon.org/?p=942</guid>
		<description><![CDATA[Here&#8217;s is a SPEC file for building the latest Nginx-v1.0.6 on RHEL/CentOS platform. My Basic modifications are: Nginx would be installed in a dedicated directory named /opt/admon/nginx The Nginx serves as a basic web server. Only a limited amount of modules are enabled. You can update it by tweaking the compiling parameter. The generated package [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-755" title="nginx" src="http://www.admon.org/wp-content/uploads/2010/01/nginx-150x150.png" alt="" width="150" height="150" />Here&#8217;s is a SPEC file for building the latest Nginx-v1.0.6 on RHEL/CentOS platform. My Basic modifications are:</p>
<ul>
<ul>
<li>Nginx would be installed in a dedicated directory named <em>/opt/admon/nginx</em></li>
<li>The Nginx serves as a basic web server. Only a limited amount of modules are enabled. You can update it by tweaking the compiling parameter.</li>
</ul>
</ul>
<p><span id="more-942"></span></p>
<ul>
<li>The generated package is &#8220;nginx-1.0.6-1.admon.x86_64.rpm&#8221;, where is also an example for your self-crafted packages&#8217; version control.</li>
</ul>
<p>It&#8217;s tested OK on RHEL-5u7. If you got any issues, please leave a comment for us.</p>
<p><strong>Nginx SPEC file for building RPM package</strong></p>
<pre># cat nginx-stable.spec
%define nginx_user      nginx
%define nginx_group     admon
%define _prefix         /opt/admon/nginx
%define nginx_home      %{_prefix}/lib/nginx
%define nginx_home_tmp  %{nginx_home}/tmp
%define nginx_logdir    %{_localstatedir}/log/nginx
%define nginx_confdir   %{_prefix}/etc
%define nginx_datadir   %{_datadir}/nginx
%define real_name       nginx
%define dist		admon
%define _unpackaged_files_terminate_build 0

Name:           nginx
Version:        1.0.5
Release:	1.%{dist}
Summary:        Robust, small and high performance http and reverse proxy server
Group:          System Environment/Daemons   

# BSD License (two clause)
# http://www.freebsd.org/copyright/freebsd-license.html
License:        BSD
URL:            http://nginx.org/
BuildRoot:      %{_tmppath}/%{real_name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:      pcre-devel,zlib-devel,perl(ExtUtils::Embed)
Requires:           pcre,zlib
Requires:           perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
# for /usr/sbin/useradd
Requires(pre):      shadow-utils
Requires(post):     chkconfig
# for /sbin/service
Requires(preun):    chkconfig, initscripts
Requires(postun):   initscripts

Source0:    http://sysoev.ru/nginx/nginx-%{version}.tar.gz
Source1:    %{real_name}.logrotate
Source2:    virtual.conf
#Source3:    %{real_name}.init ## Its init script does not contained in this post

%description
This package is built by Admon.Org
The latest version for this is 1.0.6, which can be downloaded from http://sysoev.ru/nginx/.

%prep
%setup -q -n %{real_name}-%{version}

%build
# nginx does not utilize a standard configure script.  It has its own
# and the standard configure options cause the nginx configure script
# to error out.  This is is also the reason for the DESTDIR environment
# variable.  The configure script(s) have been patched (Patch1 and
# Patch2) in order to support installing into a build environment.
export DESTDIR=%{buildroot}
./configure \
    --user=%{nginx_user} \
    --group=%{nginx_group} \
    --prefix=%{nginx_datadir} \
    --sbin-path=%{_sbindir}/%{real_name} \
    --conf-path=%{nginx_confdir}/%{real_name}.conf \
    --error-log-path=%{nginx_logdir}/error.log \
    --http-log-path=%{nginx_logdir}/access.log \
    --pid-path=%{_localstatedir}/run/%{real_name}.pid \
    --lock-path=%{_localstatedir}/lock/subsys/%{real_name} \
    --with-http_realip_module \
    --with-http_gzip_static_module \
    --with-http_stub_status_module \
    --with-cc-opt="%{optflags} $(pcre-config --cflags)"
make %{?_smp_mflags} 

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALLDIRS=vendor
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
find %{buildroot} -type f -empty -exec rm -f {} \;
find %{buildroot} -type f -exec chmod 0644 {} \;
find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \;
chmod 0755 %{buildroot}%{_sbindir}/nginx
%{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{real_name}
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{real_name}
%{__install} -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d
%{__install} -p -m 0644 %{SOURCE3} %{buildroot}%{nginx_confdir}/conf.d
%{__install} -p -d -m 0755 %{buildroot}%{nginx_home_tmp}
%{__install} -p -d -m 0755 %{buildroot}%{nginx_logdir}

%clean
rm -rf %{buildroot}

%pre
%{_sbindir}/useradd -c "Nginx user" -s /bin/false -r -d %{nginx_home} %{nginx_user} 2&gt;/dev/null || :

%post
/sbin/chkconfig --add %{real_name}

%preun
if [ $1 = 0 ]; then
    /sbin/service %{real_name} stop &gt;/dev/null 2&gt;&amp;1
    /sbin/chkconfig --del %{real_name}
fi

%postun
if [ $1 -ge 1 ]; then
    /sbin/service %{real_name} condrestart &gt; /dev/null 2&gt;&amp;1 || :
fi

%files
%defattr(-,root,root,-)
%{nginx_datadir}/
%{_sbindir}/%{real_name}
#%{_mandir}/man3/%{real_name}.3pm.gz
%{_initrddir}/%{real_name}
%dir %{nginx_confdir}
%dir %{nginx_confdir}/conf.d
%config(noreplace) %{nginx_confdir}/conf.d/*.conf
%config(noreplace) %{nginx_confdir}/win-utf
%config(noreplace) %{nginx_confdir}/%{real_name}.conf.default
%config(noreplace) %{nginx_confdir}/mime.types.default
%config(noreplace) %{nginx_confdir}/fastcgi_params
%config(noreplace) %{nginx_confdir}/fastcgi_params.default
%config(noreplace) %{nginx_confdir}/fastcgi.conf
%config(noreplace) %{nginx_confdir}/fastcgi.conf.default
%config(noreplace) %{nginx_confdir}/koi-win
%config(noreplace) %{nginx_confdir}/koi-utf
%config(noreplace) %{nginx_confdir}/%{real_name}.conf
%config(noreplace) %{nginx_confdir}/mime.types
%config(noreplace) %{_sysconfdir}/logrotate.d/%{real_name}
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home}
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp}
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir}

%changelog
* Wed Jul 20 2011 Denis Frolov  - 1.0.5-1
- rebuild to 1.0.5

* Sat Jun 05 2011 Denis Frolov  - 1.0.4-1
- rebuild to 1.0.4

* Tue May 26 2011 Denis Frolov  - 1.0.3-1
- rebuild to 1.0.3

* Wed May 11 2011 Denis Frolov  - 1.0.2-1
- rebuild to 1.0.2

* Sun May 10 2011 Denis Frolov  - 1.0.1-1
- rebuild to 1.0.1

* Wed Dec 15 2010 Denis Frolov  - 0.8.54-1
- rebuild to 0.8.54

* Thu Nov 30 2010 Denis Frolov  - 0.8.53-1
- rebuild to 0.8.53

* Wed Jun 16 2010 Denis Frolov  - 0.7.67-1
- rebuild to 0.7.67 * Thu Jun 08 2010 Denis Frolov  - 0.7.66-1
- rebuild to 0.7.66
...</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/nginx-1-0-6-rpm-package-spec-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUM: Download a RPM package without installation</title>
		<link>http://www.admon.org/yum-download-a-rpm-package-without-installation/</link>
		<comments>http://www.admon.org/yum-download-a-rpm-package-without-installation/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 14:07:19 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[yum]]></category>
		<category><![CDATA[yum-utils]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=576</guid>
		<description><![CDATA[Yum is commonly used in major RPM based Linux distributions such as CentOS, Redhat and SuSE, it can help us perform automatic dependency checking. If you&#8217;d like to only download the RPM packages via yum and do not install/update them, it&#8217;s nearly impossible by default. How can we download a RPM package using YUM? Generally, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://planet.admon.org/wp-content/uploads/2010/04/yum.png"><img class="size-full wp-image-738 alignleft" title="yum" src="http://planet.admon.org/wp-content/uploads/2010/04/yum.png" alt="Yellowdog Updater, Modified" width="185" height="70" /></a>Yum is commonly used in major RPM based Linux distributions such as <a href="http://www.centos.org/">CentOS</a>, <a href="http://www.redhat.com/">Redhat</a> and <a href="http://www.novell.com/linux/">SuSE</a>, it can help us perform automatic dependency checking. If you&#8217;d like to only download the RPM packages via yum and do not install/update them, it&#8217;s nearly impossible by default. <span id="more-576"></span></p>
<p>How can we download a RPM package using YUM?  Generally, there are two ways, you can use either <strong>yum-downloadonly</strong> or <strong>yum-utils</strong>.  <strong>1, yum-downloadonly installation and usage example</strong> You just need to install a plugin called yum-downloadonly. This plugin supplies a new parameter called <em>&#8211;downloadonly</em> so that yum can download the package  s without an further installation/upgrade. It&#8217;s much like <a href="http://www.debian.org/doc/manuals/apt-howto/">apt-get</a>&#8216;s -d option in Ubuntu/Debian:</p>
<pre>$ yum --help| grep download
Loaded plugins: downloadonly, fastestmirror
  --downloadonly        don't update, just download
  --downloaddir=DLDIR   specifies an alternate directory to store package</pre>
<p>A further question is How can I install the download-only plugin for Yum? It&#8217;s as simple as a normal install, you just need to run:</p>
<pre>$ sudo yum install yum-downloadonly</pre>
<p>If you wanna download a package without installation, you just need to add the parameter <em>&#8211;downloadonly</em>. By default the downloaded package will be stored in /var/cache/yum,  you can specifies an alternate directory to store this file such as /opt, like this:</p>
<pre>yum update httpd -y --downloadonly --downloaddir=/opt</pre>
<p><strong>2, yum-utils.noarch installation and usage example</strong></p>
<p><a href="http://yum.baseurl.org/wiki/YumUtils">Yum-utils</a> is a collection of utilities and plugins extending and supplementing yum in different ways, and all the utilities are contained in yum-utils package, including the one that we need which is called yumdownloader.</p>
<pre># yum -y install yum-utils.noarch</pre>
<p>Now we can use the yumdownloader command to download packages from yum repositories. Here&#8217;s an example:</p>
<pre># yumdownloader httpd</pre>
<p>When you get the RPM, you can <a href="http://planet.admon.org/howto/rpm-common-usage-examples/">query further information from it</a>, or decompress it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/yum-download-a-rpm-package-without-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update CentOS 4 to CentOS 5 remotely</title>
		<link>http://www.admon.org/update-centos-4-to-centos-5-remotely/</link>
		<comments>http://www.admon.org/update-centos-4-to-centos-5-remotely/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 14:36:24 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=510</guid>
		<description><![CDATA[I just successfully updated my Dell PowerEdge 1850 from CentOS 4.8 to CentOS 5.4, luckily the issues I faced were not so rare. The steps I used are listed below, may it helpful for you as well! Although this post is mainly intended for CentOS it should work on RHEL systems as well. Before you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://planet.admon.org/wp-content/uploads/2009/12/centos5-150x150.png"><img class="alignleft size-full wp-image-749" title="centos5-150x150" src="http://planet.admon.org/wp-content/uploads/2009/12/centos5-150x150.png" alt="CentOS-5 Logo" width="150" height="150" /></a>I just successfully updated my Dell <a href="http://reviews.zdnet.co.uk/hardware/servers/0,1000001736,39193837,00.htm">PowerEdge 1850</a> from CentOS 4.8 to CentOS 5.4, luckily the issues I faced were not so rare. The steps I used are listed below, may it helpful for you as well! Although this post is mainly intended for CentOS it should work on RHEL systems as well.</p>
<p>Before you start, A word of advice i believe most experienced RHEL/CentOS users will show you regarding what you&#8217;re thinking:</p>
<p>Upgrade between minor versions (i.e. CentOS 5.2 -&gt; 5.3 -&gt; 5.4, or even 5.0 -&gt; 5.4) YES<br />
Upgrade between major system versions (i.e. CentOS 4.8 to CentOS 5.4) NO<span id="more-510"></span></p>
<p>As far as I recall, not even Red Hat recommends this &#8211; although they do guarantee the miner updates will go smoothly. Even if you manage to hammer that 4.8 to 5.4 upgrade into place, you might end up with a mess that will be very difficult to maintain. Before processing the system update, it&#8217;s suggested to create a backup!</p>
<p>If you are currently running a version of RHEL/CentOS earlier than 4.8 (<em>cat /etc/redhat-release</em>), then please do a proper &#8216;<em>yum update</em>&#8216; and get your current system updated to 4.8 before we start.</p>
<p>Then the first thing we need to do is to make sure none of our core binaries, libraries or other content is immutable as it causes package installation failures. If you use immutable bits on system paths then you should run these commands:</p>
<pre>chattr -Ria /bin
chattr -Ria /etc
chattr -Ria /etc
chattr -Ria /include
chattr -Ria /lib
chattr -Ria /sbin
chattr -Ria /usr/bin
chattr -Ria /usr/include
chattr -Ria /usr/lib
chattr -Ria /usr/libexec
chattr -Ria /usr/local/bin
chattr -Ria /usr/local/include
chattr -Ria /usr/local/lib
chattr -Ria /usr/local/sbin
chattr -Ria /usr/sbin
chattr -Ria /usr/share
chattr -Ria /var/lib
chattr -Ria /var/lock
chattr -Ria /var/log
chattr -Ria /var/run
chattr -Ria /var/spool/repackage</pre>
<p>Once finished, go ahead and have a quick run through of cleaning up yum cache, double check that any pending updates are installed and <a href="http://planet.admon.org/howto/rpm-common-usage-examples/">rebuild the rpmdb</a>:</p>
<pre>yum clean all &amp;&amp; yum update</pre>
<p>If you run into any dependency issues for packages that are not essential, such as syslinux and lftp then you can either exclude them or better just remove them. If the denpency issue is openssh-server related, you can enable telnet login during update by modifing <em>/etc/xinetd.d/telnet</em>.</p>
<pre>rpm -e lftp syslinux mkboot</pre>
<p>OR (but not recommended)</p>
<pre>yum update --exclude=syslinux --exclude=lftp --exclude=mkboot</pre>
<p>At this point you should be able to run a &#8216;<em>yum update</em>&#8216; command with optional exclude and receive no errors. Now we are ready to get going, please google around, find and download these packages, they mostly available at <a href="http://mirror.centos.org/centos/5.4/os/i386/CentOS/">CentOS official mirror site</a>:</p>
<pre># ls
centos-release-5-4.el5.centos.1.i386.rpm    python-elementtree-1.2.6-5.el4.centos.i386.rpm
centos-release-notes-5.4-4.i386.rpm       python-elementtree-1.2.6-5.el5.i386.rpm
kernel-2.6.18-164.el5.i686.rpm            python-elementtree-1.2.6-5.i386.rpm
kernel-devel-2.6.18-164.el5.i686.rpm      python-sqlite-1.1.7-1.2.1.i386.rpm</pre>
<p>We need to go ahead and setup the centos-release package as follows:</p>
<pre>rpm -Uhv centos-release-*.rpm</pre>
<p>If you see that CentOS-Base.repo was created as <em>/etc/yum.repos.d/CentOS-Base.repo.rpmnew</em> then move it to the right place:</p>
<pre># mv /etc/yum.repos.d/CentOS-Base.repo.rpmnew /etc/yum.repos.d/CentOS-Base.repo</pre>
<p>Now we are ready to go with kernel changes, this is an important part so pay attention. The key to successful upgrade is that you remove ALL OLD KERNELS as many packages will fail to install during the upgrade if they detect a release 4.x kernel due to minimum kernel version dependency checks. We will first start with installing the new CentOS 5.4 kernel so it preserves grub templating:</p>
<pre>rpm -ivh kernel-2.6.18-164.el5.i686.rpm kernel-devel-2.6.18-164.el5.i686.rpm --nodeps</pre>
<p>NOTE: release 5.x has smp support integrated into the standard kernel, so no *-smp version is required for multi-processor systems.</p>
<p>If you are running an older system the chances are you got allot of older kernel packages installed, so make sure you get them all out of the way:</p>
<pre>rpm -e $(rpm -qa | grep kernel | grep -v 2.6.18 | tr 'n' ' ') --nodeps</pre>
<p>That said and done you should now only have 2 kernel packages installed which are the 2.6.18 release 5.x kernels. DO NOT under any circumstance continue if you still got 2.6.9 release 4.x kernels packages installed, remove them ALL!</p>
<pre># rpm -qa | grep -i kernel
kernel-2.6.18-164.el5
kernel-devel-2.6.18-164.el5</pre>
<p>A cleanup of <em>/etc/grub.conf</em> may be required, though the rpm command should have done this for you already, but review it anyways for good measure. You should find that 2.6.18-164.el5 is the only kernel in the file. When kernel updated, a reboot here is OK, but it&#8217;s not suggested.</p>
<p>Then we can continute the system updates. There is a known bug with python-elementtree package versions which cause yum/rpm to think the release 4.x version is newer than the 5.x version, to get around this without blowing up the entire python installation we need to remove the package from just the rpmdb as follows:</p>
<pre>rpm -e --justdb python-elementtree --nodeps</pre>
<p>We can now go ahead and use yum to start the upgrade process, this is a dry run and will take some minutes to compile list of available packages and associated dependency checks. You should carry the exclude options, if any, that you used during the &#8216;yum update&#8217; process as so to avoid unresolvable dependencies:</p>
<pre>yum clean all
yum upgrade</pre>
<p>You will end up with a small list of dependency errors, these should be resolved by again evaluating a packages need as a critical system component and either removing it with &#8216;<em>rpm -e</em>&#8216; or excluding it with &#8216;<em>–exclude</em>&#8216; (remember to <a href="http://planet.admon.org/howto/rpm-common-usage-examples/">query description</a> if you are unsure what something does). In my case the packages that threw up red flags were stuff I had manually installed over time such as nfs in addition to default installed samba, these can all safely be removed or excluded as you prefer.</p>
<pre>    Error: Missing Dependency: perl(Convert::ASN1) is needed by package samba
    Error: Missing Dependency: libevent-1.1a.so.1 is needed bypackage nfs-utils</pre>
<p>At this point you should be ready to do a final dry run and see where we stand on dependencies, rerun the earlier &#8216;<em>yum upgrade</em>&#8216; while making sure to carry over any exclude options you are using.</p>
<p>You should now end up with a summary of actions that yum needs to perform, go ahead and kick it off&#8230; this will take a bit time to complete.</p>
<pre>    Transaction Summary
    ===========================================================
    Install 183 Package(s)
    Update 527 Package(s)
    Remove 0 Package(s)
    Total download size: 679 M
    Is this ok [y/N]:<strong>Y</strong>
</pre>
<p>Once yum has completed we need to fix a few things, the first is the rpmdb needs a rebuild due to version changes that will cause any rpm commands to fail:</p>
<pre>rm -f /var/lib/rpm/__db.00*
rpm --rebuilddb
yum clean all</pre>
<p>The next issue on the list is python-elementtree and python-sqlite, one or both of these may have <a href="http://forum.admon.org/rhel-centos/7355-yum-no-module-named-sqlite-resovled.html">ended up in a broken state</a> that will cause all yum commands to break, so we will go ahead and reinstall both of them:</p>
<pre>rpm -e --justdb python-elementtree --nodeps
rpm -ivh python-elementtree-1.2.6-5.el5.i386.rpm
rpm -ivh python-sqlite-1.1.7-1.2.1.i386.rpm --nodeps --force</pre>
<p>The yum command should now work, go ahead and run it with no options, if you do not get any errors, you are all sorted!</p>
<p>Hopefully the install went well for you, the only thing left to do is go ahead and reboot the system:</p>
<pre>shutdown -rf now</pre>
<p>For the sake of avoiding a system raised fsck, we will reboot with the -f option to skip fsck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/update-centos-4-to-centos-5-remotely/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Prepare the RPM Building Environment</title>
		<link>http://www.admon.org/prepare-rpm-building-environment/</link>
		<comments>http://www.admon.org/prepare-rpm-building-environment/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 08:19:39 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[buiding environment]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=421</guid>
		<description><![CDATA[Some days ago, I posted some examples on the common usage of RPM. Now, this post describes a manual preparation of a RPM building environment. With the help of this environment, you can generate upated RPM packages and patch your RPM-based system from source code. Before this configuration, please make sure you have these packages [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago, I posted some <a href="http://planet.admon.org/howto/rpm-common-usage-examples/">examples on the common usage of RPM</a>. Now, this post describes a manual preparation of a RPM building environment. With the help of this environment, you can generate upated RPM packages and patch your <a href="http://en.wikipedia.org/wiki/List_of_Linux_distributions#RPM-based">RPM-based system</a> from source code.<br />
<span id="more-421"></span><br />
Before this configuration, please make sure you have these packages installed already:</p>
<pre>make, GCC, rpm-build, redhat-rpm-config</pre>
<p>If they havn&#8217;t installed yet, you can start the installation by yum like this &#8220;<em>yum install make</em>&#8220;. After finished, run the &#8220;<em>rpmbuild &#8211;showrc</em>&#8221; or the more terse &#8220;<em>rpmbuild &#8211;version command</em>&#8221; to check that it&#8217;s OK. Then let&#8217;s start the configuration.</p>
<p>As an unprivileged user create the following directories:</p>
<pre>mkdir ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}</pre>
<p>These directories are the exact working place, which are actually alternative ones that are different from system default path <em>/usr/src/redhat</em>.</p>
<p>Then, create a new file ~/.rpmmacros and put the following basic macros in it:</p>
<pre>%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3
%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot</pre>
<p>All macros that are set in ~/.rpmmacros override the system-wide macros that have been set in other locations. The meaning of these directives are listed below:<br />
<strong>%_topdir</strong> macro is the path of the root directory of your RPM building environment, ~/rpmbuild in this case.</p>
<p><strong>%_smp_mflags</strong> macro usually contains only the -j  (–jobs) option for the make command, which defines the number of jobs (make commands) that may run simultaneously. Usually, this is set to the number of CPU cores plus one. So, on a dual core CPU, this flags are set to -j3.</p>
<p><strong>%__arch_install_post</strong> macro contains various checks that should be run on the files in the BUILDROOT location. I trust Fedora guys and use the defaults check-rpaths and check-buildroot on Fedora and CentOS. This macro is optional.</p>
<p>To check which paths are checked for macro files, enter the following command:</p>
<pre>rpm --showrc | grep macrofiles</pre>
<p>For the whole current configuration for RPM building, run &#8220;<em>rpm &#8211;showrc</em>&#8220;. All the available macros can be found in <em>/usr/lib/rpm/macros</em>. From that point you&#8217;re ready to go. Simply install the src.rpm as normal and the files will be unpacked in your new build tree.</p>
<p>It&#8217;s very helpful for you to keep your RHEL installations up-to-date without paying to Redhat, as <a href="https://rhn.redhat.com/errata">RHSA</a> releases all updated source code in SRPM package.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/prepare-rpm-building-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to skip broken dependencies when Upgrading System</title>
		<link>http://www.admon.org/how-to-skip-broken-dependencies-when-upgrading-system/</link>
		<comments>http://www.admon.org/how-to-skip-broken-dependencies-when-upgrading-system/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 10:39:53 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://blog.admon.org/?p=143</guid>
		<description><![CDATA[I made a mistake and added additional repo under CentOS / RHEL 5.x server. Now when I try to upgrade packages it gives me out broken ependencies / missing dependency error. How do I skip broken packages and apply updates to other installed software&#8217;s? Packages with broken dependencies is really bad. Yum generally take care [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>I made a mistake and added additional repo under <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.redhat.com">RHEL 5.x</a> server. Now when I try to upgrade packages it gives me out broken ependencies / missing dependency error. How do I <strong>skip broken packages</strong> and apply updates to other installed software&#8217;s?<span id="more-143"></span></p>
<p>Packages with broken dependencies is really bad. Yum generally take care of such business, but when you mix additional repos it may give out &#8216;Missing Dependency&#8217; error under <strong>RHEL</strong> / <strong>CentOS Linux</strong> 5.x systems.</p>
<p>You need to add plugin called <strong>yum-skip-broken</strong> which adds a new parameter -<strong>-skip-broken</strong> to yum to make it possible to check packages for dependency problems and skip the one with problems.</p>
<p>Install yum-skip-broken</p>
<p>Type the following command as root user:</p>
<pre># yum -y install yum-skip-broken</pre>
<p>Sample output:</p>
<pre>Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* updates: mirror.steadfast.net
* addons: centos-distro.cavecreek.net
* extras: mirrors.liquidweb.com
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package yum-skip-broken.noarch 0:1.1.10-9.el5.centos set to be updated
--&gt; Finished Dependency Resolution
Dependencies Resolved
=======================================================
Package                 Arch       Version          Repository        Size
=======================================================
Installing:
yum-skip-broken         noarch     1.1.10-9.el5.centos  base               11 k
Transaction Summary
======================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 11 k
Downloading Packages:
(1/1): yum-skip-broken-1. 100% |=========================|  11 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: yum-skip-broken              ######################### [1/1]
Installed: yum-skip-broken.noarch 0:1.1.10-9.el5.centos
Complete!</pre>
<p>How to handle skiping packages with dependency problems<br />
Now type the command as follows:</p>
<pre># yum -y upgrade --skip-broken</pre>
<p>OR</p>
<pre># yum -y update --skip-broken</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/how-to-skip-broken-dependencies-when-upgrading-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RPM Common Usage Examples</title>
		<link>http://www.admon.org/rpm-common-usage-examples/</link>
		<comments>http://www.admon.org/rpm-common-usage-examples/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 06:12:07 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=198</guid>
		<description><![CDATA[The Red Hat Package Manager (RPM) has establised itself as one of the most popular distrubution formats for linux software today. A first time user may feel overwhelmed by a vast number of options available and this article will help a newhand to get familiar with RPM. The traditional way to install a package was [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.rpm.org">Red Hat Package Manager</a> (RPM) has establised itself as one of the most popular distrubution formats for linux software today. A first time user may feel overwhelmed by a vast number of options available and this article will help a newhand to get familiar with RPM.</p>
<p>The traditional way to install a package was to retrival an archive and then extract its files into the system wide directories. This worked fine but system administrator may face lots of problems like how to update the packages without breaking former settings, how to uninstall the files smoothly and completely, and how to deal with the dependency issues, etc.<span id="more-198"></span></p>
<p><a href="http://www.rpm.org">RPM</a> is a useful tool for both managing your system and diagnosing and fixing these problems. The best way to learn this package management system is to look at some examples. It&#8217;s highly suggested to have a try with your own system.</p>
<ul>
<li><strong>Install and deinstall a package</strong></li>
</ul>
<p>For installation, &#8220;<em>rpm -ivh package.rpm</em>&#8221; is widely used, for details please check the output of &#8220;<em>man rpm</em>&#8221; or &#8220;<em>rpm &#8211;help</em>&#8221; for details. For deinstallation, &#8220;rpm -e package&#8221; works well. Keep note that the package&#8217;s name is changed here, the suffix is not needed.<br />
Also you can install a file from the network, both http and ftp are supported. enter:</p>
<pre> rpm -ivh ftp://joseph@ftp.admon.org/rpm/sysstat-9.0.4-1.i586.rpm</pre>
<p>You will be prompted for the password after which the file will be downloaded and installed.</p>
<ul>
<li><strong>Verify the entire system</strong></li>
</ul>
<p>Perhaps you have deleted some files by accident, but you are not sure what you deleted. To verify your entire system and see what might be missing, you could try the following command:  <em>rpm -Va</em></p>
<p>If some files are missing or appear to have been corrupted, you should probably either re-install the package or uninstall and then re-install the package.</p>
<ul>
<li><strong>verify a file to find out which package owns it</strong></li>
</ul>
<p>enter: 
<pre>rpm -qf /usr/bin/ssh</pre>
<p>The output would look like the following:</p>
<pre>openssh-clients-5.0p1-1</pre>
<ul>
<li><strong> Verify the package which owns the program</strong></li>
</ul>
<p>We can combine the above two examples, and verify the package that owns that program, but you do not know which package owns it. Enter the following command:</p>
<pre>rpm -Vf /usr/bin/ssh</pre>
<p>and now the appropriate package is verified. If nothing outputs, the package is good state.</p>
<ul>
<li><strong> Find out more information about a specified program</strong></li>
</ul>
<p>If you wanna find out more information about a specified program, try the following command to locate the documentation which came with the package:</p>
<pre>rpm -qdf /usr/bin/ssh</pre>
<p>The output would be similar to the following:</p>
<pre>/usr/share/man/man1/sftp.1.gz
/usr/share/man/man1/slogin.1.gz
...</pre>
<ul>
<li><strong>Listing Installed Packages</strong></li>
</ul>
<p>To list all the packages installed via RPM mechanisms, enter:</p>
<pre>rpm -qa</pre>
<p>This command prints out the installed package names stored in the RPM database, hence you either have to have the default database location specified in the $HOME/.rpmmacros file, or to append &#8211;dbpath $HOME/myrpmdb (or whatever is your private database location) to the directive.</p>
<ul>
<li><strong>Query information about a specified RPM</strong></li>
</ul>
<p>You may find a new RPM, but you do not know what it does. To find information about it, use the following command:</p>
<pre>rpm -qpi sysstat-9.0.4-1.i586.rpm</pre>
<p>The output would be similar to the following:</p>
<pre>Name  : sysstat    Relocations: (not relocateable)
Version     : 9.0.4     Vendor: (none)
Release     : 1     Build Date: Sat Jul 18 21:51:44 2009
Install Date: (not installed)   Build Host: localhost
Group : Applications/System     Source RPM: sysstat-9.0.4-1.src.rpm
Size  : 665516   License: GPL
Signature   : (none)
Packager    : Damien Faure &lt;damien-jn.faure@bull.net&gt;
URL   : http://pagesperso-orange.fr/sebastien.godard/
Summary     : SAR, SADF, MPSTAT, IOSTAT and PIDSTAT for Linux
Description :
The sysstat package contains the sar, sadf, mpstat, iostat, pidstat
and sa tools for Linux.
The sar command collects and reports system activity information.
The information collected by sar can be saved in a file in a binary
format for future inspection. The statistics reported by sar concern
I/O transfer rates, paging activity, process-related activities,
interrupts, network activity, memory and swap space utilization, CPU
utilization, kernel activities and TTY statistics, among others. Both
UP and SMP machines are fully supported.
The sadf command may  be used to display data collected by sar in
various formats (CSV, XML, etc.).
The iostat command reports CPU utilization and I/O statistics for disks.
The mpstat command reports global and per-processor statistics.
The pidstat command reports statistics for Linux tasks (processes).</pre>
<ul>
<li> Perhaps you now want to see <strong>what files the specified RPM installs</strong>.</li>
</ul>
<p>You would enter the following:</p>
<pre>rpm -qpl sysstat-9.0.4-1.i586.rpm</pre>
<p>The output is similar to the following:</p>
<pre>/etc/cron.d/sysstat
/etc/sysconfig/sysstat
/etc/sysconfig/sysstat.ioconf
/usr/bin/iostat
/usr/bin/mpstat
....</pre>
<ul>
<li><strong>Simple Unpacking of an RPM Archive</strong></li>
</ul>
<p>In many cases you would only need to extract files from an RPM archive, without performing complex operations with an RPM database. There is a simple way to do it:</p>
<pre>
rpm2cpio sysstat-9.0.4-1.i586.rpm | cpio -i -d -m</pre>
<p>This method makes use of the generic GNU CPIO utility, which deals with copying files to and from archives. The rpm2cpio command converts from RPM to CPIO format, and the output of this conversion is redirected to the cpio command.</p>
<ul>
<li><strong>Creating a Private RPM Database</strong></li>
</ul>
<p>To achieve a higher flexibility and to get access to more RPM functionality, you may want to make a step forward and create your own RPM database. You only have to do it once, by issuing the following instructions:</p>
<pre>mkdir $HOME/myrpmdb
rpmdb --initdb --dbpath $HOME/myrpmdb</pre>
<p>or, for older versions of RPM:</p>
<pre>mkdir $HOME/myrpmdb
rpm --initdb --dbpath $HOME/myrpmdb</pre>
<p>Mentioned in this example directory $HOME/myrpmdb can of course be substituted with any other location which suits you best. The only requirement is that you must have write permissions in this location.</p>
<p>Having such a personal RPM database allows you to perform more complex operations with RPM packages, without resorting to simple unpacking and manual installation. To simplify your life even further, do the following:</p>
<pre>echo '%_dbpath /home/joseph/myrpmdb' | cat &gt;&gt; $HOME/.rpmmacros</pre>
<p>This will create a file .rpmmacros in your $HOME directory, and add there the line specifying the database location. In this example, /home/yourname/myrpmdb should be substituted with your RPM database path. This will instruct RPM to use always your personal database.</p>
<p>It may be useful to copy the system-wide database into your own one. RPM does not provide any tool for database synchronization, and you have to do it in a very normal way:</p>
<pre>cp -prf /var/lib/rpm/* $HOME/myrpmdb/</pre>
<ul>
<li><strong>Relocating RPM Packages</strong></li>
</ul>
<p>An RPM package may contain information on relocatable directories. Such directories are listed as Relocations, meaning that their contents can be relocated during the installation in another directory. To perform such an installation, do the following:</p>
<pre>rpm -ivh package.rpm --relocate /oldlocation=/newlocation</pre>
<p>Here /oldlocation is one of the relocatable directories of the package, and /newlocation is your preferred destination, specified as an absolute path starting with &#8220;/&#8221;.</p>
<p>As of RPM version 4.0.4, multiple relocations are possible. To use this option, specify several relocation pairs on the command line like this &#8220;<em>&#8211;relocate /old=/new &#8211;relocate /old/subdir=/new/subdir</em>&#8221;</p>
<p>Order of such pairs in the line is important, as RPM will attempt to create new directories and can not skip a level. If the package information contains several relocations, you must specify a &#8211;relocate pair for all of them. As in the case of installation, you either have to have the default database location specified in the $HOME/.rpmmacros file, or to append &#8220;<em>&#8211;dbpath $HOME/myrpmdb&#8221;</em> to the directive.</p>
<p>These are just a few examples. As you use RPM, you may find more uses for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/rpm-common-usage-examples/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

