This article is about playSMS 1.4.3 installation on VirtualBox. What you need is a computer that is connected to the internet and capable of running VirtualBox properly.
To actually send and/or receive SMS you will need another piece that is not part of this article. You can discuss that in playSMS Forum.
I will be using Ubuntu 18.04 on my VirtualBox. That means you can compare this article with previous article playSMS 1.4.3 on Ubuntu 18.04. There should be similarities, but of course the previous article focus on cloud installation and this one is more like local installation.
Since the installation is local you will need to download Ubuntu Server 18.04 ISO file from Ubuntu websites, save it somewhere in your computer.
1. Prepare Ubuntu Server
1.1. Add New VM
Add VM or Virtual Machine on VirtualBox. This is my VM settings for hosting playSMS:
On the image above, the one with red markers are important part. First the installation media, thats the Ubuntu Server ISO file attached to virtual optical drive on the VM. Secondly the additional adapter, Adapter 2. It must be Host-only Adapter and attached to a virtual network adapter for VirtualBox, vboxnet0 in my example.
Adapter 1 will be used by VM to connect to the internet and Adapter 2 will be used by you to connect to the VM via SSH from your Terminal app (shell/console), and also for browing playSMS locally too.
Once everything ready start the VM and begin Ubuntu installation.
1.2. During Ubuntu Installation
1.2.1. Network Connections
You must make sure that both adapter receive IP address. Write down the IP addresses, you will need it to connect via SSH.
Adapter 1 will get IP either from the network that is connected to the computer, or internal VirtualBox’s DHCP server, it depends on the type. In this example the Adapter 1 type is the default NAT type.
Adapter 2 will get IP from VirtualBox too but this IP only accessible form the computer.
1.2.2. Profile Setup
This is where you create a normal Linux user. We will use this user to do the installation, and everything else I suppose.
I will be using komodo
as the normal Linux username. The rest of this article will use that username too. You can pick your own username but you must make sure that any reference to komodo
in this article will have to change to your own too.
Set a password for the user, a strong password preferrable. We will use it to login via SSH later and become root
via sudo
.
1.2.3. SSH Setup
Check the checkbox here to install SSH server.
1.2.4. Ubuntu Installation Done
Once the installation done minimize the VM window and open your Terminal/Console app and connect to your VM via SSH.
You need to treat your VM as a remote server.
Next parts are happening inside your VM after you logged in to it via SSH.
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
Reload UFW:
sudo ufw reload
As of now only SSH allowed by server, later we will allow http
and 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 nano
or vi
.
You need to install unzip
, composer
will need it and playSMS will need composer
.
Install mc
and unzip
:
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 to your VM via SSH after reboot is done.
2. Install MySQL Server
We will use MariaDB as MySQL server.
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:
sudo mysql
You should now logged in to your MySQL server as MySQL user root
. Type quit
and <Enter> to exit MySQL console.
Note that you cannot login to MariaDB as MySQL user root
if you are not Linux user root
. Use sudo
to access MySQL server as MySQL user root
, you won’t be asked for MySQL password.
We will not use MySQL user root
in playSMS, 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:
sudo ufw allow http sudo ufw reload
Let’s test the PHP:
cd /var/www/html sudo nano test.php
<?php
phpinfo();
Save test.php
and browse the file, you should see PHP Info page.
Browse test.php
Browse your Adapter 2’s IP address. In this example its http://192.168.56.108/test.php
Remove test.php
after testing:
sudo rm -f /var/www/html/test.php
4. Install playSMS
Now that we have a working web server with PHP, and MySQL server, we can then install playSMS 1.4.3.
Please remember to execute commands as normal Linux user, and only use sudo
to gain root
access when necessary. In this article playSMS will be installed under user komodo
as mentioned before.
4.1. Prepare Directories
Here are some important directories that need to be ready before playSMS installation:
- /home/komodo/web
- /home/komodo/log
- /home/komodo/bin
- /home/komodo/etc
- /home/komodo/lib
- /home/komodo/src
Create directories:
cd ~ mkdir -p bin etc lib src web log chmod 775 bin etc lib src web log
4.2. Check PHP Modules
Required PHP modules should already be installed, but before proceeding with playSMS installation you need to make sure that required PHP modules are installed:
php -m
Make sure you see at least curl
, gd
, mbstring
, mysqli
and xml
on the list.
4.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:
sudo mysql
CREATE USER 'playsms'@'localhost' IDENTIFIED BY 'strongpasswordhere'; GRANT ALL PRIVILEGES ON playsms.* TO 'playsms'@'localhost'; FLUSH PRIVILEGES; exit
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 playsms
.
4.4. Get playSMS Source Code
playSMS source code available on Github, you will need git
to get them, and git
should already be installed.
Go to src folder:
cd ~/src
Get playSMS version 1.4.3:
git clone -b 1.4.3 --depth=1 https://github.com/antonraharja/playSMS
The -b 1.4.3 --dept=1
part is important, it tells git
to only download playSMS 1.4.3.
As of now your playSMS 1.4.3 source code is available at /home/komodo/src/playSMS
.
4.5. Prepare install.conf
Go to playSMS source code directory, copy install.conf.dist
to install.conf
and then edit it.
Go to playSMS source code directory:
cd ~/src/playSMS
Edit install.conf
:
cp install.conf.dist install.conf mcedit install.conf
These are values I set on install.conf
:
DBUSER="playsms" DBPASS="strongpasswordhere" DBNAME="playsms" DBHOST="localhost" DBPORT="3306" WEBSERVERUSER="www-data" WEBSERVERGROUP="www-data" PATHSRC="/home/komodo/src/playSMS" PATHWEB="/home/komodo/web" 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.
Read the values above carefully and make changes accordingly, please don’t just copy-paste them.
Save install.conf
and ready to run install script.
4.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 web
and bin
.
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.
OK, let’s start the installation:
cd ~/src/playSMS ./install-playsms.sh
Verify installation:
Press Y (you will be asked twice, answer Y both) and proceed the installation.
Successful installation will show that all playSMS daemon is running:
4.7. Symlink
Next step after running the install script is to link playSMS web directory to somewhere inside Apache2 web root directory. In this example playSMS will be accessible from subfolder playsms
therefore we need to link /home/komodo/web
to /var/www/html/playsms
.
/home/komodo/web
is where the install script install playSMS and /var/www/html
is the default Apache2 web root where you can browse files via HTTP on your VM.
Here’s how to link it, create a symlink:
sudo ln -s /home/komodo/web /var/www/html/playsms
This part is important, do not miss it.
Now browse your playSMS on your VM, in this example browse to http://192.168.56.108/playsms
4.8. playSMS Log
The web server, Apache2, is running as user www-data
, but we ran install script as user komodo
, therefore all files and folders created by install script will be owned by user komodo
and Apache2 won’t be able to write playSMS logs in directory log
.
Set permission on directory log
so that www-data
have access, and also create playSMS log files in advance:
cd ~ touch log/playsms.log log/audit.log sudo chown -R www-data.komodo log sudo chmod 664 log/playsms.log log/audit.log
4.9. Adjust config.php
Edit playSMS config.php
:
mcedit ~/web/config.php
Inside config.php
search for logstate
and set it to 3
.
4.10. Change Default Password
Go to your browser, browse your playSMS on your VM and login as playSMS administrator.
Default admin access:
Username: admin
Password: admin
After login as admin
, go to My account -> Preferences
and change admin
password.
4.11. Installation Done
Installation is done, you got a working playSMS now.
I would suggest you to visit these articles and do that too:
- https://playsms.org/2018/08/01/again-timezone-setup/
- https://antonraharja.com/2020/03/07/fail2ban-for-playsms/
Don’t forget to join the Forum and ask/answer playSMS questions there:
5. References
Reference:
Pingback: Install playSMS 1.4.3 on VirtualBox