The new Raspberry Pi 4B 2Gb model costs around $46. Add a case, heat sinks, power supply, and an 8GB microSDHC card for around $34, and you've got the makings of an inexpensive ($80-ish) 5250 terminal.
There are two basic methods we've used with good success to create a 5250 terminal from a Raspberry Pi. First, if you have an IBM-i with active software maintenance (SWMA) and are running IBM-i 7.x, then the new IBM-i Access Client Solution for Linux is one option. Alternatively, if you're wanting a simple user interface or don't have active SWMA then the open source TN5250j project is your other option. Both of these programs are 100% java-based and thus can run on any OS or device that supports java without having to be recompiled.
The first basic assumption for our Raspberry Pi 5250 project is that we do not want a full GUI with all the bloat-ware that comes with a full Raspbian OS desktop (as of the date of this post the current version is Raspbian Bullseye). Thus, we're building this with Raspbian Bullseye Lite and adding a basic GUI. Unlike my 2017 article, I'm going to cover both the TN5250J and IBM Access Client Solutions setup this time around.
Here are the basic steps that I will outline in some detail in this article:
1) Download software and prep the microSD card,
2) Install the Raspbian Bullseye Lite OS;
3) Update and modify the Raspbian OS;
4) Copy 5250 programs and modify files;
5) Modify the boot load sequence of OS to auto-launch 5250 (if desired)
Step1: Download the Raspbian Bullseye Lite .img file zip archive and unzip. If you're a Windows user you'll need to install Win32DiskImager or Raspberry Pi Imager application. Also, go ahead and download TN5250J from SourceForge and the IBMiACS from the IBM Downloads site. If you purchased a new micro SDHC card it should already be formatted, if not format it as FAT32.
Step 2: Use Win32DiskImager or Raspberry Pi Imager to burn the Raspian Bullseye Lite .img file to the microSD card. My suggestion is that if you're going to use this microSD as a template for creating more microSD cards for more terminals, use a 4GB microSD card as your template. That way the image you'll create will be 4GB instead of 8, 16, or 32GB. Once Win32DiskImager finishes writing the .img to the microSD card, Windows will prompt you to Format the drive - CANCEL this prompt. Accept and Exit Win32DiskImager. Eject the microSD card.
Step 3: Time to hone your Linux chops or learn some new ones. Once you insert the microSD card into your pi and apply power, the OS should boot and begin asking some setup questions. As an aside, you need a USB keyboard, USB mouse, a monitor, and a network connection to complete this setup. The Pi has a micro-HDMI port so you may need a micro-HDMI to HDMI or VGA converter. The Pi will grab a DHCP network address; you can change this to a static IP later. It will first ask you for keyboard setup; the system defaults to English(GB), so scroll down to Other, select the appropriate option, in my case English (US), next, scroll to the top of the list, US (English) or another language as appropriate; OK. It will then prompt you for a default USERID and Password. You'll have to enter the password twice. For this article, I've simply used USERID: pi and PASSWORD: pi to keep things simple.
Next, let's run: sudo raspi-config and set our keyboard type, language set, time zone and WLAN country.
sudo raspi-config ->(4)localization -> (I1)Locales->Change Locale; scroll down and un-select (using space bar) en_GB.UTF-8 (unless of course you live in Great Britain), scroll down further to en_US.UTF-8 (for those in the US), tab, OK, on the next screen arrow down to en_US.UTF-8 (or other selected locale), tab, OK (this will generate locale files); Now, go to locale > keyboard and I selected > keyboard Generic US/104 (or other depending on location). Next, set your timezone: (I2)timezone (in my case US->Central); finish (should prompt to reboot); if not, type sudo reboot at the terminal prompt.
Now for installing a base GUI without all the stock bloat-ware:
If your users are going to use IBMiACS and print reports to PDF for viewing,
type: sudo apt-get install mupdf (to install a PDF reader.)
Step 4: Next, we'll download tn5250j-0.7.6-full-bin.zip (or the latest version) from SourceForge and unzip. Rename the unzipped folder to tn5250j for simplicity. Copy the folder to a USB stick. Insert the USB stick into the booted RaspberryPi. The GUI should automatically prompt to "Open with File Manager". Use File Manager to drag the tn5250j folder to /home/pi/ folder. For IBMiACS, create a folder on your USB stick called ibmiaccess and copy the following files from your download: acsbundle.jar, AcsConfig.properties, and logo128.png. Drag the ibmiaccess folder to the /home/pi folder. Open a terminal window and type: cd /home/pi/tn5250j or cd /home/pi/ibmiaccess <enter>, and type sudo chmod u+x *.jar to make all of the .jar files executable.
You can get the IBMiACS here: https://www.ibm.com/support/pages/ibm-i-access-client-solutions. It requires an IBM ID to log in and download the file(s).
To create a shell script for running the TN5250J program:
The IBM i Access Client Solutions setup is a bit different. If you use this on your Windows PCs, then you're already familiar with the setup. One important mention is that if you want to RESTRICT the functions that the user can access within the IBMiACS client, you do the following: close the IBMiACS client. Open a terminal window (SystemTools>LXTerminal) and type: cd /usr/local/bin. Now, type sudo ibmiaccess.sh to launch the IBMiACS client as the ROOT user. This will give you access to a "hidden" menu that only the root user has access to. Go to Edit, and Preferences, and you'll now see a Tab named Restrictions. Check the box next to the functions that you WANT to restrict users from accessing. There's also an option at the bottom of this list to "hide restricted functions" so that users can't see what they don't have access to. Once you define a system and session and save as an .HOD file, you can insert those values into your shell program to automatically launch the emulator with the pre-defined system, session, and terminal ID.
If you want the 5250 session to open in full screen and auto login to the 5250 emulator (not the IBM-i login), then do the following:
Open terminal session
sudo nano ibmiaccess.sh
edit the java execution line to read as follows:
java -jar $dir/$jar_name /plugin=5250 /system=SystemDNSName /name=SessionName /wsid=WorkStationID* /fullscreen=1 /nosave=1 /prompt=0 /sso=0
Ctrl-O and enter to save, Ctrl-X to exit
sudo nano .netrc (yes, the filename should have a period at the beginning)
*type this into the nano editor:
machine DNS-name-of-IBM-i-system login LOGINIDHERE password SESSIONPASSWORDHERE
ctrl O -> enter to save file
ctrl x to exit nano
ls -l -a .netrc will show file and owner as root
sudo chown pi:pi .netrc
ls -l -a .netrc (should now show pi as owner)
Based on recent input, I've edited the original post to add instructions for cloning the SD card for the Pi-5250 project. Insert the SD-card into your Windows PC. For those without an SD-card slot, there are USB SD-card readers. Launch Win32DiskImager (available on SourceForge). Click the folder icon next to the Image File box, navigate to a local folder and type in the name of the image file you want to use, with a .img extension (see example below). Choose your SD-card device drive letter. It will have (2) drive letters assigned such as E and F. Pick the E: drive as the device. Now click READ at the bottom of the window. Win32DiskImager will read the SD entire card to a .IMG file. You can then insert a blank SD-card into your PC, re-launch Win32DiskImager, navigate to the .IMG file location, pick your image, choose the SD-card device drive letter, and click WRITE to create a new SD card that is a clone of your prior image.