Home Technical ArticlesHow to Set Up a VPS on Debian Using OpenVZ | Step-by-Step Guide

How to Set Up a VPS on Debian Using OpenVZ | Step-by-Step Guide

by SupportPRO Admin
How to Set Up a VPS on Debian

Creating a Virtual Private Server (VPS) using OpenVZ allows administrators to deploy lightweight virtual environments quickly and efficiently. This guide explains how to create, configure, and manage a Debian VPS, install Apache, PHP, MySQL, and deploy phpBB.

Create a Debian VPS Using OpenVZ

OpenVZ templates are typically stored in:

/vz/template/cache/

Create a new VPS using the Debian minimal template:

vzctl create 157 --ostemplate debian-5.0-i386-minimal --config vps.basic

Important:
Each VPS requires a unique container ID. Here, 157 is used as an example.

Configure VPS Startup

Enable automatic startup at system boot:

vzctl set 157 --onboot yes --save

Set Hostname and IP Address

Assign hostname:

vzctl set 157 --hostname debian.server.com --save

Assign IP address:

vzctl set 157 --ipadd 192.168.0.157 --save

Configure Network and Resources

Set socket limits:

vzctl set 157 --numothersock 120 --save

Add DNS nameservers:

vzctl set 157 --nameserver 4.2.2.2 --nameserver 4.2.2.3 --save

Alternatively, edit the container configuration file directly:

/etc/vz/conf/157.conf

Start and Access the VPS

Start the container:

vzctl start 157

Set the root password:

vzctl exec 157 passwd

Enter the VPS console:

vzctl enter 157

Exit the container:

exit

Manage VPS Lifecycle

Stop VPS:

vzctl stop 157

Restart VPS:

vzctl restart 157

Delete VPS (must be stopped first):

vzctl destroy 157

List all containers:

vzlist -a

Install Apache, PHP, and MySQL on Debian

Enter the VPS:

vzctl enter 157

Update Package Sources

Edit repository list:

pico /etc/apt/sources.list

Add:

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all

Update packages:

apt-get update

Install PHP

apt-get install php5

Install additional PHP modules:

apt-get install libapache2-mod-php5 php5-cli php5-common php5-curl php5-gd php5-imap php5-ldap php5-mysql php5-pear php5-xslt

Restart Apache:

/etc/init.d/apache2 restart

Test PHP Installation

Create a test file:

pico /var/www/info.php

Add:

<?php phpinfo(); ?>

Open in browser:

http://SERVER-IP/info.php

This displays PHP configuration details.

Install MySQL Server

Install MySQL packages:

aptitude install mysql-server mysql-client

Set a password for the MySQL root user during installation.

Install phpBB Forum on Debian VPS

Download phpBB:

wget http://sourceforge.net/projects/phpbb/files/phpBB%203/phpBB%203.0.5/phpBB-3.0.5.zip/download

Extract files:

unzip phpBB-3.0.5.zip

Move files to web directory:

/var/www/phpBB3

Open installation page:

http://192.168.0.157/phpBB3/install/install_main.php

Follow the on-screen installation steps.

Create phpBB Database

Login to MySQL:

mysql -u root -p

Create database and user:

CREATE DATABASE vinetforum;
GRANT ALL ON *.* TO 'vinetblogs'@'localhost' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES;

Use these details during phpBB setup:

  • Database Name: vinetforum
  • Username: vinetblogs
  • Password: yourpassword

After installation, access the forum at:

http://192.168.0.157

Conclusion

Setting up a Debian VPS using OpenVZ provides a fast and efficient way to deploy virtual environments. With Apache, PHP, MySQL, and phpBB installed, your server becomes a fully functional web hosting platform ready for applications and online communities.

If you require help, contact SupportPRO Server Admin

Facing issues?

Our technical support
engineers can solve it.

Contact Us today!
guy server checkup

You may also like

Leave a Comment