TinyCore WordPress Server

This assume a vanilla install of Tiny Core Linux as a starting point. You can use core2usb (http://sourceforge.net/projects/core2usb/) to get TinyCore on USB key (note: you need to download tinycore iso manually and this only works on Windows, I used a VM)

1- Initial Set-up on First Boot

* Change password for user tc and root, add relevant files to backup, run backup

<enter your chosen tc user password>
sudo passwd
<enter your chosen root user password>
sudo echo etc/passwd >>/opt/.filetool.lst
sudo echo etc/shadow >>/opt/.filetool.lst
filetool.sh -b

* Install packages
samba3.tcz, libavahi.tcz (required by samba), dropbear.tcz, apache2.tcz, apache2-mod-php5.tcz, mysql.tcz, mailx.tcz (if using an external smtp server like Google or other, msmtp/sendmail are NOT required), cifs-utils.tcz (required to mount drives), findshares.tcz (brilliant utility to scan your network for details of shares available)
For each package (here dropbear)

q(uit package description)

* Configure Packages (make configuration changes, add relevant files to backup, add relevant command to startup, run backup)
** dropbear

sudo /etc/init.d/dropbear start
sudo echo etc/dropbear/dropbear_rsa_host_key >>/opt/.filetool.lst
sudo echo etc/dropbear/dropbear_dss_host_key >>/opt/.filetool.lst
sudo echo /etc/init.d/dropbear start >>/opt/bootlocal.sh
filetool.sh -b

** samba
my configuration file stored at /usr/local/etc/samba/smb.conf – WARNING, this is for use on an internal LAN only and very unsecure.

workgroup = WORKGROUP
netbios name = thinclient
security = share
comment = Data
path = /home/apache2
force user = tc
force group = staff
read only = no
guest ok = yes

sudo /usr/local/etc/init.d/samba start
sudo echo usr/local/etc/samba/smb.conf >>/opt/.filetool.lst
sudo echo /usr/local/etc/init.d/samba start >>/opt/bootlocal.sh
filetool.sh -b

** mysql
Create default user and wordpress database

sudo /etc/init.d/services/mysql start –flush
mysqladmin -u root -p
{enter root password}
mysql -u root -p {root password}
mysql>CREATE DATABASE wordpress;
mysql> exit
sudo echo usr/local/mysql/data >>/opt/.filetool.lst
sudo echo /etc/init.d/services/mysql start –flush >>/opt/bootlocal.sh
filetool.sh -b

** apache2
I changed the default httpd.conf at /usr/local/apache2/conf/httpd.conf to listen to port 90 and the default directory to be served from /home/apache2 (so I can modify my website files from another machine using samba – note that the default directory needs to be modified in TWO places in the httpd.conf file).

sudo /usr/local/apache2/bin/apachectl start
sudo echo usr/local/apache2/conf/httpd.conf >>/opt/.filetool.lst
sudo echo /usr/local/apache2/bin/apachectl start >>/opt/bootlocal.sh
filetool.sh -b

** mailx

Strange lack of documentation on this one! I eventually figured out from a couple of blog posts (links below) that I had to create a .mailrc file under /home/tc/ as its config file. Despite my attempts, I kept getting security certificate errors while trying to set-up gmail as my smtp server so I went with my ISP’s smtp server, which isn’t SSL and that makes the configuration a lot simpler.




<my .mailrc file using eircom SMTP server>

account eircom {

set smtp=smtp://mail1.eircom.net:25

set from=”from@mail.com”


<calling mailx: sample command with -a to add an attachment, not part of the final solution>

echo “my wordpress backup” | mailx -A eircom -s “WordPress Backup” -a /home/tc/Dropbox/wordpress.sql youremail@email.com

There isn’t any running service that needs to be added to the startup script and /home being a persistent location, no need to add any additional path to /opt/.filetool.lst. You will need however to back up!

filetool.sh -b

2- Install WordPress from wordpress.org site

3- Data Backup

3.1- Onsite

I wanted to keep away from running filetool.sh -b on cron every 15 minutes, which is overkill to capture content change that might happen once a week at most so I installed the Hookpress plugin in my wordpress install – http://wordpress.org/plugins/hookpress/ – and pointed it to a custom .php file on my web server that a) runs a mysqldump command for the wordpress database into a .sql file, b) copy the .sql file onto a mounted shared drive, c) sends a confirmation email using mailx to confirm this is all taking place, d) runs the “filetool.sh -b” command.

NOTE: This works best if you disable the autosave feature of WordPress (either through the code or installing a wordpress plugin like TSP Disable Auto-Save), otherwise the whole process will be kicked off by default every minute, which can corrupt your backup.



$timestamp = date(‘d-m-Y’);

$myFile = “wordpress.”.$timestamp.”.sql”;

$commandString = “mysqldump –user=root –password=XXXXX –host=localhost –add-drop-database wordpress > /home/tc/Dropbox/$myFile”;

exec($commandString); ?>


$commandString2 = “sudo cp /home/tc/Dropbox/$myFile /media/nmt/BackUps/$myFile”;

exec($commandString2); ?>


$commandString3 = “mailx -n -v -r youremail@mail.com -s ‘WordPress Backup Confirmation’ -S smtp=smtp://mail1.eircom.net:25 youremail@mail.com”; exec($commandString3); ?>

<?php $output = shell_exec(“filetool.sh -b”); ?>


3.2- Offsite

dropbox on LiveUSB works but loses registration information at every reboot (this issue is specific to LiveUSB setups, it is reported to work perfectly on frugal installs), which makes it too impractical for me to use. If you can use dropbox, you can simplify the backup.php file to save the .sql dump file straight to the dropbox folder (and the email notification piece if you want to) and that’s it.

I could send the .sql file as an attachment in the notification email (see mailx command example above with the -a parameter for the attachment) but that wouldn’t be very secured and I don’t really want to embark upon email encryption unless I have to.

So I went with the easiest solution, which is to copy the file to a mounted network drive, since I have a couple of devices exposing samba shares that are on pretty much the whole time.

I added the following to /opt/bootlocal.sh to mount my share at startup. Note that as per http://forum.tinycorelinux.net/index.php?topic=15327.0, I had to install first cifs-utils to be able to map a drive (and the findshares utility comes in real handy). Before that, the mount command failed with a “device not available” message.

sudo echo mkdir /media >>/opt/bootlocal.sh
sudo echo mkdir /media/nmt >>/opt/bootlocal.sh
sudo echo mount -t cifs -o user=nmt,password=XXXXX // /media/nmt >>/opt/bootlocal.sh

4- Finish Line

You should have now a self-hosted wordpress install running off your USB key (if like me you are running it as LiveUSB) that can run on a very low spec machine. I have one more thing to explore and that’s OS backup. I’ll add this once I have figured it out.

As a note for myself, use “Registered Users Only” WordPress plug-in if you want to keep your blog private – http://wordpress.org/plugins/registered-users-only/

4 thoughts on “TinyCore WordPress Server

  1. Pingback: Tiny Core Linux Part 7 -WordPress Dedicated Step by Step Install | Computer Ramblings

  2. Pingback: Setting up a NAS server with Tiny Core Linux 5.4 | Computer Ramblings

    • Hum, yes, this tutorial was written for TCL v4 and it seems there is no mysql package for the newer TCL v5 and TCL v6. You can browse the options for databases by typing tce-ab and then k (for keywords).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s