playSMS version 1.4.3 has been released, and it is the recommended version as it contains fixes to several bugs and critical security vulnerability. This article is howto install playSMS 1.4.3 on Ubuntu 18.04.
I’m using DigitalOcean (DO) service to test the configuration and commands. Create new Droplet in DO account. Click here to register on DO if you don’t have an account.
Choose Ubuntu 18.0.4 (currently 18.04.3 LTS) and select at least the cheapest service (USD 5). Create and wait for a minute or two for the SSH to be ready. You can then login via SSH and start playSMS installation.
Login to your CentOS droplet (later we will call droplet as server) using SSH and follow instructions below step by step. Read carefully why you need to do each step correctly. Please pay attention to details.
This article first published in: https://antonraharja.com/2020/03/20/playsms-1-4-3-on-ubuntu-18-04/
1. Prepare Ubuntu
1.1. Add Normal User
In DO you need to login as
root first. But it is recommended to not login as
root all the time, so we create a new normal Linux user.
root create a new normal Linux user and set a strong password for it:
usermod -a -G sudo komodo
Q: Can I use other username besideYes, you can. Just remember to adjust every reference of komodo in this article into your own chosen username.
1.2. Copy authorized_keys
This is additional and optional steps you need to do if you’re login SSH as
root using private key instead of password.
You need to copy root’s
sudo mkdir -p /home/komodo/.ssh sudo cp /root/.ssh/authorized_keys /home/komodo/.ssh/ sudo chown -R komodo.komodo /home/komodo
After this you can login SSH as user
komodo using the same private key as
Q: Can I use different key forYes, you can. Copy the public key (it’s public key, not private key) to komodo`s authorized_keys and remove root’s public key from it.
1.3. Enable Ubuntu Firewall
Allow SSH first:
sudo ufw allow ssh
Enable UFW, activate it and make it starts on boot:
sudo ufw enable
sudo ufw reload
As of now only SSH allowed by server, later we will allow
https. Don’t forget to
ufw reload after changing UFW rules.
1.4. Install mc and unzip
Yes. Install mc and unzip :) I’m using
mcedit as console text editor, and you might be checking files/folders frequently, for that I think
mc helps. But you can always choose not to install it and stick with
You need to install
composer will need it and playSMS will need
sudo apt update sudo apt install mc unzip
1.5. Upgrade Server
Update and upgrade:
sudo apt update sudo apt upgrade
Most likely after upgrade Ubuntu asks for server reboot, reboot it then:
sudo shutdown -r now
Re-login SSH using user
komodo instead of
root. Pass this point you need to login to the server as normal user
komodo, and you will use
sudo when you need to execute commands as
2. Install MySQL Server
We will use MariaDB as MySQL server.
If you have not logout out from
root you need to logout now and re-login as normal user
Install MySQL server MariaDB:
sudo apt install mariadb-server
Starts MariaDB and enable it:
sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
Test your MySQL root access:
You should now logged in to your MySQL server as MySQL user
quit and <Enter> to exit MySQL console.
Note that you cannot login to MariaDB as MySQL user
root if you are not Linux user
sudo to access MySQL server as MySQL user
root, you won’t be asked for password.
We will not use MySQL user
root in playSMS but we will create a new MySQL user just for playSMS database later.
3. Install Web Server and PHP 7.2
We will use Apache2 as the web server.
Install Apache2, PHP 7.2 and required PHP modules:
sudo apt install apache2 php php-cli php-mysql php-gd php-curl php-mbstring php-xml php-zip
Start Apache2 and enable it:
sudo systemctl start apache2.service sudo systemctl enable apache2.service
Allow HTTP and HTTPS:
sudo ufw allow http sudo ufw allow https sudo ufw reload
Let’s test the PHP:
cd /var/www/html sudo mcedit test.php
<?php echo "Hello World";
test.php and browse the file, you should Hello World displayed.
Remove `test.php` after testing:
sudo rm -f /var/www/html/test.php
4. Supports HTTPS
HTTPS supports will be added to our web server by requesting, installing and configuring SSL certificate from Let’s Encrypt on Apache2. Let’s Encrypt provides a free SSL certificate for everyone.
4.1. Setup VirtualHost
This step is required for getting free SSL certificate for our HTTPS service from Let’s Encrypt.
In this example I will be using
dm143.playsms.org domain as my entry in VirtualHost setup. I also have set the DNS to point
dm143.playsms.org to my CentOS server’s public IP. Of course you will need your own domain/subdomain and point to your own CentOS server’s public IP.
The example VirtualHost configuration will make Apache serve PHP file for domain
dm143.playsms.org from our regular user (user
komodo) Home Directory (
/home/komodo/public_html to be exact).
Prepare user’s Home Directory:
cd /home/komodo mkdir -p public_html log sudo chmod 775 /home/komodo public_html log sudo chown komodo.komodo -R /home/komodo sudo chown www-data.komodo -R /home/komodo/log ls -l /home/komodo
Create VirtualHost configuration file for domain
sudo mcedit /etc/apache2/sites-available/dm143.playsms.org.conf
<VirtualHost *:80> ServerName dm143.playsms.org DocumentRoot /home/komodo/public_html ErrorLog /home/komodo/log/httpd-error.log CustomLog /home/komodo/log/httpd-accesss.log combined <Directory /home/komodo/public_html> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Require method GET POST OPTIONS php_admin_value engine On </Directory> </VirtualHost>
sudo a2ensite dm143.playsms.org sudo systemctl reload apache2.service
Switch user as user
komodo and test VirtualHost by create a PHP file in
<?php echo "<b>Welcome !!</b>";
Save the file and browse this file at your domain, in this example browse
You know your VirtualHost is working when you see Welcome !! on your browser.
test.php after testing:
rm -f /home/komodo/public_html/test.php
4.2. Install certbot
We will get the SSL certificate from Let’s Encrypt and use
certbot to install it on the server.
sudo apt install python3-certbot-apache
4.3. Setup SSL Certificate
Run certbot for Apache:
sudo certbot --apache
Answer questions correctly. You will need to input your email address, choose A to Agree with the ToS and last choose Redirect (selection no. 2) to completely remove HTTP and just serve HTTPS by redirecting all HTTP requests to HTTPS.
Example of successful SSL certificate request and installation:
Visit ssllabs.com/ssltest and submit your domain to test your HTTPS configuration.
5. Install playSMS
Now that we have a working web server with PHP and HTTPS supports, and MySQL server, we can then install playSMS 1.4.3.
From now on you must execute commands as normal Linux user. In this article playSMS will be installed under user
komodo as mentioned before.
5.1. Prepare Directories
Here are some important directories that need to be ready before playSMS installation:
log is already exists and prepared, they are created previously on section 4.1 as part as VirtualHost configuration. So now we need to create the rest and set proper permission.
Then create directories:
cd /home/komodo mkdir -p bin etc lib src sudo chmod 775 bin etc lib src
Prepare log files too, this need to be done so that both web server Apache2 and playSMS daemon have write access to playSMS log files:
cd /home/komodo sudo touch log/audit.log log/playsms.log sudo chmod 664 log/audit.log log/playsms.log sudo chown www-data.komodo -R log ls -l log
5.2. Check PHP Modules
Required PHP modules should already be installed if you follow this article from the start, it is on section 3. But before proceeding with playSMS installation you need to make sure that required PHP modules are installed:
Make sure you see at least
xml on the list. If they are not on the list then please install them, see section 3.
5.3. Prepare Database
Create MySQL database that will be used by playSMS:
sudo mysqladmin create playsms
Login as MySQL user root and create a new MySQL user for above database:
CREATE USER 'playsms'@'localhost' IDENTIFIED BY 'strongpasswordhere'; GRANT ALL PRIVILEGES ON playsms.* TO 'playsms'@'localhost'; FLUSH PRIVILEGES; exit
Do not copy-paste above SQL commands directly to MySQL console, you must use your own strong password, change the
strongpasswordhere with your own strong password.
As of this section you will have a MySQL database named
playsms and MySQL normal user
playsms with your own strong password which only have access to database
5.4. Get playSMS Source Code
playSMS source code available on Github, you will need
git to get them.
Go to src folder:
Get playSMS version 1.4.3:
git clone -b 1.4.3 --depth=1 https://github.com/antonraharja/playSMS
As of now your playSMS 1.4.3 source code is available at
5.5. Prepare install.conf
Go to playSMS source code directory, copy
install.conf and then edit it.
Go to playSMS source code directory:
cp install.conf.dist install.conf mcedit install.conf
These are values I set on
DBUSER="playsms" DBPASS="strongpasswordhere" DBNAME="playsms" DBHOST="localhost" DBPORT="3306" WEBSERVERUSER="www-data" WEBSERVERGROUP="www-data" PATHSRC="/home/komodo/src/playSMS" PATHWEB="/home/komodo/public_html" PATHLIB="/home/komodo/lib" PATHBIN="/home/komodo/bin" PATHLOG="/home/komodo/log" PATHCONF="/home/komodo/etc"
Values need to reflect your server configuration. If you follow this article from the start then above values should be correct, with exception your true database password (DBPASS) of course.
install.conf and ready to run install script.
5.6. Run playSMS Install Script
playSMS install script will download
composer and download packages from
repo.packagist.org. After that the script will copy necessary files from playSMS source code to
Since theres requirement to be able to download from external site (repo.packagist.org), you have to make sure that external site is working and reachable.
But you can just start the install script, because you’ll know if something not right, for example the script fail to download packages. When that happens you can fix the problem first, like fix your networking setup and perhaps firewall, or simply wait (theres a chance the external site down too), and then go back to re-run the install script.
Just to make sure that networking stuff is right, please see section 1.6.
OK, let’s start the installation:
cd /home/komodo/src/playSMS ./install-playsms.sh
Press Y (you will be asked twice, answer Y both) and proceed the installation.
Successful installation will show that all playSMS daemon is running:
Browse your playSMS, don’t worry if the login page looks broken, it’s because we haven’t configure playSMS to enable HTTPS, we will do that after this. For now, check if you can see playSMS login page.
5.7. Adjust config.php
config.php and adjust some value, or just one part, the HTTPS support.
- Search for
logstateand set it to
- Search for
ishttpsand set it to
5.8. Change Default Password
Go to your browser, browse the server and login as playSMS administrator, and change the default admin password immediately.
Default admin access:
After login as
admin, go to
My account -> Preferences and change
5.9. Installation Done
Installation is done, you got a working playSMS now.
I would suggest you to visit these articles and do that too:
Don’t forget to join the Forum and ask/answer playSMS questions there: