Install and configure GIT repositories on AIX systems using yum

Assuming you have configured YUM on AIX systems as posted here http://wp.me/p5bweg-7f. Let’s install GIT packages from IBM’s repositories.

  • Install GIT packages using yum.
[root@aix:] yum search git
========================================================================================= N/S Matched: git ==========================================================================================
git.ppc : Core git tools
git-arch.ppc : Git tools for importing Arch repositories
git-cvs.ppc : Git tools for importing CVS repositories
git-daemon.ppc : Git protocol d▒mon
git-email.ppc : Git tools for sending email
git-gui.ppc : Git GUI tool
git-svn.ppc : Git tools for importing Subversion repositories
gitk.ppc : Git revision tree visualiser
gitweb.ppc : Simple web interface to git repositories
perl-Git.ppc : Perl interface to Git

  Name and summary matches only, use "search all" for everything.

In this case, we’re going to install “git.ppc : Core git tools” package.

[root@aix:] yum install git

Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.ppc 0:2.8.1-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                     Arch                                        Version                                           Repository                                           Size
=====================================================================================================================================================================================================
Installing:
 git                                         ppc                                         2.8.1-1                                           AIX_Toolbox                                          10 M

Transaction Summary
=====================================================================================================================================================================================================
Install       1 Package

Total size: 10 M
Installed size: 396 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : git-2.8.1-1.ppc                                                                                                                                                                   1/1

Installed:
  git.ppc 0:2.8.1-1

Complete!
  • Verifyng GIT binaries.
[root@aix:] rpm -qa|grep git
git-2.8.1-1.ppc
[[root@aix:]yum list git installed
Installed Packages
git.ppc                    2.8.1-1                          @AIX_Toolbox
[root@aix:]
[root@aix:/] rpm -ql git-2.8.1-1.ppc
/opt/freeware/bin/git
/opt/freeware/bin/git-receive-pack
/opt/freeware/bin/git-shell
/opt/freeware/bin/git-upload-archive
/opt/freeware/bin/git-upload-pack
/opt/freeware/doc/git-2.8.1
...
...
...
  • Create a new GIT repository.

NOTES: All repositories will be created under /var/www/git directory owned by apache     user/group.

[root@aix: ]  cd /var/www/git

[root@aix: /var/www/git]  mkdir /gitrepo

[root@aix: /var/www/git] cd /gitrepo/

[root@aix: /var/www/git/gitrepo] git --bare init
Initialized empty Git repository in /gitrepo/

[root@aix: /var/www/git/gitrepo] git update-server-info

[root@aix: /var/www/git/gitrepo] chown -R apache:apache .

[root@aix: /var/www/git/gitrepo] ls -ltra
total 48
drwxr-xr-x   69 root     system         8192 Feb 15 09:20 ..
drwxr-xr-x    2 apache   apache          256 Feb 15 09:20 branches
drwxr-xr-x    4 apache   apache          256 Feb 15 09:20 refs
-rw-r--r--    1 apache   apache           73 Feb 15 09:20 description
drwxr-xr-x    2 apache   apache         4096 Feb 15 09:20 hooks
-rw-r--r--    1 apache   apache           23 Feb 15 09:20 HEAD
-rw-r--r--    1 apache   apache           66 Feb 15 09:20 config
drwxr-xr-x    7 apache   apache          256 Feb 15 09:20 .
drwxr-xr-x    4 apache   apache          256 Feb 15 09:20 objects
drwxr-xr-x    2 apache   apache          256 Feb 15 09:20 info
  • Cofngure Apache HTTPD server as frontend. Please go to post http://wp.me/p5bweg-bR

 

Posted in AIX, GIT, yum | Tagged , , , | Leave a comment

Setup GIT repositories over HTTPD with LDAP and Local authentication on AIX systems.

What are we going to do?

  •  Setup Apache server as frontend for Git repositories.
  •  Use CGI program git-http-backend (https://schacon.github.io/git/git-http-backend.html), instead Dav, to serve the contents of a Git repository to Git clients accessing the repository over http:// protocol.
  • Authenticate users to GIT repositories in this order, first local users and then Ldap to Active directory.

Let’s see useful information of our system:
– Apache server version installed on AIX system is 2.2.17.

[root@aix:] rpm -qa|grep httpd
httpd-2.2.17-3.ppc

– HTTPD server is listening by default on port 80/TCP to serve other applications.

# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to
#Listen 12.34.56.78:80
Listen 80

– Server hostname is aixrepository.domain.net.

[root@aix:/aix] hostname
aixrepository.domain.net
  • Enable  Apache’s Virtual Host on port 81/TCP.

It’s recommended to use Apache’s Virtual Host to serve GIT repositories on a different port of 80/TCP. In this example port will be 81/TCP.

  • Edit /opt/freeware/etc/httpd/conf/httpd.conf and uncomment this line:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
  • Add this line ‘Listen 81’ to ‘Listen‘ directive:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to
#Listen 12.34.56.78:80
Listen 80
Listen 81
  • Setup git-http-backend CGI program.

What’s  git-http-backend? It’s  a simple CGI program to serve the contents of a Git repository to Git clients accessing the repository over http:// and https:// protocols)

We’re going to copy CGI binary file to /CGIBIN directory. Change permissions to /CGIBIN to be used by HTTPD daemon.

[root@aix:] mkdir /CGIBIN
[root@aix:] cp /opt/freeware/libexec/git-core/git-http-backend /CGIBIN/
[root@aix:] chmod -R 755 /CGIBIN/
[root@aix:] chown -R apache:apache /CGIBIN/
[root@aix:] ls -ltr /CGIBIN/
total 1832
-rwxr-xr-x    1 apache   apache       935551 Feb 13 09:07 git-http-backend
  • Configure Apache’s Virtual Host.

Edit /apache/extra/httpd-vhosts.conf and add this code.

root@aix: /apache/extra # vi /apache/extra/httpd-vhosts.conf
root@aix: /apache/extra # cat /apache/extra/httpd-vhosts.conf
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:81

<VirtualHost *:81>
ServerAdmin root@localhost
ServerName aixrepository.domain.net

DocumentRoot /var/www/git
LogLevel warn
DavLockDB "/tmp/DavLock"

SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL

ScriptAlias /git /CGIBIN/git-http-backend

<Directory "/var/www/git">
 Allow from All
 Options +ExecCGI
 AllowOverride All
</Directory>

<Directory "/CGIBIN">
 AllowOverride None
 Options None
 Allow from all
</Directory>
# GIT repository /gitrepo
<Location /gitrepo>
      AuthType Basic
      AuthBasicProvider file ldap
      AuthUserFile "/opt/freeware/etc/httpd/conf/local_passwords"
      AuthzLDAPAuthoritative off
      AuthLDAPBindDN "ldapbindusero@domain.net"
      AuthLDAPBindPassword "ldapbindpassword"
      AuthLDAPURL "ldap://domain.net:3268/?sAMAccountName?sub?"
      Require ldap-user userldap1
      Require ldap-user userldap2
      AuthName "GIT -- AIXREPOSITORY"
      require valid-user
      Allow from all
</Location>
</VirtualHost>

  • Restart Apache server.
[root@aix:] apachectl -t
Syntax OK
[root@aix:] apachectl -k graceful
  • Finally, from GIT client run ‘git clone’ command.
$ git clone http://aixrepository.domain.net:81/git/gitrepo
Cloning into 'gitrepo'...
Username for 'http://aixrepository.domain.net:81': userldap1
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.

userldap1@W078C752 MINGW64 /u/git/
$ cd gitrepo/

userldap1@W078C752 MINGW64 /u/git/gitrepo  (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

userldap1@W078C752 MINGW64 /u/git/gitrepo (master)

That’s it!!

Posted in AIX, apache, GIT, ldap | Tagged , , , , , | Leave a comment

Create memory resident filesystems (RAM disk) on AIX.

AIX supports memory-resident file systems. It can be used to maximize disk performance. It’s equivalent to Solaris tmpfs filesystem.
NOTE: RAM disk doesn’t survive a reboot.

Steps to create a RAM disk on AIX:

  • Get size of real (online) memory.
  • Create the RAM disk
  • Create the file system
  • Mount the file system.

 

  • Get size of real (online) memory.
[root@aix:/] lparstat -i|grep Memory|egrep 'Minimum|Online|Maximum'
Online Memory                              : 16384 MB
Maximum Memory                             : 24576 MB
Minimum Memory                             : 256 MB

Or,

[root@aix:/] bootinfo -r
16777216
  • Create the RAM disk.
[root@aix:/] mkramdisk 1024M
/dev/rramdisk0

NOTE: By default, RAM disk pages are pinned. if you want to create RAM disk pages that are not pinned use ‘-u’ flag.

  •   Create the file system.
[root@aix:/] mkfs -V jfs2 /dev/ramdisk0
 mkfs: destroy /dev/ramdisk0 (yes)? y
   File system created successfully.
   16176 kilobytes total disk space.
   Device /dev/ramdisk0:
   Standard empty filesystem
   Size:           2096680 512-byte (DEVBLKSIZE) blocks
  • Mount the file system.
[root@aix:/] mkdir /ramdiskfs
[root@aix:/] mount -V jfs2 -o log=NULL /dev/ramdisk0 /ramdiskfs
[root@aix:/] mount
  node       mounted        mounted over    vfs       date        options
-------- ---------------  ---------------  ------ ------------ ---------------
         /dev/hd4         /                jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/hd2         /usr             jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/hd9var      /var             jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/hd3         /tmp             jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/hd1         /home            jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/hd11admin   /admin           jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /proc            /proc            procfs Dec 07 09:33 rw
         /dev/hd10opt     /opt             jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/livedump    /var/adm/ras/livedump jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/syslog_lv   /var/syslog      jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/cores_lv    /CORES           jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/fslv00      /REPOS/SVN1SYNC  jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/db2inslv01  /db2inst1        jfs2   Dec 07 09:33 rw,log=/dev/loglv00
         /dev/adm_lv      /tsmadm          jfs2   Dec 07 09:33 rw,log=/dev/loglv00
         /dev/reportinlv  /reporting       jfs2   Dec 07 09:33 rw,log=/dev/loglv00
         /dev/fslv02      /powervp         jfs2   Dec 07 09:33 rw,log=/dev/hd8
         /dev/fslv03      /db2flash        jfs2   Dec 07 09:33 rw,log=/dev/loglv01
         /dev/ramdisk0    /ramdiskfs       jfs2   Feb 08 10:26 rw,log=NULL
[root@aix:/] df -m /ramdiskfs
Filesystem    MB blocks      Free %Used    Iused %Iused Mounted on
/dev/ramdisk0   1024.00   1023.52    1%        4     1% /ramdiskfs
  • To umount, delete RAM disk follow these steps
[root@aix:/] umount /ramdiskfs/
[root@aix:/] rmramdisk rramdisk0

That’s it!

Posted in AIX | Tagged , | Leave a comment

Calculate hdisk READ / WRITE throughput (sequential IO) from AIX systems.

Do you know the throughput of your disks? This time we’re going to calculate read / write throughput of hdisks from an AIX system.

  • Let’s create a file for this test.
[root@aix:/] lptest 127 32 > /tmp/file
[root@aix:/] ls -ltr /tmp/file
-rw-r-----    1 root     system         4096 Feb 07 16:22 /tmp/file
  • Let’s make a sequential WRITE test.
[root@aix:/]  timex dd if=/dev/zero of=/tmp/file  bs=1m count=1000
1000+0 records in.
1000+0 records out.

real 2.96
user 0.00
sys  1.67
  • Now divide 2014 / “real” number to get MB/s throughput.
    In this example:
1024 MB / 2.96 s = 345 MB/s

WRITE throghput is 345 MB/s

  • Let’s make a sequential READ test.
[root@aix:/] timex dd if=/dev/rhdisk3 of=/dev/null bs=1m count=1024
2048+0 records in.
2048+0 records out.

real 4.83
user 0.00
sys  0.32
  • Now divide 2014 / “real” number to get MB/s throughput.
    In this example:
1024 MB / 4.83 s = 212 MB/s

READ throghput is 345 MB/s

 

Posted in AIX | Tagged , , , | Leave a comment

Working with Virtual media library on VIO servers.

Sometimes we need to map an ISO images to LPARs. Today we’re going to create a VM library, load ISO images and map them to LPARs. Just follow these steps

Prerequisites:

  • Download AIX’s iso files from IBM entitled software support.
  • Copy ISO files to /home/padmin directory on one VIO server.
  • Create a virtual VSCI adapter on the LPAR and map it to VIO server (vhostX)
padmin@vios $ ls -ltr /home/padmin
total 16290920
-rw-r--r--    1 padmin   staff    4238082048 Jan 12 01:35 AIX71.iso
-rw-r--r--    1 padmin   staff    4088528896 Jan 13 00:37 AIX61.iso
  •  Check there’s nos repository already created.
padmin@vios $ lsrep
The DVD repository has not been created yet.
  •  Create a new 10GB size VM repository.
padmin@vios $ mkrep -sp rootvg -size 10G
Virtual Media Repository Created
Repository created within "VMLibrary" logical volume
  •  Verify status of repository.
padmin@vios $ lsrep
Size(mb) Free(mb) Parent Pool      Parent Size      Parent Free
   10198    10198     rootvg            285696           249344
padmin@vios $ df -g /var/vio/VMLibrary
Filesystem       GB blocks    Free    %Used  Iused %Iused  Mounted on
/dev/VMLibrary   10.00        9.96    1%     4     1%      /var/vio/VMLibrary
  • Create virtual optical disks inside the Virtual Media Repository.
padmin@vios $ mkvopt -name AIX61 -file /home/padmin/AIX61.iso -ro
padmin@vios $ mkvopt -name AIX71 -file /home/padmin/AIX71.iso -ro
padmin@vios $ ls -l /var/vio/VMLibrary
total 16262912
-r--------    1 root     staff    4088528896 Feb 07 09:38 AIX61
-r--------    1 root     staff    4238082048 Feb 07 09:41 AIX71
drwxr-xr-x    2 root     system          256 Feb 07 09:35 lost+found
  •  Displays information about the Virtual Media Repository.
padmin@vios $ lsrep
Size(mb)  Free(mb) Parent Pool         Parent Size      Parent Free
10199     2257     rootvg                571392           488960

Name              File Size   Optical      Access
AIX61.iso               3900     None          ro
AIX71.iso               4042     None          ro
  • If you need to increase repository size use chrep command.

 

padmin@vios $ chrep -size 4G
  • Verify status of the increased VM repository.

 

padmin@vios $ lsrep
Size(mb) Free(mb) Parent Pool Parent Size Parent Free
14278 6336 rootvg 285696 245248

Name   File Size  Optical  Access
AIX61       3900     None      ro
AIX71       4042     None      ro
  •  Let’s crate a File Backed Optical Device for a particular LPAR mapped on vhost0
padmin@vios $ mkvdev -fbo -vadapter vhost0
  • Now let’s load the image from the VML into vtopt0.
padmin@vios $ loadopt -vtd vtopt0 -disk AIX61
padmin@vios $ lsvopt
VTD             Media                                                 Size(mb)
vtopt0          AIX61                                                     3900
  • Just verify vhost has being mapped correctly.

 

padmin@vios $ lsmap -vadapter vhost0
SVSA            Physloc                            Client Partition ID
--------------- -------------------------------------------- ------------------
vhost0          U8406.70Y.06E04FA-V1-C7                   0x00000010

VTD                   vtopt0
Status                Available
LUN                   0x8100000000000000
Backing device        /var/vio/VMLibrary/AIX61
Physloc
Mirrored              N/A
  • To unload the image. Try this:

 

padmin@vios $ unloadopt -vtd vtopt0
NOTE: If the CD device is locked by the client, use the -release flag to remove the reserve, and ran again the command
Posted in AIX | Tagged , , , | Leave a comment

DISK OPERATION ERROR in AIX

Last month, we noted errpt showing an error:

[root@aix:/] errpt -a
IDENTIFIER TIMESTAMP  T C RESOURCE_NAME  DESCRIPTION
DCB47997   1122091816 T H hdisk29        DISK OPERATION ERROR
F31FFAC3   1122091816 I H hdisk29        PATH HAS RECOVERED
DE3B8540   1122091816 P H hdisk29        PATH HAS FAILED
DCB47997   1122075216 T H hdisk26        DISK OPERATION ERROR
F31FFAC3   1122075216 I H hdisk26        PATH HAS RECOVERED
DE3B8540   1122075216 P H hdisk26        PATH HAS FAILED
DCB47997   1122070516 T H hdisk31        DISK OPERATION ERROR
F31FFAC3   1122070516 I H hdisk31        PATH HAS RECOVERED
DE3B8540   1122070516 P H hdisk31        PATH HAS FAILED

A way to find what’s causing this error is using ‘lsmpio’ command to display detailed device statistics for the hdisks devices.
NOTE: lsmpio command was introduce in AIX 7.1 TL3 and 6.1 TL9.

[root@aix:/] lsmpio -Sdl hdisk29
Disk: hdisk29
    Path statistics since Fri Dec 09 12:56:32 CET 2016
    Path 0: (fscsi0:500a09829af63ecf,7000000000000)
        Path Selections:                              1282755
        Adapter Errors:                                     0
            Software:                        0
            Hardware:                        0
            Transport Dead:                  0
            Transport Busy:                  0
            Transport Fault:                 0
            No Device Response:              0
            Target Port ID Changed:          0
        Command Timeouts:                                   0
        Reservation Conflicts:                              0
        SCSI Queue Full:                                    0
        SCSI Busy:                                          0
        SCSI ACA Active:                                    0
        SCSI Task Aborted:                                  0
        SCSI Aborted Command:                               0
        SCSI Check Condition:                               0
            Medium Error:                    0
            Hardware Error:                  0
            Not Ready:                       0
            Other:                           0
        Last Error:                                       N/A
        Last Error Time:                                  N/A
        Path Failure Count:                                 0
            Due to Adapter Error:            0
            Due to I/O Error:                0
            Due to Health Check:             0
            Due to SCSI Sense:               0
            Due to Qualifier Bit:            0
            Due to Opening Error:            0
        Last Path Failure:                                N/A
        Last Path Failure Time:                           N/A
Disk: hdisk29
    Path statistics since Fri Dec 09 12:56:31 CET 2016
    Path 1: (fscsi1:500a09828af63ecf,7000000000000)
        Path Selections:                              1254441
        Adapter Errors:                                     3
            Software:                        0
            Hardware:                        0
            Transport Dead:                  0
            Transport Busy:                  0
            Transport Fault:                 0
            No Device Response:              0
            Target Port ID Changed:          0
        Command Timeouts:                                   3
        Reservation Conflicts:                              0
        SCSI Queue Full:                                    0
        SCSI Busy:                                          0
        SCSI ACA Active:                                    0
        SCSI Task Aborted:                                  0
        SCSI Aborted Command:                               0
        SCSI Check Condition:                               0
            Medium Error:                    0
            Hardware Error:                  0
            Not Ready:                       0
            Other:                           0
        Last Error:                                  SCSI Command Timeout
        Last Error Time:                             Mon Dec 12 09:12:08 CET 2016
        Path Failure Count:                                 0
            Due to Adapter Error:            0
            Due to I/O Error:                0
            Due to Health Check:             0
            Due to SCSI Sense:               0
            Due to Qualifier Bit:            0
            Due to Opening Error:            0
        Last Path Failure:                                N/A
        Last Path Failure Time:                           N/A

As you can see in the output, the cause of the issue is “SCSI Command Timeout” on FC adapter.
Please, check FC network (VIOS, NPIV, SAN zonning).

Posted in AIX | Tagged , , , , , | Leave a comment

Using AIX’s smitty tool in maintenance mode.

How to use System Management Interface Tool (smitty)  in maintenance mode?

Just, got into maintenance mode and run:

# export TERM=vt100
# smitty

NOTEL: Take in mind Function (F) keys do not work here. in this case use <ESC><3> instead of <PF3>

Posted in AIX | Tagged , , | Leave a comment