Installation on Ubuntu 22.04 / PHP 7.4

Hi all, I just wanted to post this here for others that may find it a steep learning curb getting this setup going for the first time. As, I’m sure you know if you’ve been setting up playSMS there’s a big community out there.

It took me about 4 evening, hundreds of browser tabs, and multiple wipes of a test machine to get this going. But, it’s a solid system once it’s up and going.
k
So, here’s how I got my installation up and going with USB Modem Dongle on Ubuntu 22.04 / PHP7.4.

As described on, PlaySMS Ubuntu 20.04 PHP 7.4 - PlaySMS Ubuntu 20.04 PHP 7.4 - Install and Upgrade - playSMS Forum forum article it’s pretty much the same installation process.

  • Run, ‘sudo dmesg | grep tty’ to confirm the COM ports of your USB 3G/4G adapter if setting it up with a USB Modem. (Usually ttyUSB0) - If unsure install minicom and connect to /dev/ttyUSBX / 115200 8N1
  • Update apt-sources to allow installation of older PHP version
  • sudo nano /etc/apt/sources.list
  • Add in, “deb h t t p s ://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main”
  • Save and then run, “sudo apt-key adv --keyserver keyserver . ubuntu . com --recv-keys 4f4ea0aae5267a6c”
  • Issue, apt-get update and apt-get upgrade.
  • Then, install: sudo apt-get install build-essential libusb-1.0-0 libusb-1.0-doc mc unzip mariadb-server apache2 usb-modeswitch php7.4 php7.4-cli php7.4-mysql php7.4-gd php7.4-curl php7.4-mbstring php7.4-xml php7.4-zip
  • Follows steps 1.1, 1.x (Steps optional), 1.3, 2, 3.
  • Switch to the komodo user - “sudo su komodo”
  • Follow step 4 (I setup mine up on a reverse proxy - So, I skipped this 4.2,4.3), 4.1, Update the VirtualHost file as per your domain information.
  • Installing PlaySMS - Follow step 5.1, 5.2, 5.3, 5.4 (But update the git command as necessary to the latest version as per the release tags on this page)
  • Create install.conf as per below (/home/komodo/src/playsms/install.conf)

DBUSER=“playsms”
DBPASS=“yourpassword”
DBNAME=“playsms”
DBHOST=“localhost”
DBPORT=“3306”
WEBSERVERUSER=“www-data”
WEBSERVERGROUP=“www-data”
PATHSRC=“$(pwd)”
PATHWEB=“/home/komodo/public_html”
PATHLIB=“/home/komodo/lib/”
PATHBIN=“/home/komodo/bin”
PATHLOG=“/home/komodo/log/”
PATHCONF=“/home/komodo/etc”

  • Complete step 5.6 (no need to run as sudo)

  • 5.7 (If behind reverse proxy you’ll need to switch on https)

  • Optionally, configure a secure Database with “sudo mysql_secure_installation”

  • Also, check your Apache Log file in /home/komodo/log - Mine was reporting that the following directory wasn’t writable and said to issue the following command:

chmod 777 /home/komodo/public_html/lib/composer/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ -R

Configure the /home/komodo/bin service to start on Start-Up

I followed this solution on the Forum, “playSMS Daemon continuously stops” at Github.

My Service file is like:

[Unit]
Description=PlaySMS
After=mariadb.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/komodo/bin/playsmsd /home/komodo/bin/playsmsd.conf start
ExecStop=/home/komodo/bin/playsmsd /home/komodo/bin/playsmsd.conf stop

[Install]
WantedBy=multi-user.target

  • Also, “cp /home/komodo/etc/playsmsd.conf /home/komodo/bin”
  • Finishing setting up the solution as per the linked forum post in this section…
  • Reboot and “cd /home/komodo/bin”
  • Run, “./playsmsd status” to confirm the daemon is running.

Getting the USB Dongle Setup

Now, you should be able to go to your playSMS site as configured … But what about the SMSTools setup… Here’s what I did.

  • Stop the smstools service, “sudo service smstools stop”
  • Update, “sudo nano /etc/smsd.conf” with:

devices = gsm1

loglevel = 7

stats = /var/log/smstools/smsd_stats
logfile = /var/log/smstools/smsd.log

outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent

delaytime = 2
errorsleeptime = 10
blocktime = 180
autosplit = 3

[queues]
gsm1 = /var/spool/sms/gsm1

[gsm1]
memory_start = 0
device = /dev/ttyUSB0
baudrate = 115200
incoming = yes
report = yes
queues = gsm1

[default]
queues = gsm1

  • mkdir /var/spool/sms/gsm1
  • cd /var/spool/
  • sudo usermod -a -G www-data smsd, sudo usermod -a -G smsd komodo.
  • sudo chmod 777 * sms/ -R ( I found until I did this - It just wouldn’t send our write the out. SMS file to /var/spool/sms)
  • sudo service smstools start
  • Note - Change the log level to 4 after it’s all set backup (Lots of interesting information about this on the smstools3 website) - As, I’ve got 7 here while I’m still testing the setup - It’s been going well with the five test users I have on the system so far.

Linking the USB with PlaySMS

  • Login and go to Settings > Manage Gateway and SMSC > Click the folder icon for “smstools” - Confirm the default_queue directory is “/var/spool/sms”
  • Manage Gateway and SMSC > Click the + icon for “smstools” - Confirm the SMSC name is “smstools”, receiver number (Can be blank in my case), Que Directory “/var/spool/sms/gsm1”
  • Settings > Main Configuration > Set the Timezone, Change Default SMSC to “smstools”

You should now be able to send/receive SMS with a USB modem.

(Note, in this setup - I still haven’t configure the timezone in PHP or on my system - But, I’ll get around to this once I get this setup in production - For the moment it’s still in Dev in my environment)

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.