Many people are learning Linux. We can see that Linux is becoming more and more important. Do you know about Linux? Are you an application of Linux? This article describes how to configure OPENVZ in Linux.
1. Download the Installation File
According to your kernel version here: http://openvz.org/download/kernel/ download.
# Rpm-ihv vzkernel-name *. rpm
2. Modify the grub. conf file
- title OpenVZ (2.6.8-022stab029.1) root (hd0,0) kernel
- /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 initrd /initrd-2.6.8-022stab029.1.img
3. Modify the etc/sysyctl. conf file:
- /etc/sysctl.conf:
- # On Hardware Node we generally need
- # packet forwarding enabled and proxy arp disabled
- net.ipv4.ip_forward = 1
- net.ipv4.conf.default.proxy_arp = 0
- # Enables source route verification
- net.ipv4.conf.all.rp_filter = 1
- # Enables the magic-sysrq
- key kernel.sysrq = 1
- #net.ipv4.tcp_ecn = 0
- # we do not want all our interfaces to send redirects
- net.ipv4.conf.default.send_redirects = 1
4. If you have run iptables firewall and SELinux, disable and disable it first.
Edit/etc/sysconfig/selinux:
SELINUX = disabled.
Disable the iptables firewall.
5. Install OpenVZ Management Software
Depending on your version here: http://openvz.org/download/utils/ download.
# Rpm-Uhv vzctl *. rpm vzquota *. rpm vzpkg *. rpm
6. Restart VZ
#/Etc/init. d/vz start
7. Install the Template
- # rpm –ihv vztmpl-fedora-core-3-1.0-2.noarch.rpm
- # vzpkgcache
- Creating cache for fedora-core-3 OS template
- Setting up install process
- Packing cache file fedora-core-3.tar.gz ...
- Cache file fedora-core-3.tar.gz [130M] created.
8. Create a non-zero ID for the Virtual Server
- # vzctl create 101
- Creating VPS private area: /vz/private/101
- VPS is mounted
- Postcreate action done
- VPS is unmounted
- VPS private area was created
9. Set the parameter to zero.
- # vzctl set 101 --hostname test101.my.org --save
- Hostname for VPS set: test101.my.org
- Saved parameters for VPS 101
- # vzctl set 101 --ipadd 10.0.186.1 --save
- Adding IP address(es): 10.0.186.1
- Saved parameters for VPS 101
- # vzctl set 101 --nameserver 192.168.1.165 --save
- File resolv.conf was modified
- Saved parameters for VPS 101
10. Set the root user password
# Vzctl set 101 -- userpasswd root: test
11. Start the SSH daemon
# Vzctl exec 101 service sshd start
12. Start VPS
- # vzctl start 101
- Starting VPS ...
- VPS is mounted
- Adding IP address(es): 10.0.186.101 Hostname for VPS 101 set: test.my.org
- VPS start in progress...
13. Load the Firewall
The firewall that was previously disabled must be loaded for security reasons.
- # vzctl set 101 --iptables iptable_filter
- --iptables ipt_length --iptables ipt_limit
- --iptables iptable_mangle --iptables ipt_REJECT --save
We hope OPENVZ configuration in Linux will be helpful to you.
- Analysis of Open-source Cisco router virtual machines in Linux
- 30 Linux releases
- Learning Experience: Linux File lock
- Linux Extension File System
- Easily create a file system in Linux