Sometimes we have specific requirements for the OS environment for development, but do not want to affect the current system environment. Then we can use the chroot environment.
Please note that the installation of the chroot environment requires root privileges.
1) First, create a directory for the chroot environment, for example: Mkdir/data/jails/myos
2) Download and install the corresponding version of the Centos-release file from the official CentOS website or the image website, for example: wget centos-release-5-8.el5.centos.x86_64.rpmhttp:// Up.2cto.com/2012/0327/20120327042858716.rar
Rpm-i--nodeps--root=/data/jails/myos centos-release-5-8.el5.centos.x86_64.rpm 3) Install the Yum tool for the chroot environment, So we can go into the chroot environment and continue to install other packages: yum-y--installroot=/data/jails/myos install Yum
4) Mount some nodes to the chroot environment (not required here, but if www.2cto.com you need to open some services in the chroot environment, it's best to do it): Mount--bind/dev/data/jails/myos/dev Mount--bind/proc/data/jails/myos/proc Mount--bind/sys/data/jails/myos/sys
5) Set up, go in and adjust the time zone to be done: Chroot/data/jails/myos cp/usr/share/zoneinfo/asia/shanghai/etc/localtime Supplement) If you find a problem with your system network , perhaps your DNS settings are incorrect, please refer to the/etc/resolv.conf file in the main environment.
Author Fire meteor X
- This article from: Hobby Linux Technology Network
How to install the chroot environment for CentOS