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:
- Identify the device name of the serial port using
dmesg | grep tty
. - Create a new service file with the “.service” extension in /etc/systemd/system/.
- 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
- Save the file.
- 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?