Install CentOS LXC Container on Ubuntu
1. Install Yum and Dependencies
$ sudo apt-get install librpm3 librpmbuild3 librpmio3 librpmsign1 libsqlite0 python-rpm python-sqlite python-sqlitecachec python-support python-urlgrabber rpm rpm-common rpm2cpio yum debootstrap bridge-utils
2. Download lxc-centos template
https://gist.github.com/hagix9/3514296#file-lxc-centos
$ wget https://gist.github.com/hagix9/3514296/raw/7f6bb4e291fad1dad59a49a5c02f78642bb99a45/lxc-centos
3. Copy template file to templates folder and enable execution
$ sudo cp lxc-centos /usr/share/lxc/templates/
$ sudo chmod +x /usr/share/lxc/templates/lxc-centos
Once the template is setup, you can create and manage the centos container using the webpanel. You can use the terminal to do these operation as follows.
4. Deploy CentOS Container
$ sudo lxc-create -n lxc-centos01 -t centos
5. Boot Container
This command will show you the bootstrap and land you at the login prompt. Can only exit by shutting down the VM
$ lxc-start -n lxc-centos01
This way of booting the container will not show you output or take you to a login prompt. It starts it as a daemon in the background. After it quickly starts you can SSH to the container. To find out it's IP address look at LXC Commands
$ lxc-start -n lxc-centos01 -d
6. Login to Container
The root password is set in the lxc-centos template. The default password is 'password'.
Post a Comment