当前位置:   article > 正文

定制centos之rootfs_centos rootfs.img

centos rootfs.img

如何定制化自己的centos?下面来讲解一下,怎么制作rootfs

 

1    Create RPM database

[root@localhost ~]# mkdir –p /home/arron/centos

[root@localhost ~]# cd /home/arron/centos

[root@localhost centos]# mkdir rootfs

[root@localhost centos]# mkdir -p rootfs/var/lib/rpm

[root@localhost centos]# rpm --root /home/arron/centos/rootfs/ --initdb

 

  1.     Download and install centos-release package

rpm -ivh --nodeps --root /home/arron/centos/rootfs/ http://vault.centos.org/7.4.1708/os/x86_64/Packages/centos-release-7-4.1708.el7.centos.x86_64.rpm

 

The rootfs like this:

[root@localhost centos]# ls rootfs/

etc/ usr/ var/

[root@localhost centos]# ls rootfs/etc/

centos-release      redhat-release      yum/

issue               rpm/                yum.repos.d/

issue.net           system-release 

pki/                system-release-cpe

 

  1.     Install yum

yum --installroot=/home/arron/centos/rootfs install yum --nogpgcheck

 

  1.     Copy the configure

[root@localhost centos]#cp -L /etc/resolv.conf ./rootfs/etc/resolv.conf

[root@localhost centos]#cp –r /etc/yum.repos.d/ /home/arron/centos/rootfs/etc/

 

  1.     Mounting the necessary directories

[root@localhost centos]# mount --bind /dev ./rootfs/dev

[root@localhost centos]# mount -t proc /proc ./rootfs/proc

[root@localhost centos]# mount -t sysfs /sys ./rootfs/sys

 

Refer to this link:

https://raw.githubusercontent.com/psachin/bash_scripts/master/ch-mount.sh

 

  1.     Run chroot

[root@localhost centos]# chroot ./rootfs /bin/bash

 

Refer to this link:

 

https://linux.cn/article-8310-1.html

 

http://ask.xmodulo.com/enable-elrepo-repository.html

 

  1.     Change root password

bash-4.2# yum install net-tools

bash-4.2# yum install passwd

bash-4.2# passwd

passwd: unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 is not authorized to change the password of root

 

  1.     Copy .bash*  scripts to root directory

bash-4.2# cp -v /etc/skel/.bash* /root/

bash-4.2# exit

 下一篇build kernel

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/173639?site
推荐阅读
相关标签
  

闽ICP备14008679号