How to configure serial ports with realport on RHEL 7+

How to configure serial ports with realport on RHEL 7+ where there is no /etc/initab file to edit

To configure serial ports with realport on RHEL 7+ without the /etc/inittab file:

  1. Identify the device name of the serial port using dmesg | grep tty.
  2. Create a new service file with the “.service” extension in /etc/systemd/system/.
  3. Add the following content to the service file, modifying it as needed:
[Unit]
Description=Serial Port Configuration

[Service]
ExecStart=/bin/stty -F /dev/ttyS0 -clocal -crtscts -ixon raw 9600

[Install]
WantedBy=multi-user.target

  1. Save the file.
  2. Enable and start the service:
sudo systemctl enable serialport.service
sudo systemctl start serialport.service

Remember to replace “/dev/ttyS0” with the appropriate device name and adjust the settings as required.

Can I have multiple ExecStart lines in one file for all the serial ports, or do I need a separate file for each device?