This is an old revision of the document!
Packages sources : http://www.perzl.org/aix/
Install / Update an RPM package (option i instead U for install only, it's better to use U in any case):
# rpm -Uhv httpd-2.2.15-1.aix5.1.ppc.rpm
force options: - -nodeps (ignore dependency) , - -ignoreos (to install a package build with an earlier version of AIX)
Downgrade a package
# rpm -Uvh --oldpackage [downloaded_lower_version_package]
List rpm packages installed:
# rpm -qa
List files into an RPM package installed:
# rpm -qlv zabbix-agent -rwxr-xr-x 1 root system 1457 Oct 19 15:44 /etc/rc.d/init.d/zabbix-agent lrwxrwxrwx 1 root system 22 Oct 19 15:44 /etc/rc.d/rc2.d/Kzabbix-agent -> ../init.d/zabbix-agent lrwxrwxrwx 1 root system 22 Oct 19 15:44 /etc/rc.d/rc2.d/Szabbix-agent -> ../init.d/zabbix-agent -rw-r--r-- 1 root system 15575 Oct 19 15:44 /etc/zabbix/zabbix_agentd.conf drwxr-xr-x 2 root system 0 Oct 19 15:44 /etc/zabbix/zabbix_agentd.d -rwxr-xr-x 1 root system 6341227 Oct 19 15:44 /opt/freeware/bin/zabbix_get -rwxr-xr-x 1 root system 7522635 Oct 19 15:44 /opt/freeware/bin/zabbix_sender -rw-r--r-- 1 root system 4901 Oct 19 15:44 /opt/freeware/man/man1/zabbix_get.1 -rw-r--r-- 1 root system 14962 Oct 19 15:44 /opt/freeware/man/man1/zabbix_sender.1 -rw-r--r-- 1 root system 3899 Oct 19 15:44 /opt/freeware/man/man8/zabbix_agentd.8 -rwxr-xr-x 1 root system 9719766 Oct 19 15:44 /opt/freeware/sbin/zabbix_agentd lrwxrwxrwx 1 root system 33 Oct 19 15:44 /usr/bin/zabbix_get -> ../../opt/freeware/bin/zabbix_get lrwxrwxrwx 1 root system 36 Oct 19 15:44 /usr/bin/zabbix_sender -> ../../opt/freeware/bin/zabbix_sender lrwxrwxrwx 1 root system 37 Oct 19 15:44 /usr/sbin/zabbix_agentd -> ../../opt/freeware/sbin/zabbix_agentd drwxr-xr-x 2 zabbix zabbix 0 Oct 19 15:44 /var/log/zabbix drwxr-xr-x 2 zabbix zabbix 0 Oct 19 15:44 /var/run/zabbix
List package from which the file depend:
# rpm -qf /usr/bin/mysql mysql-3.23.52-3
Uninstall an rpm package:
# rpm -e zip-3.0-1
To extract RPM files from a package ⇒ use CPIO from freeware
[root@aix01]/export/softs/zabbix/zabbix_agent_5.0.17-1# rpm2cpio zabbix-agent-5.0.17-1.aix7.2.ppc.rpm | /opt/freeware/bin/cpio -idmv ./etc/rc.d/init.d/zabbix-agent ./etc/rc.d/rc2.d/Kzabbix-agent ./etc/rc.d/rc2.d/Szabbix-agent ./etc/zabbix/zabbix_agentd.conf ./etc/zabbix/zabbix_agentd.d ...
List files into RPM package:
# rpm -qpl freetype2-2.3.11-1.aix5.1.ppc.rpm /opt/freeware/doc/freetype2-2.3.11 /opt/freeware/doc/freetype2-2.3.11/ChangeLog /opt/freeware/doc/freetype2-2.3.11/README /opt/freeware/lib/libfreetype.a /usr/lib/libfreetype.a
List RPM package description:
# rpm -qpi rpm2/freetype2-2.3.11-1.aix5.1.ppc.rpm Name : freetype2 Relocations: (not relocateable) Version : 2.3.11 Vendor: (none) Release : 1 Build Date: Tue Nov 17 11:26:18 GMT+01:00 2009 Install date: (not installed) Build Host: aix51.perzl.org Group : System Environment/Libraries Source RPM: freetype2-2.3.11-1.src.rpm Size : 1945384 License: BSD/GPL dual license URL : http://www.freetype.org Summary : A free and portable font rendering engine Description : The FreeType engine is a free and portable font rendering engine, developed to provide advanced font support for a variety of platforms and environments. FreeType is a library which can open and manages font files as well as efficiently load, hint and render individual glyphs. FreeType is not a font server or a complete text-rendering library. The library is available as 32-bit and 64-bit.
List requirements to install an RPM package:
# rpm --requires -qp freetype2-2.3.11-1.aix5.1.ppc.rpm zlib libc.a(shr.o) libz.a(libz.so.1)
Print the scripts (postinstall, preinstall, unistall) contained into an RPM package:
# rpm --scripts -qp httpd-2.2.15-1.aix5.1.ppc.rpm preinstall script (through /bin/sh): # add the "apache" group /usr/bin/mkgroup -A id=64500 apache 2> /dev/null || : # add the "apache" user /usr/bin/mkuser id=64500 pgrp='apache' gecos='Apache User' \ login='false' rlogin='false' apache 2> /dev/null || : preuninstall script (through /bin/sh): if [ $1 = 0 ]; then /etc/rc.d/init.d/httpd stop > /dev/null 2>&1 fi # remove "apache" user and group /usr/sbin/rmuser -p apache || : /usr/sbin/rmgroup apache || :
Se mettre sur 1 machine AIX5.2 (car les .rpm ont une compatibilité ascendante) Créer un fichier .spec dans /opt/freeware/src/packages/SPECS Ex : logrorate-3.5.9.spec Summary : A utility for rotate log following different parmeters. Name : logrotate Version : 3.5.9 Release : 1 Copyright : Copyright (C) 1995-2001 Red Hat, Inc. Group : ? Source RPM : http://iain.cx/src/logrotate/logrotate AutoReqProv : no BuildRoot : /usr/src/packages/BUILD %description This may be freely redistributed under the terms of the GNU Public License Usage: logrotate [-m command] [-s statefile] [--usage] [OPTION...] <configfile> /etc/logrotate.conf %files /usr/bin/logrotate /opt/freeware/bin/logrotate /opt/freeware/man/man8/logrotate.8 /etc/logrotate.conf Puis copier les fichiers dans /opt/freeware/src/packages/BUILD, avec l’arborescence necessaire : usr opt etc … Les binaires doivent être compilés pour AIX. Sinon on peut utiliser la commande rpm-built qui compile et créé le package rpm. lancer rpm –bb /opt/freeware/src/packages/SPECS/logrorate-3.5.9.spec Un fichier /opt/freeware/src/packages/RPMS/ppc/logrotate-3.5.9-1.aix5.1.ppc.rpm est alors créé, et installable Vérification : rpm –qlpv /opt/freeware/src/packages/RPMS/ppc/logrotate-3.5.9-1.aix5.1.ppc.rpm rpm –qpi /opt/freeware/src/packages/RPMS/ppc/logrotate-3.5.9-1.aix5.1.ppc.rpm rpm --scripts –qp /opt/freeware/src/packages/RPMS/ppc/logrotate-3.5.9-1.aix5.1.ppc.rpm ATTENTION : On ne peut installer des rpm que de version d’AIX >= à celle de l’OS de compilation
Script to sort rpm package to find the latest version in a directory using ls -1v human sort (include in the coreutils package)
root@devsrv - /mnt/rpm # for i in $(rpm -qa | grep -v AIX-rpm | rev | cut -d'-' -f3- | rev | tac) do pkg=$(/opt/freeware/bin/ls -1v $i-[0-9]* | grep -v src | tail -1) rpm -Uhv $pkg done
Find the latest rpm (version) package available in a folder:
root@devsrv - /mnt/rpm # for rpm in $(ls | grep rpm | sed 's/\-[0-9]/\ /g' | awk '{print $1}' | sort -u) do echo $rpm latest="" latest=$(ls ${rpm}-[0-9]* | sed -e 's/\-/\ ;\ /g' -e 's/\./\ /g' | sort -n -k3 -k4 -k5 -k7 -k8 -k9 | tail -1 | sed -e 's/\ ;\ /\-/g' -e 's/\ /\./g') mv $latest latest done
After upgrading the rpm package db4, RPMDB is corrupt
root@devsrv - /mnt/rpm # rpm -Uhv db4-4.8.30-1.rpm Updating / installing... 1:db4-4.8.30-1 ################################# [ 50%] Cleaning up / removing... 2:db4-4.7.25-2 ################################# [100%]
root@devsrv - /mnt/rpm # rpm -qa error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch error: cannot open Packages index using db4 - (-30971) error: cannot open Packages database in /opt/freeware/packages
[root@aixnim] /root> lslpp -Lc | grep open error: incorrect format: unknown tag
Uninstall openssl AIX package and reinstall:
make a backup of /etc/ssh (new keys will be generated!)
cd /etc; tar cvf ssh.tar ssh Uninstall (will also uninstall openssh and sysmgt.cim) installp -ug openssl.base openssl.license openssl.man.en_US
Reinstall openssh and openssl (sysmgt.cim not necessary) restore the ssh keys cd /etc; tar xvf ssh.tar
Just remove the DB files into /var/lib/rpm
root@devsrv - /root # cd /var/lib/rpm root@devsrv - /var/lib/rpm # mkdir old_db_rpm_2017 root@devsrv - /var/lib/rpm # mv __db.001 __db.002 __db.003 __db.004 old_db_rpm_2017 root@devsrv - /var/lib/rpm # rpm -qa expect-5.42.1-3.ppc freetype2-2.5.5-1.ppc AIX-rpm-7.2.2.0-7.ppc db4-4.8.30-1.ppc ...
If the database is not refreshed, the use the command
rpm --rebuilddb
Change folder : /export/packages/RPMS/noarch
> rpm -Uhv bash-4.4-4.aix5.1.ppc.rpm > rpm -Uhv info-6.4-1.aix5.1.ppc.rpm gettext-0.10.40-8.aix5.2.ppc.rpm libiconv-1.15-1.aix5.1.ppc.rpm Preparing... ################################# [100%] Updating / installing... 1:gettext-0.10.40-8 ################################# [ 33%] 2:libiconv-1.15-1 ################################# [ 67%] 3:info-6.4-1 ################################# [100%] Please check that /etc/info-dir does exist. You might have to rename it from /etc/info-dir.rpmsave to /etc/info-dir. exec(): 0509-036 Cannot load program /usr/opt/freeware/bin/rpm because of the following errors: 0509-150 Dependent module /opt/freeware/lib/libintl.a(libintl.so.8) could not be loaded. 0509-152 Member libintl.so.8 is not found in archive rpm_share: 0645-007 ATTENTION: get_rpm_inst_root_list() returned an unexpected result. rpm_share: 0645-007 ATTENTION: update_inst_root() returned an unexpected result.
Problem with RPM Databse
root@nimprod /var/lib/rpm> rm /var/lib/rpm/__db.00*
You need to force the reinstallation of package rpm.rte
root@nimprod /export/lpp/aix7200/aix7200-01-02-lpp> installp -F -acYN -d ./ rpm.rte
The “simple” way is to just dump everything in a directory and run:
# rm $(repomanage --keep=2 --old /path/to/repo) # createrepo /path/to/repo
Install the right level of popt (as this include into rpm.rte is too old)
/aixtoolbox/RPMS> rpm -Uhv ppc/popt-1.16-3.aix6.1.ppc.rpm
root@nimprod /root> yum search logrotate Symbol resolution failed for /usr/opt/rpm/lib/librpm.so because: Symbol poptSaveInt (number 266) is not exported from dependent module /usr/lib/libpopt.so.
Please update git to 2.20.2-1 to resolve this issue. To avoid these kind of issues. we have recently taken the approach of hardcoding the library path of libiconv in the loader section of the applications which depends on libiconv library. So LIBPATH won't have any effect on the library search path of libiconv.
root@aix01 # dump -X64 -Hov /opt/freeware/bin/git ***Import File Strings*** INDEX PATH BASE MEMBER 0 /opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib 1 libc.a shr_64.o 2 libpthreads.a shr_xpg5_64.o 3 libintl.a libintl.so.8 4 /opt/freeware/lib libiconv.a libiconv.so.2 5 libz.a libz.so.1