OpenVZ is a container-based virtualization solution for Linux that allows you to run multiple isolated virtual private servers (VPS) on a single physical host. It’s known for its low overhead and high performance. This guide provides a complete, sequential walkthrough of the entire process.

Prerequisites

  • A host server running Debian, Ubuntu, or CentOS.

  • Root or sudo access to the host server.

Step 1: Install OpenVZ on the Host Server

First, you need to install the OpenVZ command-line tools on your main server. These tools are required to create and manage your VPS containers.

  • On Debian or Ubuntu:
    In your terminal, run sudo apt update followed by sudo apt install -y vzctl vzquota.

  • On CentOS:
    In your terminal, run sudo yum install -y epel-release and then sudo yum install -y vzctl vzquota.

Step 2: Download an OpenVZ OS Template

Next, you must download a pre-created OS template. This template is the minimal operating system that your new VPS will run.

  1. Choose a template from the Official OpenVZ Repository.

  2. Use the wget command to download it. For example, to get the Ubuntu 20.04 template, run the command: wget http://download.openvz.org/template/precreated/ubuntu-20.04-x86_64.tar.gz

Step 3: Create the VPS Container

Now, use the vzctl command to create the container. You will need to replace the placeholder values below with your specific details.

  • VPS_ID: A unique number for the VPS (e.g., 101).

  • OS_TEMPLATE: The name of the file you downloaded (e.g., ubuntu-20.04-x86_64).

  • VPS_HOSTNAME: The desired hostname (e.g., server1.example.com).

  • VPS_IP_ADDRESS: The static IP address for the VPS.

  • DNS_IP_ADDRESS: A DNS server address (e.g., 8.8.8.8).

Run the following command with your values filled in:
vzctl create VPS_ID –ostemplate OS_TEMPLATE –hostname VPS_HOSTNAME –ipadd VPS_IP_ADDRESS –nameserver DNS_IP_ADDRESS –onboot yes

Step 4: Set the Root Password

Your VPS container has been created, but it needs a root password before you can log in.

  • Use the vzctl set command to assign a new password. Replace VPS_ID and NEW_ROOT_PASSWORD with your information by running:
    vzctl set VPS_ID –userpasswd root:NEW_ROOT_PASSWORD –save

Step 5: Start the VPS

With the configuration complete, you can now start your VPS.

  • To start your VPS, run the command:
    vzctl start VPS_ID

Step 6: Access and Configure Your VPS

Your VPS is now running. The final steps involve logging in and performing initial setup.

  1. Access the VPS via SSH:
    Use an SSH client to connect to your VPS by running the command ssh root@YOUR_VPS_IP_ADDRESS and using the root password you configured.

  2. Enter the VPS (Alternative to SSH):
    From the host server, you can directly enter the container’s command line by running vzctl enter VPS_ID.

  3. Update Your VPS Software:
    Once inside your new VPS, it is crucial to update all its packages.

    • On Debian/Ubuntu, run apt update && apt upgrade -y.

    • On CentOS, run yum update -y.

  4. Install Additional Software:
    You can now install any software you need, such as a web server or database.

 

Conclusion: 

You have successfully created and launched a VPS with OpenVZ. Remember to keep your new VPS updated and configure security measures like a firewall (ufw or firewalld) to ensure a secure environment.

Read more information about Connecting to Windows VPS Using Different OS and Remote Desktop

Share:

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

What Did the DDoS Attack on Apache Appear Like?

If you’re curious about how DDoS attacks work, you’ve come to the correct place. Here,…

How To Install A New Theme In WordPress

Installing a new theme in WordPress is a straightforward process. Here’s a step-by-step guide: Log…

Dirty Cow Vulnerability – Check How Dirty It Is?

Dirty cow vulnerability mainly affects major Linux Operating Systems. Below is the impact of this…