Informing the IBM Community

Setup a User for Open-Source

4.8
(6)

In my article this month I will be taking you through the stages to allow a user to access, and use, open source on the IBM i.

This has to be the most asked question of our client base. “I’ve installed open source on my Power server, but how do I get to use it?”

Installing Open Source

I’m sure you all know by now, but I’m going to show you anyway, any open-source package is installed by using ACS (Access for Client Solutions) Open-Source Package Management option as can be seen below.

Then selecting the package, you want to install.

That has given us packages that we can use.

Giving User Access to Open-Source

The first step to giving access to Open-Source is to ensure that the user has a home directory specified on his user profile. This is the equivalent of setting a current library for a user.

To change an existing user profile to have a home directory is achieved using the command below.

Bash
CHGUSRPRF USRPRF(JRIDDLE) HOMEDIR('/home/jriddle')

This will give our user JRIDDLE a home directory on the IFS of /home/jriddle

This will not create a home directory for the user, we must make sure one exists for him.

This can be achieved by running a command in a SSH session of

Bash
mkdir /home/jriddle

it is a good idea to test that this user is placed into his home directory, by trying to SSH into your server using this profile.

In a terminal session, start a ssh session by specifying his name and the server to access. This is shown below.

Bash
ssh jriddle@galatea

Where galatea is our power server.

Once you have signed on, run the command PWD {Print working directory) to show which directory the user is in.

Bash
pwd

next we need to set- up a profile for this user (no, nothing to do with the IBM i user profile).

In a bash session, run the command to create an Open-Source profile for the user.

Bash
touch $HOME/.profile

this will create an empty file in the users home directory called .profile

Next, set the CCSID of that file, so we don’t get any character conversion issues.

Bash
setccsid 1208 $HOME/.profile

Then run two echo commands that will write to the users .profile file.

Bash
echo 'export PATH' >> $HOME/.profile 
echo 'PATH=/QOpenSys/pkgs/bin:$PATH' >> $HOME/.profile

The user now has to close his SSH session and reconnect again before the profile changes kick in.

Once the SSH connection has been made, type the following command to check the user is correctly setup.

Bash
which bash

this should then return

Bash
/QOpenSys/pkgs/bin/bash

If it does not return this, check you have set the echo path statement correctly.

if you have python installed, the user should be able to check the version with the following command. Please note the two minus characters otherwise python will return some horrible error message.

Bash
python3 --version

Python 3.9.18

And that is it, your new user can now access open-source on IBM i.

Conclusion

This article has demonstrated how easily a new user can access the variety of open-source packages available now on our Power server.

If you have any questions, either on this article, or anything else on the IBM i, please use the comments below, or contact us via the contact us page at https://powerwire.eu/contact

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 6

No votes so far! Be the first to rate this post.


Comments

3 responses to “Setup a User for Open-Source”

  1. Jon Paris avatar
    Jon Paris

    I’ve been looking for a “cookbook” like this so thanks Andy.

    One comment – I believe that the final command given is incorrect. It should either be Python3 -v or python3 –version. Just using -version results in a rather worrying error message!

  2. Jon Paris avatar
    Jon Paris

    Just noticed that -v produces a very different result and that my comment aboout using (hyper)(hyphen) version has been reduce to a single hyphen! So I guess your original text was correct but the powerwire website is screwing it up!

    1. Thanks for your comments Jon, always appreciated. You are right it should be minus minus version. We are trying different ways to show code in our articles and didn’t notice it had stripped it. I will correct the page and make it clearer.

      Cheers Andy

Leave a Reply

Your email address will not be published. Required fields are marked *