Danh mục

Hướng dẫn cài đặt và sử dụng OpenVZ trên CentOS 6.0

Số trang: 12      Loại file: pdf      Dung lượng: 470.55 KB      Lượt xem: 15      Lượt tải: 0    
tailieu_vip

Hỗ trợ phí lưu trữ khi tải xuống: 2,000 VND Tải xuống file đầy đủ (12 trang) 0

Báo xấu

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

OpenVZ là một nhánh mã nguồn mở của Virtuozzo do SWsoft cung cấp. Đây là một giải pháp ảo hóa thương mại được sử dụng bởi nhiều nhà cung cấp máy chủ ảo hóa. Các bản vá nhân OpenVZ được cấp phép theo giấy phép GLP và các công cụ cấp người dùng theo giấy phép QPL. Với OpenVZ bạn có thể tạo ra nhiều máy chủ riêng ảo (VPS) trên cùng một phần cứng tương tự như Xen và các dự án Linux Vserver. Trong bài hướng dẫn này chúng tôi sẽ giúp các bạn chuẩn bị một máy...
Nội dung trích xuất từ tài liệu:
Hướng dẫn cài đặt và sử dụng OpenVZ trên CentOS 6.0 Hướng dẫn cài đặt và sử dụng OpenVZ trên CentOS 6.0 OpenVZ là một nhánh mã nguồn mở của Virtuozzo do SWsoft cung cấp. Đây là một giải pháp ảo hóa thương mại được sử dụng bởi nhiều nhà cung cấp máy chủ ảo hóa. Các bản vá nhân OpenVZ được cấp phép theo giấy phép GLP và các công cụ cấp người dùng theo giấy phép QPL. Với OpenVZ bạn có thể tạo ra nhiều máy chủ riêng ảo (VPS) trên cùng một phần cứng tương tự như Xen và các dự án Linux Vserver. Trong bài hướng dẫn này chúng tôi sẽ giúp các bạn chuẩn bị một máy chủ CentOS 6.0 cho OpenVZ. Ảnh minh họa hệ thống mạng sử dụng công nghệ ảo hóa. Cài đặt OpenVZ Để cài đặt OpenVZ, chúng ta cần thêm kho OpenVZ cho yum: cd /etc/yum.repos.d wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key- OpenVZ Bây giờ mở openvz.repo... vi openvz.repo … và vô hiệu hóa kho lưu trữ [openvz-kernel-rhel5] (đặt enabled=0) và thay vào đó là kích hoạt kho [openvz-kernel-rhel6] (đặt enabled=1): [...] [openvz-kernel-rhel5] name=OpenVZ RHEL5-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhe l5-2.6.18/current/ mirrorlist=http://download.openvz.org/kernel/mirrors- rhel5-2.6.18 enabled=0 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [...] [openvz-kernel-rhel6] name=OpenVZ RHEL6-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhe l6-2.6.32/current/ mirrorlist=http://download.openvz.org/kernel/mirrors- rhel6-2.6.32 enabled=1 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [...] Nội dung kho lưu trữ các nhân (kernel) của OpenVZ sẽ có một vài sự khác biệt (bạn có thể xem chi tiết tại đây). Chạy dòng lệnh: yum search vzkernel Và đây là một số kernel có sẵn: [root@server1 yum.repos.d]# yum search vzkernel [...] vzkernel.i686 : The Linux kernel vzkernel.x86_64 : The Linux kernel vzkernel-debug.i686 : The Linux kernel compiled with extra debugging enabled vzkernel-debug.x86_64 : The Linux kernel compiled with extra debugging enabled vzkernel-debug-devel.i686 : Development package for building kernel modules to match the debug kernel vzkernel-debug-devel.x86_64 : Development package for building kernel modules to match the debug kernel vzkernel-devel.i686 : Development package for building kernel modules to match the kernel vzkernel-devel.x86_64 : Development package for building kernel modules to match the kernel vzkernel-firmware.noarch : Firmware files used by the Linux kernel vzkernel-headers.i686 : Header files for the Linux kernel for use by glibc vzkernel-headers.x86_64 : Header files for the Linux kernel for use by glibc [root@server1 yum.repos.d]# Chọn một trong số đó và tiến hành cài đặt: yum install vzkernel Điều này sẽ tự động update các bộ nạp khởi động GRUB tốt nhất. Chúng ta nên mở /boot/grub/menu.lst; đoạn kernel đầu tiên lúc nên chứa nội dung của kernel OpenVZ mới. Tiêu đề bạn có thể đặt là CentOS Linux. Ngoài ra hãy chắc chắn rằng giá trị default là 0 để các kernel đầu tiên (OpenVZ kernel) sẽ tự động khởi động thay vì CentOS kernel như mặc định. 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/mapper/vg_server1-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS Linux OpenVZ (2.6.32-042stab020.1) root (hd0,0) kernel /vmlinuz-2.6.32-042stab020.1 ro root=/dev/mapper/vg_server1-lv_root rd_LVM_LV=vg_server1/lv_root rd_LVM_LV=vg_server1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de crashkernel=auto rhgb quiet initrd /initramfs-2.6.32-042stab020.1.img title CentOS (2.6.32-71.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vg_server1-lv_root rd_LVM_LV=vg_server1/lv_root rd_LVM_LV=vg_server1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de crashkernel=auto rhgb quiet initrd /initramfs-2.6.32-71.el6.x86_64.img Bầy giờ chúng ta tiến hành cài đặt OpenVZ sử dụng công cụ: yum install vzctl vzquota Mở /etc/sysctl.conf và chắc chắn rằng bạn có những thiết lập như dưới đây: 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 [...] Nếu bạn muốn chỉnh sửa /etc/sysctl.conf, chạy lệnh: sysctl -p Lưu ý: Các bước tiếp theo dưới đây rất quan trọng nếu địa chỉ IP của máy ảo là từ một Subnet khác với địa chỉ IP của hệ thống máy chủ. Nếu bạn không thực hiện chính xác theo những bước này, kết nối mạng sẽ không hoạt động trong máy ảo! Mở /etc/vz/vz.conf và thiết lập NEIGHBOUR_DEVS cho toàn bộ: vi /etc/vz/vz.conf [...] NEIGHBOUR_DEVS=all [...] SELinux cần phải vô hiệu hóa nếu bạn muốn sử dụng OpenVZ. Mở /etc/sysconfig/selinux và thiết lập giá trị của SELINUX thành 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 - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Mult ...

Tài liệu được xem nhiều: