Post

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:

1
2
3
4
5
6
7
8
9
10
cid=1164
cd /vz/template/cache/
wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz
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.

1
2
3
4
5
6
7
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
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

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

Now… customer configurations and setups…

This post is licensed under CC BY 4.0 by the author.