Guru: Getting Yum And Bash Up And Running
March 15, 2021 Rob McNelly
In the March 1 edition of The Four Hundred, I noted that an emphasis on things like system/application modernization and open source solutions gives IBM i newcomers a degree of comfort with the platform. I also made the point that no matter how long you or I have been at this, there are always people, young or not so young, who are new to the platform and come to this site seeking introductory information about various tasks and capabilities.
With this in mind, I want to delve further into open source for those who are new to it. As popular as open source is on this platform, not everyone in the IBM i world is there yet. Due to a lack of time – or maybe even a lack of interest – there remain administrators who don’t use it and environments that don’t deploy it.
It’s a fairly simple path from Unix to Linux to Solaris to AIX to open source software running on IBM i. Of course syntax and technique differ, but many of the concepts easily move from there to here. Certainly compared to, say, managing Windows environments vs. IBM i, there’s much more common ground with open source.
AIX has had a Linux application toolbox for years. It consists of open source code compiled to run on AIX that can be installed as rpm packages. Of course it wasn’t always this way (as Alex Woodie explains), but these days, the open source model on IBM i is quite similar. The software installation dependency problem (a.k.a. RPM hell) has been addressed with Yum, which makes installing packages a breeze. Run a shell script and download a minimal amount of RPM packages to get started. Then either allow your machine to connect to the internet for additional downloads as needed, or set up a repository on a machine that RPM can access in the local network.
I’m also intrigued by the new capabilities that bash has received on IBM i. In the aforementioned article on Access Client Solutions, I left off with a SSH session connected to IBM i. Now, for those wishing to explore the world of open source, let’s get Yum and Bash working on the system.
I followed these directions. Different Yum install options are available. I chose the bootstrap.sql method.
I downloaded bootstrap.sql to my machine and selected the Run SQL Scripts option under the database section of the ACS menu.
It installed as expected, as seen below.
Be sure to read the whole document. Toward the end you’ll find some important notes to help you adjust your PATH. There’s also a link to a Yum cheat sheet.
Once this was set up and I was logged in via SSH to the command line, I located the Yum installation by running:
find / -name yum –print
That provided the full path to the Yum command:
/QopenSys/pkgs/bin/yum
I then ran /QOpenSys/pkgs/bin/yum update:
bash-4.4$ /QOpenSys/pkgs/bin/yum update Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package bash.ppc64 0:4.4-2 will be updated ---> Package bash.ppc64 0:4.4-5 will be an update ---> Package ca-certificates.noarch 0:2_git20170807.10b2785-1 will be updated ---> Package ca-certificates.noarch 0:2_git20170807.10b2785-2 will be an update ---> Package libcurl4.ppc64 0:7.70.0-1 will be updated ---> Package libcurl4.ppc64 0:7.70.0-3 will be an update ---> Package libsqlite3-0.ppc64 0:3.19.3-2 will be updated ---> Package libsqlite3-0.ppc64 0:3.32.3-1 will be an update ---> Package libssh2-1.ppc64 0:1.9.0-2 will be updated ---> Package libssh2-1.ppc64 0:1.9.0-3 will be an update ---> Package libutil2.ppc64 0:0.8.1-1 will be updated ---> Package libutil2.ppc64 0:0.9.1-1 will be an update ---> Package python2.ppc64 0:2.7.18-3 will be updated ---> Package python2.ppc64 0:2.7.18-5 will be an update --> Processing Dependency: update-alternatives for package: python2-2.7.18-5.ppc64 --> Processing Dependency: update-alternatives for package: python2-2.7.18-5.ppc64 ---> Package python2-rpm.ppc64 0:4.13.1-2 will be updated ---> Package python2-rpm.ppc64 0:4.13.1-7 will be an update ---> Package rpm.ppc64 0:4.13.1-2 will be updated ---> Package rpm.ppc64 0:4.13.1-7 will be an update --> Processing Dependency: curl for package: rpm-4.13.1-7.ppc64 ---> Package yum.noarch 0:3.4.3-18 will be updated ---> Package yum.noarch 0:3.4.3-19 will be an update --> Running transaction check ---> Package curl.ppc64 0:7.70.0-3 will be installed ---> Package update-alternatives.ppc64 0:1.19.7-1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: bash ppc64 4.4-5 ibm 2.1 M ca-certificates noarch 2_git20170807.10b2785-2 ibm 12 k libcurl4 ppc64 7.70.0-3 ibm 403 k libsqlite3-0 ppc64 3.32.3-1 ibm 1.7 M libssh2-1 ppc64 1.9.0-3 ibm 327 k libutil2 ppc64 0.9.1-1 ibm 17 k python2 ppc64 2.7.18-5 ibm 26 M python2-rpm ppc64 4.13.1-7 ibm 276 k rpm ppc64 4.13.1-7 ibm 2.2 M yum noarch 3.4.3-19 ibm 1.2 M Installing for dependencies: curl ppc64 7.70.0-3 ibm 116 k update-alternatives ppc64 1.19.7-1 ibm 84 k Transaction Summary ================================================================================ Install 2 Packages Upgrade 10 Packages Total download size: 34 M Is this ok [y/N]: y Downloading Packages: (1/12): bash-4.4-5.ibmi7.2.ppc64.rpm | 2.1 MB 00:01 (2/12): ca-certificates-2_git20170807.10b2785-2.ibmi7.2.noa | 12 kB 00:00 (3/12): curl-7.70.0-3.ibmi7.2.ppc64.rpm | 116 kB 00:00 (4/12): libcurl4-7.70.0-3.ibmi7.2.ppc64.rpm | 403 kB 00:00 (5/12): libsqlite3-0-3.32.3-1.ibmi7.2.ppc64.rpm | 1.7 MB 00:00 (6/12): libssh2-1-1.9.0-3.ibmi7.2.ppc64.rpm | 327 kB 00:00 (7/12): libutil2-0.9.1-1.ibmi7.2.ppc64.rpm | 17 kB 00:00 (8/12): python2-2.7.18-5.ibmi7.2.ppc64.rpm | 26 MB 00:13 (9/12): python2-rpm-4.13.1-7.ibmi7.2.ppc64.rpm | 276 kB 00:00 (10/12): rpm-4.13.1-7.ibmi7.2.ppc64.rpm | 2.2 MB 00:01 (11/12): update-alternatives-1.19.7-1.ibmi7.2.ppc64.rpm | 84 kB 00:00 (12/12): yum-3.4.3-19.ibmi7.2.noarch.rpm | 1.2 MB 00:00 -------------------------------------------------------------------------------- Total 1.9 MB/s | 34 MB 00:18 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Updating : bash-4.4-5.ppc64 1/22 Updating : libutil2-0.9.1-1.ppc64 2/22 Updating : libssh2-1-1.9.0-3.ppc64 3/22 Updating : libcurl4-7.70.0-3.ppc64 4/22 Installing : curl-7.70.0-3.ppc64 5/22 Updating : rpm-4.13.1-7.ppc64 6/22 Updating : libsqlite3-0-3.32.3-1.ppc64 7/22 Installing : update-alternatives-1.19.7-1.ppc64 8/22 Updating : python2-2.7.18-5.ppc64 9/22 update-alternatives: using /QOpenSys/pkgs/bin/python2.7 to provide /QOpenSys/pkgs/bin/python (python) in auto mode Updating : python2-rpm-4.13.1-7.ppc64 10/22 Updating : yum-3.4.3-19.noarch 11/22 Updating : ca-certificates-2_git20170807.10b2785-2.noarch 12/22 Cleanup : yum-3.4.3-18.noarch 13/22 Cleanup : python2-rpm-4.13.1-2.ppc64 14/22 Cleanup : rpm-4.13.1-2.ppc64 15/22 Cleanup : python2-2.7.18-3.ppc64 16/22 Cleanup : libcurl4-7.70.0-1.ppc64 17/22 Cleanup : ca-certificates-2_git20170807.10b2785-1.noarch 18/22 Cleanup : bash-4.4-2.ppc64 19/22 Cleanup : libssh2-1-1.9.0-2.ppc64 20/22 Cleanup : libsqlite3-0-3.19.3-2.ppc64 21/22 Cleanup : libutil2-0.8.1-1.ppc64 22/22 Dependency Installed: curl.ppc64 0:7.70.0-3 update-alternatives.ppc64 0:1.19.7-1 Updated: bash.ppc64 0:4.4-5 ca-certificates.noarch 0:2_git20170807.10b2785-2 libcurl4.ppc64 0:7.70.0-3 libsqlite3-0.ppc64 0:3.32.3-1 libssh2-1.ppc64 0:1.9.0-3 libutil2.ppc64 0:0.9.1-1 python2.ppc64 0:2.7.18-5 python2-rpm.ppc64 0:4.13.1-7 rpm.ppc64 0:4.13.1-7 yum.noarch 0:3.4.3-19 Complete! bash-4.4$
Again, referring to this article, I was able to run some of the commands the author suggests:
bash-4.4$ getjobid Process identifier 233 is 003275/QSECOFR/QP0ZSPWP bash-4.4$ cl cl: usage: cl [-beEhiIkKnOpqsSv] COMMAND [ARG ...] bash-4.4$ liblist QSYS SYS QSYS2 SYS QUSRSYS SYS QSHELL PRD QGPL USR QTEMP USR
While working on this piece, there was a bash update. So I brought my system to the latest and greatest by running another Yum update command:
bash-4.4$ yum update ibm | 3.6 kB 00:00 ibm/primary_db | 372 kB 00:00 Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package bash.ppc64 0:4.4-5 will be updated ---> Package bash.ppc64 0:4.4-6 will be an update ---> Package libncurses6.ppc64 0:6.0-6 will be updated ---> Package libncurses6.ppc64 0:6.0-7 will be an update ---> Package libopenssl1_1.ppc64 0:1.1.1g-1 will be updated ---> Package libopenssl1_1.ppc64 0:1.1.1i-1 will be an update ---> Package ncurses-terminfo.ppc64 0:6.0-6 will be updated ---> Package ncurses-terminfo.ppc64 0:6.0-7 will be an update ---> Package perl.ppc64 0:5.24.1-1 will be updated ---> Package perl.ppc64 0:5.24.1-2 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: bash ppc64 4.4-6 ibm 2.1 M libncurses6 ppc64 6.0-7 ibm 1.5 M libopenssl1_1 ppc64 1.1.1i-1 ibm 2.0 M ncurses-terminfo ppc64 6.0-7 ibm 583 k perl ppc64 5.24.1-2 ibm 28 M Transaction Summary ================================================================================ Upgrade 5 Packages Total download size: 35 M Is this ok [y/N]: y Downloading Packages: (1/5): bash-4.4-6.ibmi7.2.ppc64.rpm | 2.1 MB 00:01 (2/5): libncurses6-6.0-7.ibmi7.2.ppc64.rpm | 1.5 MB 00:00 (3/5): libopenssl1_1-1.1.1i-1.ibmi7.2.ppc64.rpm | 2.0 MB 00:01 (4/5): ncurses-terminfo-6.0-7.ibmi7.2.ppc64.rpm | 583 kB 00:00 (5/5): perl-5.24.1-2.ibmi7.2.ppc64.rpm | 28 MB 00:16 -------------------------------------------------------------------------------- Total 1.8 MB/s | 35 MB 00:19 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Updating : ncurses-terminfo-6.0-7.ppc64 1/10 Updating : libncurses6-6.0-7.ppc64 2/10 Updating : bash-4.4-6.ppc64 3/10 Updating : libopenssl1_1-1.1.1i-1.ppc64 4/10 Updating : perl-5.24.1-2.ppc64 5/10 Cleanup : bash-4.4-5.ppc64 6/10 Cleanup : libncurses6-6.0-6.ppc64 7/10 Cleanup : ncurses-terminfo-6.0-6.ppc64 8/10 Cleanup : libopenssl1_1-1.1.1g-1.ppc64 9/10 Cleanup : perl-5.24.1-1.ppc64 10/10 Updated: bash.ppc64 0:4.4-6 libncurses6.ppc64 0:6.0-7 libopenssl1_1.ppc64 0:1.1.1i-1 ncurses-terminfo.ppc64 0:6.0-7 perl.ppc64 0:5.24.1-2 Complete!
I mentioned that bash update to show you why it’s important to regularly check for yum updates. The latest versions provide new features and enhanced security. Putting off system updates can be costly, but yum makes it pretty simple to keep current.
At this point, you should have OpenSSH, Yum, and the latest version of bash installed (as well as ACS). Now you’re set up to install other open source packages.
To find out what’s available, run “Yum list.” At the time of this writing there were 398 selections. Note: This doesn’t mean there are nearly 400 programs. Some of these packages are actually components that are needed to get various programs to run. The good news is that yum sorts out the dependencies – and you do have many packages from which to choose.
If you’re new to IBM i but are familiar with Linux, running things in bash while logged in via putty is great. Rather than having to login to a 5250 console and navigate green screens, you’re dealing with familiar commands and syntax. You can write scripts as you would with any other Unix-like system. And for experienced IBM i users, this interface also allows you to easily leverage what you already know.
For example, if I preface a command with “cl” in Bash, I can do some interesting things:
cl wrkactjob
As you can imagine the output from wrkactjob is long, so try it on your system. Some smaller output comes when I run:
cl wrkoutq bash-4.4$ cl wrkoutq CPD000D: Command *LIBL/WRKOUTQ not safe for a multithreaded job. 5770SS1 V7R4M0 190621 Work With All Output Queues 2/12/21 10:13:03 CST Page 1 Queue Library Files Writer Status QDKT QGPL 0 RLS QPFROUTQ QGPL 0 RLS QPRINT QGPL 14 RLS QPRINTS QGPL 0 RLS QPRINT2 QGPL 0 RLS QSPRCLOUTQ QRCL 0 RLS QSRVMON QSERVICE 0 RLS QS9SRVAGT QSRVAGT 0 RLS QEZDEBUG QUSRSYS 0 RLS QEZJOBLOG QUSRSYS 1 RLS QTPPPOUTQ QUSRSYS 0 RLS * * * * * E N D O F L I S T I N G * * * * *
You may need to get the hang of formatting commands, for example:
bash-4.4$ cl wrkoutq outq\(qgpl/qprint\) CPD000D: Command *LIBL/WRKOUTQ not safe for a multithreaded job. 5770SS1 V7R4M0 190621 Work With Output Queue QPRINT in QGPL 2/12/21 10:14:04 CST Page 1 File User User Data Status Pages Copies Form Type Pty File Number Job Number Date Time QPJOBLOG QSYS QLPSVR RDY 1 1 *STD 5 1 QLPSVR 000135 02/26/20 02:45:05 REQUESTROL QSECOFR SQL RDY 47 1 *STD 5 1 DSP01 000146 02/26/20 03:25:50 QPRINT QSYS RDY 1 1 *STD 5 1 QSLPSVR 000402 02/27/20 03:29:03 QPRINT QSYS RDY 1 1 *STD 5 1 QSLPSVR 000734 03/03/20 06:08:45 QPRINT QSYS RDY 1 1 *STD 5 5 QPRTJOB 000551 06/04/20 15:44:07 QPRINT QSYS RDY 1 1 *STD 5 6 QPRTJOB 000551 06/04/20 15:44:18 QPRINT QSYS RDY 1 1 *STD 5 7 QPRTJOB 000551 06/04/20 15:44:28 QPRINT QSYS RDY 1 1 *STD 5 8 QPRTJOB 000551 06/04/20 15:44:39 QPCSMPRT QSECOFR RDY 2 1 *STD 5 1 DSP01 002556 07/02/20 09:13:15 QPCSMPRT QSECOFR RDY 2 1 *STD 5 2 DSP01 002556 07/02/20 09:13:16 QPCSMPRT QSECOFR RDY 1 1 *STD 5 3 DSP01 002556 07/02/20 09:13:16 QPRINT QSYS RDY 1 1 *STD 5 1 QSLPSVR 001271 07/07/20 02:31:27 QSYSPRT QSECOFR CHGLICINF RDY 1 1 *STD 5 1 DSP01 002826 01/21/21 12:39:35 * * * * * E N D O F L I S T I N G * * * * *
Here’s another nice command:
cl dspmsg msgq\(qsysopr\)
Incidentally, running this example alerted me to an issue I needed to dig into:
CPI096E 99 INFO Disk unit connection is missing.
Now if I want to install Python, PHP, or Ruby, I can just issue the “Yum install” command.
Finally, note the various support options for open source users on IBM i. Bitbucket allows you to tap into the broader open source community, and IBM i open source team members do monitor the site. If you can’t find what you need there, you can contact IBMers Camilla Sharpe and Jesse Gorzinski. We can help you do that if you need it.
Rob McNelly is a senior Power Systems solutions architect doing pre-sales and post-sales support for Meridian IT, headquartered in Deerfield, Illinois. McNelly was a technical editor for IBM Systems Magazine, and a former administrator within IBM’s Integrated Technology Delivery and Server Operations division. Prior to working for IBM, McNelly was an OS/400 and IBM i operator for many years for multiple companies. McNelly was named an IBM Champion for Power Systems in 2011, an IBM Champion Lifetime Achievement recipient in 2019, and can be reached at rob.mcnelly@gmail.com.
RELATED STORIES
Guru: For IBM i Newcomers, An Access Client Solutions Primer
Sometimes Folks Only Learn The Hard Way About Keeping Software Current