• lxc 容器基础配置篇


    一, 首先配置lxc需要的网卡断

      

      吧eth0复制一份变为br0

      配置br0

        

      配置eth0

        

     重启网卡

      /etc/init.d/network restart

     安装lxc软件 需要epel源---

      yum install  lxc* libcgroup* -y

     安装完成过后:

      

      启动lxc

     

      配置lxc源

      

      

      

      复制内容 到命令行擦做

      

      

      自己选择自己系统的版本信息,

      主要

        ppc的话事IBM的

        arm64手机那种

        amd63  X64

        i386     X32

      查看下载的文件内容

      

      下载一个模板

      

      查看模板信息

      

      启动lxc

      

      发现需要登入但是并没有密码

      新建一个连接

      

      

      

      进去啦...

      

      发现没有网

      

      lxc配置网络

      新建一个连接配置文件

      

      重启服务:

      新开连接

      

      在启动lxc

      更改容器的DNS

        resolve.conf

      新建连接配置容器

        

      容器中查看已经同步 

        

      cnetos6 配置地址

      

      

      在容器中ping 百度

      

      更改yum源文件

      vim /var/lib/lxc/centos6-muban/rootfs/etc/yum.repos.d/CentOS-Base.repo

      

    # CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the
    # remarked out baseurl= line instead.
    #
    #
    
    [base]
    name=CentOS-$releasever - Base
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    
    #released updates
    [updates]
    name=CentOS-$releasever - Updates
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/contrib/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    

      安装ssh

       安装ssh

       yum install openssh-server -y

      ssh远程连接lxc

      

      lxc常用命令:

       lxc -ls 查看lxc容器列表

       lxc-destroy 删除一个容器

       lxc-start 启动   lxc-start -n centos6-muban

       lxc-stop 停止一个容器 lxc-stop -n centos6-muban

         lxc-clone 克隆lxc   lxc-clone centos6-muban web
        

     

         

     

  • 相关阅读:
    开发移动端项目如何利用Chrome浏览器连接真机测试
    有关浏览器开发者工具使用的技巧
    有关前端实时可视化工具的使用 ==实现边改代码边看效果
    vue的生命周期介绍beforeCreate(创建前)、created(创建后)、beforeMount(载入前)、mounted(载入后)、beforeUpdate(更新前)、updated(更新后)、beforeDestroy(销毁前)、destroyed(销毁后)
    echart中重新定义引导线的文字换行<br>不起作用
    使用mock数据填写表格同时带点击查看更多
    有关前后端分离前端如何使用mock数据
    echar图柱状图和折线图混合加双侧y轴坐
    【Oracle】DBMS_STATS.GATHER_TABLE_STATS
    【PostgreSQL-9.6.3】Red Hat 4.4.7下的安装
  • 原文地址:https://www.cnblogs.com/kingle-study/p/9621504.html
Copyright © 2020-2023  润新知