OpenVZ 설치 · 3 min read · Jan 17, 2026

CentOS 5.2에서 OpenVZ 설치 및 사용

CentOS 5.2에서 OpenVZ 설치 및 사용

버전 1.0
저자: Falko Timme

이 HowTo에서는 CentOS 5.2 서버를 OpenVZ에 맞게 준비하는 방법을 설명합니다. OpenVZ를 사용하면 Xen 및 Linux Vserver 프로젝트와 유사하게 동일한 하드웨어에서 여러 개의 가상 사설 서버(VPS)를 생성할 수 있습니다. OpenVZ는 많은 가상 서버를 제공하는 공급업체에서 사용하는 상업적 가상화 솔루션인 Virtuozzo의 오픈 소스 분기입니다. OpenVZ 커널 패치는 GPL 라이센스 하에 라이센스가 부여되며, 사용자 수준 도구는 QPL 라이센스 하에 있습니다.

이 문서는 실용적인 가이드를 목적으로 하며, 이론적 배경은 다루지 않습니다. 이론적 배경은 웹의 많은 다른 문서에서 다루어집니다.

이 문서는 어떤 종류의 보증 없이 제공됩니다! 이는 이러한 시스템을 설정하는 유일한 방법이 아님을 말씀드리고 싶습니다. 이 목표를 달성하는 방법은 여러 가지가 있지만, 이것이 제가 선택한 방법입니다. 이것이 여러분에게 작동할 것이라는 보증을 제공하지 않습니다!

1 OpenVZ 설치하기

OpenVZ를 설치하기 위해 yum에 OpenVZ 저장소를 추가해야 합니다:

cd /etc/yum.repos.d  
wget http://download.openvz.org/openvz.repo  
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

저장소에는 몇 가지 다른 OpenVZ 커널이 포함되어 있습니다(자세한 내용은 여기에서 확인할 수 있습니다: http://wiki.openvz.org/Kernel_flavors). 명령어

yum search ovzkernel

은 사용 가능한 커널을 보여줍니다:

[root@server1 yum.repos.d]# yum search ovzkernel  
Loading "fastestmirror" plugin  
Loading mirror speeds from cached hostfile  
 * base: ftp.halifax.rwth-aachen.de  
 * openvz-kernel-rhel5: openvz.proserve.nl  
 * updates: ftp.halifax.rwth-aachen.de  
 * addons: ftp.halifax.rwth-aachen.de  
 * openvz-utils: openvz.proserve.nl  
 * extras: ftp.halifax.rwth-aachen.de  
openvz-kernel-rhel5       100% |=========================|  951 B    00:00  
primary.xml.gz            100% |=========================|  22 kB    00:00  
openvz-ker: ################################################## 14/14  
openvz-utils              100% |=========================|  951 B    00:00  
primary.xml.gz            100% |=========================| 6.7 kB    00:00  
openvz-uti: ################################################## 26/26  
ovzkernel-ent.i686 : The Linux kernel compiled for huge mem capable machines.  
ovzkernel-PAE.i686 : The Linux kernel compiled for PAE capable machines.  
ovzkernel-ent-devel.i686 : Development package for building kernel modules to match the ent kernel.  
ovzkernel-PAE-devel.i686 : Development package for building kernel modules to match the PAE kernel.  
ovzkernel.i686 : Virtuozzo Linux kernel (the core of the Linux operating system)  
ovzkernel-xen.i686 : The Linux kernel compiled for Xen VM operations  
ovzkernel-xen-devel.i686 : Development package for building kernel modules to match the kernel.  
ovzkernel-devel.i686 : Development package for building kernel modules to match the kernel.  
[root@server1 yum.repos.d]#

그 중 하나를 선택하여 다음과 같이 설치합니다:

yum install ovzkernel

이것은 GRUB 부트로더를 자동으로 업데이트해야 합니다. 어쨌든 /boot/grub/menu.lst를 열어야 합니다. 첫 번째 커널 스탠자가 이제 새로운 OpenVZ 커널을 포함해야 합니다. 해당 커널의 제목은 “CentOS”로 표시됩니다. 이 제목을 변경하고 “OpenVZ”라는 내용을 추가하는 것이 좋습니다. 이렇게 하면 OpenVZ 커널임을 알 수 있습니다. 또한 기본값이 0으로 설정되어 있는지 확인하여 첫 번째 커널(즉, OpenVZ 커널)이 기본 CentOS 커널 대신 자동으로 부팅되도록 합니다.

vi /boot/grub/menu.lst

| # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS OpenVZ (2.6.18-53.1.19.el5.028stab053.14) root (hd0,0) kernel /vmlinuz-2.6.18-53.1.19.el5.028stab053.14 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-53.1.19.el5.028stab053.14.img title CentOS (2.6.18-92.1.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-92.1.1.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-92.1.1.el5.img title CentOS (2.6.18-92.el5) root (hd0,0) kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-92.el5.img |

이제 OpenVZ 사용자 도구를 설치합니다:

yum install vzctl vzquota

/etc/sysctl.conf를 열고 다음 설정이 포함되어 있는지 확인합니다:

vi /etc/sysctl.conf

| [...] net.ipv4.ip_forward = 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 net.ipv4.icmp_echo_ignore_broadcasts=1 net.ipv4.conf.default.forwarding=1 [...] |

/etc/sysctl.conf를 수정해야 하는 경우, 이후에 다음을 실행합니다:

sysctl -p

다음 단계는 가상 머신의 IP 주소가 호스트 시스템의 IP 주소와 다른 서브넷에 있는 경우 중요합니다. 이를 수행하지 않으면 가상 머신에서 네트워킹이 작동하지 않습니다!

/etc/vz/vz.conf를 열고 NEIGHBOUR_DEVS를 all로 설정합니다:

vi /etc/vz/vz.conf

| [...] NEIGHBOUR_DEVS=all [...] |

OpenVZ를 사용하려면 SELinux를 비활성화해야 합니다. /etc/sysconfig/selinux를 열고 SELINUX의 값을 disabled로 설정합니다:

vi /etc/sysconfig/selinux

| # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted |

마지막으로 시스템을 재부팅합니다:

reboot

시스템이 문제 없이 재부팅되면 모든 것이 정상입니다!

다음 명령어를 실행합니다:

uname -r

그리고 새로운 OpenVZ 커널이 표시되어야 합니다:

[root@server1 ~]# uname -r  
2.6.18-53.1.19.el5.028stab053.14  
[root@server1 ~]#
Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.