One constantly posted question on LowEndBox and LowEndTalk is — how to get the same setup as LowEndBox, a WordPress site that runs on cheap VPS with 80MB of memory? Instead of doing a step-by-step explanation (damn I hate writing long blog posts), I decided to wrap it into a bash script that does it all.
![]() | ![]() |
![]() | ![]() |
It is based on my previous script here, and it has been tested on both Debian 5 “Lenny” and Ubuntu 10.04 “Lucid Lynx”. Sorry no other distributions are supported. It is currently hosted at github so feel free to branch it and tune it to your heart’s desire.
Usage
Here is a quick step by step on how to set up a WordPress blog running on Nginx, PHP/FastCGI and MySQL on a low end box. Let’s assume that you are going to set up a blog on hostname “blog.example.com“.
- Go and buy a cheap VPS. Yes, you know where to find cheap virtual servers under $7/month, don’t you? 🙂 I am using my 6 pound/year RackVM VPS with 128MB memory to test this script, and the performance turns out to be quite good. YMMV.
Make sure it is either a Debian or a Ubuntu distro though.
- After gaining root access to your VPS,
# wget --no-check-certificate https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh ... # bash setup-debian.sh system ... # bash setup-debian.sh exim4 ... # bash setup-debian.sh nginx ... # bash setup-debian.sh mysql ... # bash setup-debian.sh php ... # bash setup-debian.sh wordpress blog.example.com ...
- Now altering your DNS entry to point
blog.example.comto your new VPS (or alter your local/etc/hostsentry). Navigate to it from your browser, and you should be presented with WordPress set up page. Fill in your blog’s name, admin’s password and contact email, and your new WordPress is online!Just repeat the last step (running
bash setup-debian.sh wordpress <hostname>) to set up more blogs on the same box.
That’s it!
Software Stack
It’s pretty similar to my own stack that runs LowEndBox.com.
- dropbear to replace openssh. Invoked from xinetd.
- inetutils-syslogd to replace rsyslog.
- exim4 to replace sendmail (if installed). Re-configured to allow Internet delivery.
- cron
- nginx
- mysql. Re-configured to remove innodb support, remove query cache and reduce key buffer size.
- php with built-in FastCGI interface. Running only 1 child process and respawn after 5,000 requests.
The lowendscript is also
- Removing some commonly bundled applications that should not be there in the first place for a minimal distro (apache2, sendmail, bind9, samba, nscd, etc).
- MySQL root is given a new password (which can be found in
~root/.my.cnf) - Installing each WordPress site under /var/www/<hostname>. It will create appropriate database, users and password for the site.
I have to say that it is still “work in progress”, but if you want to figure out the internals please check the source code of that bash script.
Memory Usage
I am testing the same script on the following 3 systems:
- Ubuntu 10.04 64bit (RackVM)
- Debian 5 64bit (RackVM)
- Debian 5 32bit (VPSGuy)
They are all showing different memory usage. I am taking the snapshot of memory usage AFTER 10 page loads on the WordPress blog that has been created to ensure PHP process is fully loaded.
Ubuntu 10.04 64bit
root@ubuntu64:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.5 23300 1536 ? Ss 06:58 0:00 init
root 10124 0.0 0.5 23576 1496 ? Ss 07:34 0:00 dropbear -i
root 15742 0.0 0.7 17880 1944 pts/0 Ss 07:35 0:00 -bash
root 15754 0.0 0.4 14960 1084 pts/0 R+ 07:35 0:00 ps aux
root 24290 0.0 0.3 12508 788 ? S 07:22 0:00 /usr/sbin/syslo
root 24524 0.0 0.3 21064 1004 ? Ss 07:22 0:00 cron
root 25689 0.0 0.3 19512 972 ? Ss 07:22 0:00 /usr/sbin/xinet
mysql 26346 0.0 4.2 61812 11248 ? Ssl 07:23 0:00 /usr/sbin/mysql
www-data 27920 0.0 2.6 87768 7048 ? Ss 07:23 0:00 /usr/bin/php-cg
www-data 27922 0.5 15.0 122460 39432 ? S 07:23 0:04 /usr/bin/php-cg
103 30162 0.0 0.3 44356 1000 ? Ss 07:24 0:00 /usr/sbin/exim4
root 30267 0.0 0.3 28104 932 ? Ss 07:24 0:00 nginx: master p
www-data 30268 0.0 0.8 28744 2196 ? S 07:24 0:00 nginx: worker p
root@ubuntu64:~# free
total used free shared buffers cached
Mem: 262144 100500 161644 0 0 0
-/+ buffers/cache: 100500 161644
Swap: 0 0 0
Memory Usage: 98.1MB
Debian 5 64bit
debian64:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.2 10304 740 ? Ss 12:22 0:00 init [2]
106 1414 0.0 0.3 42708 1004 ? Ss 12:26 0:00 /usr/sbin/exim4
www-data 1655 0.0 2.5 72028 6560 ? Ss 12:26 0:00 /usr/bin/php-cg
www-data 1657 0.9 11.7 98500 30928 ? S 12:26 0:03 /usr/bin/php-cg
www-data 3126 0.0 0.7 28380 1912 ? S 12:29 0:00 nginx: worker p
root 7668 0.1 0.5 23340 1528 ? Rs 12:31 0:00 dropbear -i
root 7831 0.0 0.6 17472 1716 pts/0 Ss 12:32 0:00 -bash
root 7836 0.0 0.3 14720 980 pts/0 R+ 12:32 0:00 ps aux
root 20169 0.0 0.3 18540 936 ? Ss 12:22 0:00 /usr/sbin/cron
root 24462 0.0 0.2 12236 732 ? S 12:25 0:00 /usr/sbin/syslo
root 25637 0.0 0.3 19256 952 ? Ss 12:25 0:00 /usr/sbin/xinet
root 25694 0.0 0.5 28380 1552 ? Ss 12:25 0:00 nginx: master p
root 32427 0.0 0.2 3872 588 ? S 12:26 0:00 /bin/sh /usr/bi
mysql 32466 0.0 3.0 50420 8124 ? Sl 12:26 0:00 /usr/sbin/mysql
root 32468 0.0 0.2 3772 592 ? S 12:26 0:00 logger -p daemo
debian64:~# free
total used free shared buffers cached
Mem: 262144 61008 201136 0 0 0
-/+ buffers/cache: 61008 201136
Swap: 0 0 0
Memory Usage: 59.6MB
Debian 5 32bit
debian32:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 1980 688 ? Ss 23:34 0:00 init [2]
root 14064 0.0 0.1 1704 512 ? S 23:52 0:00 /bin/sh /usr/bi
mysql 14119 0.0 1.7 20056 6968 ? Sl 23:52 0:00 /usr/sbin/mysql
root 14120 0.0 0.1 1628 536 ? S 23:52 0:00 logger -p daemo
www-data 15968 0.0 1.2 16352 4996 ? Ss 23:53 0:00 /usr/bin/php-cg
www-data 15971 0.5 4.7 29436 18576 ? S 23:53 0:01 /usr/bin/php-cg
root 16040 0.0 0.3 2700 1464 ? Rs 23:53 0:00 dropbear -i
root 16119 0.0 0.1 1880 684 ? S 23:44 0:00 /usr/sbin/syslo
root 16133 0.0 0.3 2780 1536 pts/0 Ss 23:54 0:00 -bash
root 17728 0.0 0.2 2352 896 ? Ss 23:45 0:00 /usr/sbin/xinet
www-data 17758 0.0 0.3 5004 1488 ? S 23:54 0:00 nginx: worker p
root 27834 0.0 0.3 4548 1236 ? Ss 23:47 0:00 nginx: master p
root 28146 0.0 0.2 2296 896 pts/0 R+ 23:57 0:00 ps aux
102 32065 0.0 0.2 6104 900 ? Ss 23:49 0:00 /usr/sbin/exim4
debian32:~# free
total used free shared buffers cached
Mem: 262144 44272 217872 0 0 0
-/+ buffers/cache: 44272 217872
Swap: 0 0 0
Memory Usage: 43.2MB
So to put that in summary form
- Ubuntu 10.04 uses significantly more memory than Debian 5 (PHP5.3/MySQL5.1 vs. PHP5.2/MySQL5.0). So pick your distro wisely and maybe you don’t need the latest and greatest if your application does not need it.
- 32bit also uses quite a bit less than 64bit, running exactly the same version of stack. That pretty much confirms what I posted before.
And hopefully the above script is useful for your next WordPress splog farm 😛




After having good performance with QuickWeb, I want to move my blog to BuyVM because they have IPv6 working by default.
So, if I visit my IPv4 (209.141.48.45 ), it show’s my blog. But when I visit my IPv6 ( shows2607:f358:0001:fed5:0009:0000:0758:001 ), it shows “It works”.
I am running Debian 5 32bit with BuyVM. Is there something I need to modify to display the blog by visiting my IPv6?
Type “nginx -V” to check if installed version of Nginx supports IPv6. “–with-ipv6” should be under configure arguments, if not you have to recompile Nginx with “–with-ipv6”. Then just add “listen [::]:80 ipv6only=on;” to .conf files in /sites-enabled/.
I am using the default NginX with this script. So maybe it’s the 0.6.32.
Maybe i will just compile it with the new one then.
Thank you 🙂
This could help you: http://kovyrin.net/2010/01/16/enabling-ipv6-support-in-nginx/
Thank you for the link 🙂
I’ve doing some google search, and also found that link.
I am using this script but I can’t get wordpress to connect to wordpress.com with Jetpack plugin.
How could I solve this issue?
Here is an error.
Your website needs to be publicly accessible to use Jetpack: site_inaccessible
Error Details: The Jetpack server was unable to communicate with your site [IXR -32300: transport error: http_request_failed Operation timed out after 15001 milliseconds with 0 bytes received]
Just in case someone has the same problem.
I need to change PHP_FCGI_CHILDREN from 1 to 2 and it solves the problem.
Hey LEB admin, does this website still run with the same 80 MB RAM specified in the post or have you upgraded? Because im planning to buy a VPS & your answer would help me.
No it has been upgraded to 160MB of RAM
I am using this script on Rackapace Cloud Server. I pay about $12.00 a month for 256MB ram.
Once thing i’ve learned is Ubuntu 10.4 with PHP 5.3 is terrible. WordPress has issues and with running W3 Total Cache, my Googlepage speed was down to 79.. Switching back to Deb 5 Lenny, PHP 5.3.6 and Lighttpd with W3 Total Cache, my pagespeed went back up to 98..
I would avoid Ubuntu and php 5.3 unless you really need it. Drupal and other softwares are not fully supporting php5.3 yet from what I read.
Chris
Ick.. I meant Swtiching to Deb 5 with Php 5.2.6 fixed all the issues.. I can’t spell and no edit either.. oOo
Good script to use for WordPress. Consider upgrading Nginx to latest from source.
Script works beautifully! Thank you so much!
How to enable FTP for installation of wordpress themes automatically?
Thanks.
Try installing libssh2-php, reload php-cgi and use SSH rather than clear text FTP to install plugins / themes automatically
Is PhpMYadmin not necessary?I dont see it mentioned here.
Also how to update the nginx or other packages after installing this script?
Would request you to post an updated version, as many seem to use this script.
phpMyAdmin is not necessary as it can be installed after you use this installation script with “apt-get install phpmyadmin”
You update the packages and nginx by using the update command within your operating system since it uses operating system packages, not compiling from source. If you are using a Debian or Debian based Linux operating system like Ubuntu, you do this with
apt-get update && apt-get dist-upgrade -y
This will fetch the updates and see if your distribution needs an upgrade.
Here are some configurations I found for php-cgi to use standard rewriting, or to use Super Cache or W3 Total Chace as well. http://kbeezie.com/view/nginx-configuration-examples/
Saving that link NOW!
Probably I will need to move a big wp from Apache
Here are some more low resource usage scripts with up to date software for CentOS.
http://centminmod.com/
Centminmod is based on the script by btcentral below.
http://www.btcentral.org.uk/projects/centmin/
Chris
ok, that’s all great, but no one did not said if he/she is actualy using this, and how much visitors per day could 128 MB RAM VPS take before it goes into serious problems? If someone yould answer that… Thanks 🙂
It really depends on what you’re running.
Hi, just one wordpress instalation with 2 simple plugins, and firewall plugin
Ok, and from which provider?
On WordPress on a really slow vps (1 Pagegeneration per second) you could have about 60k – 80k hits per day… I think that is more than enough!
OMG, i didn’t think that this is possible. I will definitely give it a try. Thanks.
Ahm, that is possible! And that is only for the badest vps I ever had…
If you want more details for optimazing & co, give me a mail address 🙂
I was looking at http://buyvm.net/ i was told that they ere reliable
Hmm, they’re mostly okay – but I never tested a wordpress performance check on them.
I would take one from Edis, XenVZ, or SecuredSpeed – the problem on buyvm is that you will have problems to order one… 😛
Yes, i saw that they are out of stock, i’ll wait, or i will look for other cheap VPS
Write me a private Message on LowendTalk, maybe I could do something for you 😉
-> http://www.lowendtalk.com/profile/Amfy
is there any installation guide for beginner, like me. it’s so difficult
Thanks a lot for this ! Everything worked out fine on debian6. I only had to chown -R the /var/run/www/site-name after because it seems it didn’t work at the set up.
Am getting only “Welcome to nginx!” on index, and 404 on wp-admin.
But on the same VPS, I had installed WP with this script successfully on the same OS (32bit Debian and Ubuntu). Since it is only 4 commands, I can’t seem to figure out what exactly I did differently. Perhaps something on the provider’s side has changed.
Any pointers on how to fix it?
i’m facing an issue, after bash setup-debian.sh wordpress blog.example.com i opened blog.example.com on Browser and its loading blog.example.com/wp-admin/install.php
After that i installed phpmyadmin using apt-get install phpmyadmin
Now when i’m loading host.name.com/phpmyadmin or server.ip/phpmyadmin its redirecting to host.name.com/wp-admin/install.php to the url and giving error Oops! This link appears to be broken.
though host.name.com is loading “Welcome to nginx!” correctly.
any ideas?
Set up fine, however I have an issue with having more than one domain on my VPS.
bash setup-debian.sh wordpress domain1.com
That works, and when I visit “domain1.com” it works. When I visit the IP address of my server directly, I also see the content for ‘domain1.com’
bash setup-debian.sh wordpress domain2.com
I just added this domain, but when I visit it I only see the content from domain1.com. I can confirm that /var/www/domain2.com has been created.
I’m using Cloudflare for my DNS, if it matters. What do I need to do to my vps config so that I can have more than 1 site hosted on it?
I’m running that command to create 3 domain hosted in a BlueVM VPS and it works.
Maybe your problem is with the CloudFlare. You can try to disable it and try to visit it again.
If I disable Cloudflare, how would I access the site? I use Cloudflare for my DNS.
Create an A record for your domain to your VPS IP.
Ah, it just started working all of a sudden. But now I have another issue.
I’m not using the second domain for a WP blog, it’s for a static html site. I just set it up with this script as it was easy, and I can just remove the WP files after. I removed the index.php page as a test, and replaced it with my own index.html page.
http://www.domain2.com returns an Nginx error. http://www.domain2.com/index.html shows my page. Why is that? I looked at the nginx.conf file as well as the .conf file located within /etc/nginx/sites-enabled/ dir but I can’t seem to get it to load index.html files.
@CM, try the ‘/sites-available/default’ or /sites-enabled/default’.
There should be a block labeled ‘location / { }’. Make sure index contains index.html.
For Debian 6 Need to :
mkdir /var/www
then after installation
chown -R www-data.www-data /var/www/{Name of wp}
You can grab an updated fork for Debian 6.
Works very well on BuyVM’s Debian 6 template.
Please read the readme file before installing.
@Simplyfast
How do I get phpmyadmin to work with that? When I install with apt-get install phpmyadmin, I get prompted to use apache2 or lighttpd.
This setup works very, very well.
Just rolled it out to 5 different servers.
Thank you for the great work.
Here’s result on my SSD VPS, 256 MB, Debian 6 32bit
root@1811:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.2 2028 724 ? Ss 04:39 0:00 init [2] root 2 0.0 0.0 0 0 ? S 04:39 0:00 [kthreadd/111] root 3 0.0 0.0 0 0 ? S 04:39 0:00 [khelper/111] www-data 369 0.0 2.1 30480 5724 ? Ss 04:39 0:00 /usr/bin/php-cg root 380 0.0 0.3 1972 788 ? S 04:39 0:00 /usr/sbin/syslo root 386 0.0 0.3 8668 804 ? Ss 04:39 0:00 /usr/sbin/sasla root 387 0.0 0.1 8668 380 ? S 04:39 0:00 /usr/sbin/sasla www-data 394 0.0 0.7 30480 2072 ? S 04:39 0:00 /usr/bin/php-cg root 440 0.0 0.3 2288 860 ? Ss 04:39 0:00 /usr/sbin/cron root 445 0.0 0.2 5024 716 ? Ss 04:39 0:00 nginx: master p www-data 446 0.0 0.5 5196 1496 ? S 04:39 0:00 nginx: worker p root 474 0.0 0.3 2392 912 ? Ss 04:39 0:00 /usr/sbin/xinet root 479 0.0 0.2 1744 544 ? S 04:39 0:00 /bin/sh /usr/bi mysql 599 0.0 2.8 31720 7596 ? Sl 04:39 0:00 /usr/sbin/mysql root 600 0.0 0.2 1668 564 ? S 04:39 0:00 logger -t mysql root 690 0.5 0.4 2400 1152 ? Ss 04:41 0:00 dropbear -i root 691 0.0 0.6 2960 1608 pts/0 Ss 04:41 0:00 -bash root 695 0.0 0.3 2348 932 pts/0 R+ 04:41 0:00 ps aux root@1811:~# free total used free shared buffers cached Mem: 262144 26012 236132 0 0 15996 -/+ buffers/cache: 10016 252128 Swap: 0 0 0It would be nice to see this script using PHP-FPM instead of PHP-CGI..
I coded a Bash script that uses dialog for the selection of packages, kind of tasksel but fully tweaked.
It works with either Ubuntu or Debian. If anyone wants to have a look, it’s available at GitHub.
This is amazing … I’m using it on a 2gb vps that was just provisioned in LA and it is almost done. Can I please ask if you can add more utils to it like Drupal / WordPress / Joomla / ffmpeg. Thank you.
I can’t use this script on Godaddy Cloud Server.
Once you have the vps all set up, I would suggest setting up a free monitoring tool such as Got Site Monitor to keep an eye on the performance and uptime of your vps.
Awesome!.
Works perfecly for me, in a 128MB RAM VPS that was getting me crazy with apache and mysql.
Thanks a lot.
Amazing!
Thank you very much for sharing your scripts?
I couldn’t figure out how to make it work on my 128 vps.
With your script and debian 6 vps openvz it worked!
Before mysql was always crashing badly (not enough memory allocation)
Perfect now because of you
Thanx again
Thank you, your script is very useful!
is this working in Ubuntu 12.04?
i get mysql error
thanks a lot
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
$- service mysql start
start: Job failed to start
Hi.
The syntax for disabling innodb (used in this script) is deprecated.
There is an easy fix for this though:
1. Open /etc/mysql/my.cnf in your favorite text editor. In my case,
# vim /etc/mysql/my.cnf2. Find and remove “skip-innodb” and replace it with
innodb=OFFdefault_storage_engine=MyISAM3. Restart the mysql service.
# service mysql restartI found this fix here at ServerFault. This also solves the “Starting MySQL database server: mysqld” error.
Hope I helped someone (even after a year has passed!)
Correction:
In your /etc/mysql/my.cnf file,
Find and remove “skip-innodb” and replace it with
innodb=OFFdefault_storage_engine=MyISAMfailed in bash setup-debian.sh mysql
mySQL not running
invoke-rc.d mysql start
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
invoke-rc.d: initscript mysql, action "start" failed.
1. cd /usr/bin/
2. sudo ./mysql_install_db
Hi,
I used this script to set up my 256 VPS. I modified the script to not install dropbear as I have had trouble with it in the past. That’s not really related to my question though.
I have two problems.
Currently I have nginx up and running fine for serving static pages. However, PHP isn’t working. When I try to access a php file it just shows the plain text of the php file.
Secondly if I try to access a subdirectory from my web root it does something weird where it redirects to localhost. For example: if I try to access example.com with an index.html in the web root it works fine.If I try to access, say, example.com/dir1 which also has an index.html inside my browser shows it redirecting to localhost/dir1.
Any help would be appreciated.
/etc/nginx/sites-available/default : http://pastebin.com/7Le0SjBa
/etc/nginx/nginx.conf : http://pastebin.com/pSUEKmkB
Any help would be immensely appreciated!
Oh, I’m on Debian 6 if that is relevant.
How to change the domain”blog.example.com” to another domain? And I run /etc/nginx/sites-enabled/domain.com.conf,it say”..line 1: server: command not found” and more command not found info.Thx!
Great beat ! I would like to apprentice even as you amend your web site, how can i subscribe for a weblog site?
The account aided me a acceptable deal. I have been tiny bit
acquainted of this your broadcast provided vivid transparent idea
Do you mind if I quote a few of your articles as long as I provide credit and sources back to your weblog?
My blog site is in the very same niche as yours and my visitors would truly benefit from a lot of the information you present here.
Please let me know if this ok with you. Many thanks!
Have some package changes stopped this script working?
seeing issues with Mysql on Debian 5, 6 and Ubuntu.
# bash setup-debian.sh mysql
mysql-server already installed
mysql-client already installed
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’
Mysql 5.5+ needs this added in setup-debian.sh, in the “install_mysql” function where it creates “/etc/mysql/conf.d/lowendbox.cnf”
default-storage-engine = myisam
Just add it before the “END”, so it looks like this:
function install_mysql {
# Install the MySQL packages
check_install mysqld mysql-server
check_install mysql mysql-client
# Install a low-end copy of the my.cnf to disable InnoDB, and then delete
# all the related files.
invoke-rc.d mysql stop
rm -f /var/lib/mysql/ib*
cat > /etc/mysql/conf.d/lowendbox.cnf <<END
[mysqld]
key_buffer = 8M
query_cache_size = 0
skip-innodb
default-storage-engine = myisam
END
invoke-rc.d mysql start
# Generating a new password for the root user.
passwd=`get_password root@mysql`
mysqladmin password "$passwd"
This may need a way to clear the permissions too, because setting the password isn’t working further down the line. I ended up just rebuilding the VPS, since I was merely testing this out on a new one.
Hi there, yes this post is in fact nice and I have learned lot of things from it on the topic of blogging. thanks.
Hi,
Many thanks for script!
Can you recommend some easy to install script that will set basic security on server, like changing SSH port, removing SSH root access, tmp, etc..all other steps that are usually set for security.
2nd question:
What wordpress cashing setup do you use on lowendbox WordPress/Nginx/PHP/MySQL.
And does this site lowendbox run on the same setup like this script?
Anybody please?
Can owner of this site share his wordpress setup please?
u can check my blog
I have learned lot of things from it on the topic of blogging. thanks.
It’s actually a great and helpful piece of info. I am glad that you shared this useful info with us. Please keep us up to date like this. Thanks for sharing.