自己定制OpenVZ的操作系统模版

简介: Creating a CentOS 5.0 Template Install a system (virtual or physical) with the default CentOS installation that you wish to package.

Creating a CentOS 5.0 Template

  1. Install a system (virtual or physical) with the default CentOS installation that you wish to package. This could be a minimal distro or the default distro or even something custom.
    1. It's generally quicker to bootstrap a CentOS system on another yum/rpm-based, or Debian based system by following the instructions in [1]
  2. Once the OS has been installed, you need to tar the contents of the OS.
    1. First, create a file called /tmp/exclude and add the following lines to it:
    .bash_history
    lost+found
    /dev/*
    /mnt/*
    /tmp/*
    /proc/*
    /sys/*
    /usr/src/*
    1. Now, tar the OS file up by typing: tar --numeric-owner –czvf /tmp/centos-5.0- - -image.tar.gz –X /tmp/exclude / where ARCH> represents the system architecture (i386 or
    x86_64) and DISTRO> represents the distribution (default, minimal, etc.).
    1. Now transfer the file over to the OpenVZ server into /vz/template/cache folder.
  3. On the OpenVZ server create a “dummy” container by creating a folder called /vz/private/50
    and copying the /etc/vz/conf/ve-vps.basic.conf-sample to /etc/vz/conf/50.conf.
    NOTE: 50 is the CTID for the container. You can choose any unused CTID on the OpenVZ server.
  4. Now create a new folder called /vz/template/centos/5/ /config again where
    ARCH> represents the system architecture.
  5. Create a file in the folder called rpm and add the following line:
    43
  6. Create a file called yum.conf in the folder and add the following lines:
    [main]

    cachedir=/vz/template/centos/5/ /yum-cache/

    reposdir=/dev/null

    installonlypkgs=

    [centos5-base]
    name=CentOS 5 - - Base

    baseurl= http://mirror.centos.org/centos/5/os/ /

    enabled=1

    gpgcheck=1

    [centos5-updates-released]

    name=CentOS 5 - - Released Updates

    baseurl= http://mirror.centos.org/centos/5/updates/ /

    enabled=1

    gpgcheck=1
  7. Copy /etc/vz/dists/centos-4.conf to /etc/vz/dists/centos-5.conf.
  8. Copy /vz/template/centos/4/i386/config/minimal.list to /vz/template/centos/5/i386/config/minimal.list.
  9. Change to the /vz/private/50 folder and then run the command gunzip –dc /vz/template/cache/centos-5- - -image.tar.gz | tar –xvf – to unpack the base image to the folder.
  10. Make sure you are in the /vz/private/50 folder.
  11. Edit etc/shadow and remove the replace the root password with !! instead of the hashed value.
  12. Edit the etc/inittab file and comment out the lines that respawn /sbin/mingetty on tty1 through tty6. Just put a # at the beginning of the line.
  13. Remove the etc/mtab file and then create a symbolic link by typing ln -s /proc/mounts etc/mtab.
  14. Remove all of the lines from etc/fstab except for the line that mounts /dev/pts.
  15. Edit etc/rc.d/rc.sysinit and comment out the line that starts /sbin/start_udev by placing a # at the beginning of the line.
  16. Now create device nodes by typing:
    mknod dev/ptmx c 5 2
    mkdir dev/pts
    /sbin/MAKEDEV –d /vz/private/50/dev ttyp ptyp
    mknod dev/null c 1 3
    mknod -m 644 dev/random c 1 8
    mknod dev/urandom c 1 9
  17. Create the var/lock/rpm folder.
  18. If you wish to disable IPv6, do the following:
    1. Edit etc/sysconfig/network and set NETWORKING_IPV6 to no.
    2. Add the following lines to etc/modprobe.d/blacklist:
    blacklist ipv6
    blacklist net-pf-10
  19. Disable any physical NICs by modifying the etc/sysconfig/network-scripts/ifcfg-ethX files (where X is the interface number starting from 0) and setting ONBOOT to no.
  20. Now you’re ready to start the template. Type vzctl start 50 and wait for it to start.
  21. You can install additional packages into the container by typing vzyum 50 install at the prompt where package> represents the name of the software package you wish to install.
  22. Finally, you should turn off unnecessary services.
    1. Enter the container by typing vzctl enter 50.
    2. View the services that are set to run at startup by typing chkconfig --list | grep 5:on.
    3. Disable any unwanted service by typing chkconfig --levels 2345 off where service> represents the service to disable.
    Services that you can (and should) turn off without harm are acpid, apmd, kudzu, and microcode_ctl.
  23. Exit the container by typing exit at the prompt.
  24. Stop the container by typing vzctl stop 50.
  25. Make sure you are in the /vz/private/50 folder.
  26. Finally, package up the new template by typing tar –czvf /vz/template/cache/centos-5- - .tar.gz ./ .
  27. The template is ready for use.
文章来自于这篇文档,http://wiki.openvz.org/Creating_a_CentOS_5.0_Template
下一步就是亲自试一下,然后加入注释和自己的注解,请大家稍等。。。。。。
相关文章
|
开发框架 JavaScript 前端开发
HaaS200 硬件介绍
HaaS200是一款阿里云智能HaaS团队认证、高性能、多连接的物联网开发板。内嵌HaaS201核心模组,包含一个KM4内核的高性能MCU和一个KM0内核的低功耗MCU;自带512KB SRAM,4MB PSRAM和外置4MB FLASH;集成有双频Wi-Fi 2.4G/5G 和蓝牙5.0。HaaS200搭载全新的AliOS Things 3.3操作系统和HaaS轻应用开发框架,支持Python和JavaScript快速开发,免除编译烧录等的繁琐,轻松实现云端一体物联网开发,是IOT开发神器。
HaaS200 硬件介绍
|
25天前
|
人工智能 缓存 API
阿里云Qwen3.8-Max首发上线:API服务与Token Plan同步开放全解析
阿里云正式发布新一代旗舰基座大模型Qwen3.8-Max,同步上线千问AI平台API服务与百炼Token Plan订阅方案,面向全球开发者全面开放调用。作为通义千问系列首款突破2.4万亿参数的MoE混合专家模型,Qwen3.8-Max在编程能力、复杂逻辑推理、长文档处理与多模态智能体协作等领域实现跨越式升级,可独立自主完成16天连续编程任务,全程稳定可靠。本次上线的API服务提供兼容OpenAI与Anthropic的双协议接口,大幅降低迁移成本;Token Plan则以统一Credits计量,打通多模态能力与主流AI工具,为个人与团队提供高性价比的订阅选择。本文将全面解析Qwen3.8-Max
476 2
|
9月前
|
监控 Kubernetes 安全
边界已死,信任重构:零信任架构的真相与落地心法
边界已死,信任重构:零信任架构的真相与落地心法
359 17
|
6月前
|
人工智能 API iOS开发
什么是龙虾AI🦞OpenClaw?OpenClaw能干升么?OpenClaw介绍及如何本地/云端部署喂饭级图文教程
OpenClaw(前身为Clawdbot/Moltbot)是一款遵循MIT协议的开源、本地优先的AI自动化代理引擎,作为面向个人与企业的自托管式AI数字员工,它以自然语言指令为驱动,可在本地或私有云环境中完成文件操作、流程编排、浏览器自动化、多IM平台交互等各类任务,实现了从传统AI“对话式建议”到“自动化执行”的核心跨越。2026年该工具完成了对国内云平台与本地系统的深度适配,尤其支持阿里云百炼免费大模型API的无缝对接,让零基础用户也能快速搭建专属的AI自动化助手。本文将详细讲解2026年新手零基础下阿里云、MacOS、Linux、Windows11本地部署OpenClaw的完整步骤,同时
1041 24
|
6月前
|
SQL 关系型数据库 MySQL
Linux 安装 mysql | 创建mysql 工具连接不上的解决办法
MySQL本地安装后远程连接失败?常见原因:防火墙未放行23306/3306端口,或root用户仅限localhost访问。需依次检查:①系统及云平台安全组端口策略;②MySQL用户权限,执行ALTER USER+CREATE USER+GRANT授权并刷新权限。(239字)
|
8月前
|
运维 Cloud Native 应用服务中间件
阿里云微服务引擎 MSE 及 API 网关 2025 年 12 月产品动态
阿里云微服务引擎 MSE 面向业界主流开源微服务项目, 提供注册配置中心和分布式协调(原生支持 Nacos/ZooKeeper/Eureka )、云原生网关(原生支持Higress/Nginx/Envoy,遵循Ingress标准)、微服务治理(原生支持 Spring Cloud/Dubbo/Sentinel,遵循 OpenSergo 服务治理规范)能力。API 网关 (API Gateway),提供 APl 托管服务,覆盖设计、开发、测试、发布、售卖、运维监测、安全管控、下线等 API 生命周期阶段。帮助您快速构建以 API 为核心的系统架构.满足新技术引入、系统集成、业务中台等诸多场景需要。
|
机器学习/深度学习 算法 5G
【MUSIC、最大似然与克拉美-罗下界】MUSIC与ESPRIT 算法来估计到达角(AoA),并尝试推导克拉美-罗下界(CRLB)以分析其性能研究(Matlab代码实现)
【MUSIC、最大似然与克拉美-罗下界】MUSIC与ESPRIT 算法来估计到达角(AoA),并尝试推导克拉美-罗下界(CRLB)以分析其性能研究(Matlab代码实现)
807 0
|
SQL 人工智能 数据挖掘
quickbi使用总结以及问题反馈
本文总结了使用QuickBI高级版及电子表格的功能体验与改进建议。内容涵盖具体报表使用(如趋势分析表、多维趋势表)、函数及其他模块(如LOD函数、自助取数)、AI智能问数模块以及数据集使用的优缺点。指出趋势分析表在复合指标处理上的不足,多维趋势表对比周期限制,以及1万条明细数据限制对年同比的影响等问题。同时提出未来期望,希望建立结合企业知识库的大模型,优化数据分析与建议能力。
1295 46
|
SQL 数据可视化 atlas
低空经济新基建!DataV Atlas 如何用大模型玩转空间数据?
阿里云DataV Atlas推出搭载通义千问最新2.5 Max大模型「时空SQL智能小助手」,通过自然语言生成专业SQL,简化空间数据分析流程,助力智慧农田、城市低空交通及应急调度等领域,推动精准决策和智能化管理。零门槛体验空间智能分析革命,开启“会思考的天空网络”新时代。
1259 5
低空经济新基建!DataV Atlas 如何用大模型玩转空间数据?
|
存储 运维 Kubernetes
正式开源,Doris Operator 支持高效 Kubernetes 容器化部署方案
飞轮科技推出了 Doris 的 Kubernetes Operator 开源项目(简称:Doris Operator),并捐赠给 Apache 基金会。该工具集成了原生 Kubernetes 资源的复杂管理能力,并融合了 Doris 组件间的分布式协同、用户集群形态的按需定制等经验,为用户提供了一个更简洁、高效、易用的容器化部署方案。
1197 16
正式开源,Doris Operator 支持高效 Kubernetes 容器化部署方案