Nov
29
Creating a minimal LAMP stack in OpenVZ:
Start with a pre-created centos-5 OpenVZ template & install required packages:
# Create centos-5 OpenVZ container: vzctl create 1056 --ostemplate centos-5-x86_64-minimal vzctl set 1056 --ipadd 192.168.0.56 --nameserver 123.123.123.123 --save vzctl start 1056 # Update software & install packages: vzctl 1056 install yum vzctl enter 1056 yum upgrade # Install packages -- the ".x86_64" tells yum to only # install the 64-bit packages and not the i386 packages. yum install vim-enhanced.x86_64 mysql.x86_64 mysql-server.x86_64 \ httpd.x86_64 httpd-devel.x86_64 wget.x86_64 which.x86_64 \ php.x86_64 make.x86_64 gcc.x86_64 gcc-c++.x86_64 # Clean up leftover files from yum: yum clean all
Next, tune Apache to fit our development 256MB OpenVZ container. If you have more memory dedicated to your container, consider increasing these settings. Edit the prefork MPM section of /etc/httpd/conf/httpd.conf:
<span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;"><</span>IfModule prefork.c<span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;">></span> StartServers 2 MinSpareServers 1 MaxSpareServers 8 ServerLimit 8 MaxClients 8 MaxRequestsPerChild 4000 <span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;"><span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;"></span></span></IfModul<span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;"><span class="__mozilla-findbar-search" style="padding: 0pt; background-color: white; color: black; display: inline; font-size: inherit;">e></span></span>
Let’s lock down the MySQL root user before starting up services:
mysql -u root mysql
mysql> update user set password=password('mynewsecurepassword') \
where user='root';
mysql> flush privileges;
mysql> exit
Start services and ensure that services start when the machine boots up:
chkconfig --levels 345 httpd chkconfig --levels 345 mysqld service httpd start service mysqld start
Finally: test!
This will give you a slimmed down LAMP stack, suitable for running small web applications on top.
[...] maxgarrick.com » How to create a minimal LAMP stack in OpenVZ – May 29th ( tags: lamp openvz tuning apache mysql ) June 1st, 2009 | Tags: links | Category: delicious links | Comments are closed | | 0 views [...]