如何制作最简单和最小的Linux系统

1、光盘挂载
    mount /dev/cdrom /mnt/

2、安装febootstrap命令
    yum install febootstrap

3、制作镜像目录
    febootstrap -i bash  -i yum  centos6 centos6.4_base file:///mnt/

4、将locale-archive文件进行缩减,原有98M,之后1.6M
    cp /usr/lib/locale/locale-archive /tmp/
    rm -fv /usr/lib/locale/locale-archive && localedef -f UTF-8 -i zh_CN zh_CN.UTF8 && localedef --list-archive
    cp /usr/lib/locale/locale-archive centos6.4_base/usr/lib/locale/

[root@localhost  ~]# cp -a /root/.bash* centos6.4_base/root/
[root@localhost  ~]# du -sh centos6.4_base/
49M     centos6.4_base/
[root@localhost  ~]# cd centos6.4_base/ && tar -c .|docker import - centos6.4_min
e42236cce673a646a7613d952070fed1f00faed2ce00638d1ad4364deb0f6c73
[root@localhost  centos6.4_base]# docker images
REPOSITORY                            TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos6.4_min                         latest              e42236cce673        9 seconds ago       38.14 MB
centos6.4                             nginx_2             9d1fb16633da        15 hours ago        1.032 GB
www.perofu.com:8080/centos6.4_nginx   latest              9292ea856521        15 hours ago        1.032 GB
centos6.4                             nginx_1             9292ea856521        15 hours ago        1.032 GB
centos6.4                             nginx               9426c7d004a6        16 hours ago        1.032 GB
centos6.4                             latest              8629503fccf6        16 hours ago        795.9 MB
registry                              latest              985e98f8266b        5 months ago        404.7 MB
[root@localhost  centos6.4_base]# docker run -it --rm centos6.4_min /bin/bash
[root@68e616e37a6d /]# ls
bash: ls: command not found
[root@68e616e37a6d /]# cd
[root@68e616e37a6d ~]# ls
bash: ls: command not found
[root@68e616e37a6d ~]# ll /bin/
bash: ll: command not found
[root@68e616e37a6d ~]#
[root@68e616e37a6d ~]# ls /bin/
bash: ls: command not found
[root@68e616e37a6d ~]# pwd
/root
[root@68e616e37a6d ~]#
Display all 113 possibilities? (y or n)
!                          command                    exit                       iconvconfig                read                       times
./                         compgen                    export                     iconvconfig.x86_64         readarray                  trap
:                          complete                   false                      if                         readonly                   true
[                          compopt                    fc                         in                         return                     type
[[                         continue                   fg                         jobs                       rm                         typeset
]]                         coproc                     fi                         kill                       rpcgen                     tzdata-update
alias                      cp                         for                        ldconfig                   select                     tzselect
bash                       declare                    function                   ldd                        set                        ulimit
bashbug-64                 dirs                       gencat                     let                        setcap                     umask
bg                         disown                     getcap                     local                      sh                         unalias
bind                       do                         getconf                    locale                     shift                      unset
break                      done                       getent                     localedef                  shopt                      until
build-locale-archive       echo                       getopts                    logout                     sln                        wait
builtin                    elif                       getpcaps                   mapfile                    source                     while
caller                     else                       glibc_post_upgrade.x86_64  mv                         sprof                      zdump
capsh                      enable                     hash                       popd                       suspend                    zic
case                       esac                       help                       printf                     test                       {
catchsegv                  eval                       history                    pushd                      then                       }
cd                         exec                       iconv                      pwd                        time                      

你可能感兴趣的:(linux,docker,ISO,minimal,febootstrap)