Here are the steps to installing the OpenVZ kernel on CentOS 7.
1. First, install the OpenVZ YUM repository:
- To do this, create a file named openvz.repo in your /etc/yum.repos.d/ directory. You can use a text editor such as vi to do this.
- Add the following lines to this file:
```
[openvz]
name=OpenVZ Repository
baseurl=http://download.openvz.org/openvz.repo
enabled=1
gpgcheck=1
gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ
```
1. Install OpenVZ kernel and tools:
- Run the command `yum update -y` to update your system.
- After updating, you can install the OpenVZ kernel by running `yum install vzkernel` and the OpenVZ utilities by running `yum install vzctl vzquota ploop`.
1. Configure your system:
- Open the file /etc/sysctl.conf in your text editor.
- Add the following lines to this file:
```
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
```
1. Configure SELinux:
- Open the file /etc/sysconfig/selinux in your text editor.
- Change the SELINUX line to SELINUX=disabled.
- This will disable SELinux. Note that this will require a restart.
1. Install additional required utilities:
- Run command `yum install -y vzctl vzquota`
1. Restart your system:
- You can use the command `reboot` to restart your system.
- After restarting, you can confirm that the OpenVZ kernel is running with the `uname -a` command.
If everything went as planned, you should be running on the OpenVZ kernel and ready to create virtual environments.
Please note: OpenVZ will no longer be maintained and it highly recommended to use Virtuozzo 7 which is a Hyperconverged solution with Compute, Storage, Networking and Management from the same box.