Difference between revisions of "Instalasi OpenVZ di CentOS 5"
Adinugroho (talk | contribs) |
Adinugroho (talk | contribs) |
||
Line 151: | Line 151: | ||
==Pranala Menarik== | ==Pranala Menarik== | ||
* [[Linux HowTo]] | * [[Linux HowTo]] | ||
+ | * [[Instalasi OpenVZ Web Panel]] |
Latest revision as of 19:06, 12 November 2013
Instalasi OpenVZ
Tambahkan repository OpenVZ ke yum:
cd /etc/yum.repos.d wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
Buka openvz.repo
vi openvz.repo
Matikan repository [openvz-kernel-rhel6] (enabled=0) dan hidupkan repository [openvz-kernel-rhel5] (enabled=1):
[openvz-kernel-rhel6] name=OpenVZ RHEL6-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32 enabled=0 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [openvz-kernel-rhel5] name=OpenVZ RHEL5-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel5-2.6.18/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel5-2.6.18 enabled=1 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [openvz-kernel-rhel4] name=OpenVZ RHEL4-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel4-2.6.9/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel4-2.6.9 enabled=0 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [...]
Cari kernel yang sesuai dengan mesin anda
yum search ovzkernel
Hasilnya:
[root@server1 yum.repos.d]# yum search vzkernel ... ovzkernel.i686 : Virtuozzo Linux kernel (the core of the Linux operating system) ovzkernel.x86_64 : Virtuozzo Linux kernel (the core of the Linux operating system) ovzkernel-PAE.i686 : The Linux kernel compiled for PAE capable machines. ovzkernel-PAE-devel.i686 : Development package for building kernel modules to match the PAE kernel. ovzkernel-devel.i686 : Development package for building kernel modules to match the kernel. ovzkernel-devel.x86_64 : Development package for building kernel modules to match the kernel. ovzkernel-ent.i686 : The Linux kernel compiled for huge mem capable machines. ovzkernel-ent-devel.i686 : Development package for building kernel modules to match the ent kernel. ovzkernel-xen.i686 : The Linux kernel compiled for Xen VM operations ovzkernel-xen.x86_64 : The Linux kernel compiled for Xen VM operations ovzkernel-xen-devel.i686 : Development package for building kernel modules to match the kernel. ovzkernel-xen-devel.x86_64 : Development package for building kernel modules to match the kernel. [root@server1 yum.repos.d]#
Pilih salah satu yang sesuai dengan arsitektur mesin anda
Pada sistem x86_64:
yum install ovzkernel.x86_64
Pada sistem i686:
yum install ovzkernel.i686
Secara otomatis GRUB bootloader akan terupdate. Silahkan buka /boot/grub/menu.lst untuk memastikan OpenVZ kernel berada di posisi paling atas dibanding kernel yang lain
cat /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 OpenVZ (2.6.18-274.el5.028stab093.2) root (hd0,0) kernel /vmlinuz-2.6.18-274.el5.028stab093.2 ro root=/dev/VolGroup00/LogVol00 selinux=0 initrd /initrd-2.6.18-274.el5.028stab093.2.img title CentOS (2.6.18-274.el5) root (hd0,0) kernel /vmlinuz-2.6.18-274.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-274.el5.img
Sekarang install peralatan untuk pengguna OpenVZ:
yum install vzctl vzquota
Buka /etc/sysctl.conf dan pastikan konfigurasinya seperti di bawah ini:
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 [...]
Jika IP Address yang akan anda gunakan pada VPS anda menggunakan subnet yang berbeda dengan IP Address milik host system, maka anda wajib melakukan perubahan pada vz.conf seperti di bawah ini:
Buka /etc/vz/vz.conf dan set NEIGHBOUR_DEVS ke all:
vi /etc/vz/vz.conf [...] NEIGHBOUR_DEVS=all [...]
SELinux harus dimatikan jika anda ingin menggunakan OpenVZ. Buka /etc/sysconfig/selinux dan set nilai dari SELINUX ke 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
Langkah terakhir adalah reboot server anda:
reboot