Setting up a simple Web/Mail Server in OpenVZ

Here are the steps I continue to use over and over to build utilities/project servers in OpenVZ. Utilities servers host web apps, mailing applications, etc for my company. We usually build them as self-contained little appliance-like servers. My vision and goal is simple == better every day!

First, we create the virtual machine:

cd /vz/template/cache/
vzctl create ${cid} --ostemplate centos-5-x86_64 --config vps.basic
vzctl set ${cid} --hostname [HOSTNAMEHERE] --save
vzctl set ${cid} --ipadd [IP] --save
vzctl set ${cid} --nameserver [IP] --save
vzctl start ${cid}
vzctl exec ${cid} passwd
vzctl enter ${cid}

Now that we are in the virtual machine and away from the HN we add the REMI repo and apply the updates directly on the box.

rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
/bin/rm epel-release-5-3.noarch.rpm remi-release-5.rpm

yum --enablerepo remi -y update
yum --enablerepo remi -y install httpd php php-devel php-pear php-gd php-xsl php-mbstring php-mcrypt php-mysql mysql

Add Postfix and switch it on via system-switch-mail

yum --enablerepo remi -y install postfix system-switch-mail

Now… customer configurations and setups…

[ php ]