解析Linux配置OPENVZ的知識

來源:互聯網
上載者:User

很多人在學習Linux,可以看出Linux現在的地位越來越重要,你瞭解Linux系統嗎?你是Linux系統的應用者嗎?本文為你詳細介紹Linux配置OPENVZ ,為你在學習Linux配置OPENVZ 時起一定的作用。

1. 下載安裝檔案

根據您的核心版本在這裡:http://openvz.org/download/kernel/ 下載。

# rpm -ihv vzkernel-name*.rpm

2.修改grub.conf 檔案

 
  1. title OpenVZ (2.6.8-022stab029.1) root (hd0,0) kernel   
  2. /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 initrd /initrd-2.6.8-022stab029.1.img 

3.修改、etc/sysyctl.conf檔案:

 
  1. /etc/sysctl.conf:  
  2. # On Hardware Node we generally need  
  3. # packet forwarding enabled and proxy arp disabled  
  4. net.ipv4.ip_forward = 1 
  5. net.ipv4.conf.default.proxy_arp = 0 
  6. # Enables source route verification  
  7. net.ipv4.conf.all.rp_filter = 1 
  8. # Enables the magic-sysrq  
  9. key kernel.sysrq = 1 
  10. #net.ipv4.tcp_ecn = 0 
  11. # we do not want all our interfaces to send redirects  
  12. net.ipv4.conf.default.send_redirects = 1 

4. 如果你運行了iptables防火牆和SELinux,先關閉和禁止。

編輯/etc/sysconfig/selinux:

SELINUX=disabled。

另外還要關閉iptables防火牆。

5.安裝OpenVZ管理軟體

根據您的版本在這裡:http://openvz.org/download/utils/ 下載。

# rpm –Uhv vzctl*.rpm vzquota*.rpm vzpkg*.rpm

6.重新啟動VZ

# /etc/init.d/vz start

7.安裝模板

 
  1. # rpm –ihv vztmpl-fedora-core-3-1.0-2.noarch.rpm  
  2. # vzpkgcache  
  3. Creating cache for fedora-core-3 OS template  
  4. Setting up install process  
  5. Packing cache file fedora-core-3.tar.gz ...  
  6. Cache file fedora-core-3.tar.gz [130M] created. 

8.為虛擬伺服器建立一個非零ID

 
  1. # vzctl create 101  
  2. Creating VPS private area: /vz/private/101  
  3. VPS is mounted  
  4. Postcreate action done  
  5. VPS is unmounted  
  6. VPS private area was created 

9.設定為零參數

 
  1. # vzctl set 101 --hostname test101.my.org --save  
  2. Hostname for VPS set: test101.my.org  
  3. Saved parameters for VPS 101  
  4. # vzctl set 101 --ipadd 10.0.186.1 --save  
  5. Adding IP address(es): 10.0.186.1  
  6. Saved parameters for VPS 101  
  7. # vzctl set 101 --nameserver 192.168.1.165 --save  
  8. File resolv.conf was modified  
  9. Saved parameters for VPS 101 

10.設定root使用者口令

# vzctl set 101 --userpasswd root:test

11.啟動SSH守護進程

# vzctl exec 101 service sshd start

12.啟動VPS

 
  1. # vzctl start 101  
  2. Starting VPS ...  
  3. VPS is mounted  
  4. Adding IP address(es): 10.0.186.101 Hostname for VPS 101 set: test.my.org  
  5. VPS start in progress... 

13.載入防火牆

前面關閉的防火牆,出於安全考慮這裡還要載入

 
  1. # vzctl set 101 --iptables iptable_filter   
  2. --iptables ipt_length --iptables ipt_limit   
  3. --iptables iptable_mangle --iptables ipt_REJECT --save 

希望Linux配置OPENVZ 對你有所能夠協助。

  1. 淺析Linux作業系統中開源Cisco路由虛擬機器
  2. 詳解三十種Linux發行版本
  3. 學習心得:Linux系統檔案鎖
  4. 闡述Linux擴充檔案系統
  5. 輕鬆的完成Linux建立檔案系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.