Script for Container Creation

Script to creation of Virtuozzo Container (VPS):-
Create "container creation script" file and save this file with .sh extension (vps_creation.sh)

[root@localhost ~]# vi vps_creation.sh
#!/bin/bash

/usr/sbin/vzctl create 1003 --ostemplate centos-5-x86_64 --config slm.2048MB

/usr/sbin/vzctl set 1003 --onboot yes --save

/usr/sbin/vzctl set 1003 --hostname ABCD --save

/usr/sbin/vzctl set 1003 --ipadd 1.1.1.1 --save

/usr/sbin/vzctl set 1003 --nameserver 8.8.8.8 --save

/usr/sbin/vzctl set 1003 --userpasswd root:VpsC3arion --save

/usr/sbin/vzctl set 1003 --name XYZ --save

/usr/sbin/vzctl set 1003 --diskspace 104857600:104857600 --save

/usr/sbin/vzctl set 1003 --slmmemorylimit 4096M:4096M --save

/usr/sbin/vzctl start 1003

Where

1003= Container ID (CTID)
centos-5-x86_64= Name of template
ABCD= Hostname of container
1.1.1.1.1= IP address of container
8.8.8.8= Name server
VpsC3arion= Password of container
XYZ= Name of container
104857600=Disk size in kb
4096M= Ram size of container

How to run this file:-

1). Set the permission of this file.

[root@localhost ~]# chmod a+x vps_creation.sh

2). Run this file.

[root@localhost ~]# ./vps_creation.sh


No comments:

Post a Comment