LEMP (Linux/Nginx/MySQL/PHP) Installer
After 2 days of work, lemp-installer version 0.1 is out.
Okay, i had been setting up quite a few virtual box, mainly Ubuntu based, for my development work or testing. And its not that fun to keep repeating the same process of compiling php and nginx, not to mention the configuration part.
So i wrote this simple script to help automate some of the processes. By running this script, you get a simple but fully working, light weight web server as well as mysql database. It’s great for people just want to try out nginx, as it’s getting popular but probably there are still people have not heard about it, or heard about it but have not tried it. And I hope this script may help to close the gap a bit.
DISCLAIMER !
- The script is provided “as is”. There is no support or warranty that i am providing.
- I am not responsible for any damage that may happens on your system. you had been warned.
- The script is released under GPL, so just grab it and modify if you like. Send me suggestion or patches and we can make it better together.
Also, I am no bash/shell script expert, so at this stage of the script, altho usable, is not very refined and flexible. If I have time I will improve as I go along.
Credits
Before going on to the juice of this post, a little credit first.
The script is largely base on some recipes / tutorials I found on the internet. Most importantly this one from InterfaceLab Blog: NGINX + PHP-FPM + APC = Awesome
Feel free to visit it if you want to understand the script better.
Pre-Requisite
I tested the script on Ubuntu server JJ / 9.04. But 8.04 should works fine too. Other ubuntu based linux distro should work also, altho I have not tested them. I would like to know if you tried them on say Xubuntu or Kubuntu.
I strongly recommend you to run the script in a fresh install, like under a virtual box. If not, at least make sure you do NOT have php, nginx already installed. At the moment the script is not smart enough to resolve any conflict yet.
What do you get after installation
- PHP 5.2.8 patched with php-fpm for FastCGI
- Nginx 0.7.61
- MySQL thru apt-get (exact version depends on your repository configuration)
- Memcache server
- PHP Extension Compiled in: bz2, cgi-fcgi, ctype, curl, date, dom, filter, gd, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, openssl, pcntl, pcre, pgsql, posix, session, SimpleXML, sockets, SPL, SQLite, tokenizer, xml, xmlreader, xmlwriter, zip, zlib
- PHP Extension Modules: Memcache, APC, Syck
- Phpmyadmin 3.2.2 English
If you want to change the Php, nginx version, or PHP modules that you want to add/remove, you can modify the script (lemp-installer.sh) to do so.
Download
Just get it here http://dl.getdropbox.com/u/768270/recipes/lemp-installer-0.1.tar.gz
Running the Installer Script
Goto the folder where you downloaded the tar.gz file. In your bash shell, type this:
tar zxvf lemp-installer-0.1.tar.gz cd lemp-installer-0.1 ./lemp-installer.sh
That’s it !
NOTE: You might be prompted to enter your sudo password a few times. You will also be prompted during installation of mysql server for the database master password.
Where to GO from here
I am sure you will want to configure/customize the web server to your need, to do so, go to these folders:
- Php – /etc/php
- Nginx – /etc/nginx
- Web Sites – /etc/sites
I also listed some resources here for your reference:
- PHP – www.php.net
- Php-Fpm – http://php-fpm.org/Main_Page
- Nginx – http://nginx.net/
- Nginx wiki – http://wiki.nginx.org/
And remember, Google is your friend :p
With that, have fun running the script and playing with nginx
Great script, makes installation very easy. Thanks alot!
btw, it wont work on debian 5.0
sudo: php-fpm: command not found
@Charlie
Thx for trying out and also for the feedback !
base on the error you show me, it seems
- you had installed the files, but your php-fpm folder is not in path variable
- or the script failed to install
If it is the first case, try changing start_nginx script to include full path.
Change
sudo php-fpm start
to
sudo /usr/local/sbin/php-fpm start
If it’s second case, its a bit tricky as there is thousand and one reason why the script failed to install.
I can help to take a look if you can give me more feedback.
php-fpm didnt install.
sudo: /usr/local/sbin/php-fpm: command not found
Seems like quiet a bit of work to manually remove and erase all the stuff the installer fetched/installed.
Running cherokee now instead.