Excerpt |
---|
This page describes how to create a Linux base image. |
You will need the following:
...
Tip |
---|
mkdir /root/.ssh |
Tip |
---|
scp /etc/vcl/vcl.key.pub <hostname or IP address>:/root/.ssh/authorized_keys |
...
The main dependency for linux OS's is that the vcl management node has to able to login as root over ssh using an ssh identity key on the private network, which is normally eth0. This means there are two distinct ssh services, one for the private network and one for the external public network.
Note this will be automated in a future release.
The script /etc/rc.local is used to determine the correct IP addresses and update sshd_config and external_sshd_config files.
Code Block |
---|
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG
perl -pi -e 's/^X11Forwarding .*$/X11Forwarding yes/' /etc/ssh/sshd_config
perl -pi -e 's/^KeyRegenerationInterval .*$/KeyRegenerationInterval 0/' /etc/ssh/sshd_config
perl -pi -e 's/(.*MaxStartups.*)/#\1/' /etc/ssh/sshd_config
cp /etc/ssh/sshd_config /etc/ssh/external_sshd_config
perl -pi -e 's/.*PidFile .*$/PidFile \/var\/run\/ext_sshd.pid/' /etc/ssh/external_sshd_config
IP0=\$(ifconfig eth0 | grep 'inet addr' | awk '{print \$2}' | awk -F: '{print \$2}')
IP1=\$(ifconfig eth1 | grep 'inet addr' | awk '{print \$2}' | awk -F: '{print \$2}')
perl -pi -e 's/^AllowUsers .*\n//' /etc/ssh/sshd_config
perl -pi -e 's/^AllowUsers .*\n//' /etc/ssh/external_sshd_config
perl -pi -e 's/^ListenAddress .*\n//' /etc/ssh/sshd_config
perl -pi -e 's/^ListenAddress .*\n//' /etc/ssh/external_sshd_config
echo \"AllowUsers root\" >> /etc/ssh/sshd_config
echo \"ListenAddress \$IP0\" >> /etc/ssh/sshd_config
echo \"ListenAddress \$IP1\" >> /etc/ssh/external_sshd_config
/etc/rc.d/init.d/sshd stop
sleep 2
/etc/rc.d/init.d/sshd start
|
Code Block |
---|
IP1=\$(ifconfig eth0 | grep 'inet addr' | awk '{print \$2}' | awk -F: '{print \$2}')
IP0=\$(ifconfig eth1 | grep 'inet addr' | awk '{print \$2}' | awk -F: '{print \$2}')
|
Note this will be automated in a future release.
Code Block |
---|
cp /etc/init.d/sshd /etc/init.d/ext_sshd
|
Code Block |
---|
OPTIONS='-f /etc/ssh/external_sshd_config'
PID_FILE=/var/run/ext_sshd.pid
|
Add the image to the VCL database. A row needs to be added to the following tables:
These rows need to be added to the database manually either by using SQL commands or phpMyAdmin. The following SQL statements assume the following properties of the image:
VMware Only:
NOTE: You may need to insert the an OSid for linux on vmware OS depending on when the source code was downloaded.
Code Block |
---|
INSERT INTO `OS` (
`id`, `name`, `prettyname`,
`type`, `installtype`, `sourcepath`, `moduleid`) VALUES
(36, 'vmwarelinux', 'VMware Generic Linux',
'linux', 'vmware','vmware_images',5);
|
Step 1: Insert information image into image table
Code Block |
---|
INSERT INTO `vcl`.`image` (
`id` ,
`name` ,
`prettyname` ,
`ownerid` ,
`platformid` ,
`OSid` ,
`imagemetaid` ,
`minram` ,
`minprocnumber` ,
`minprocspeed` ,
`minnetwork` ,
`maxconcurrent` ,
`reloadtime` ,
`deleted` ,
`test` ,
`lastupdate` ,
`forcheckout` ,
`maxinitialtime` ,
`project` ,
`size` ,
`architecture` ,
`description` ,
`usage` ,
`basedoffrevisionid`
)
VALUES (
'8' , 'vmwarelinux-base8-v1', 'No Apps (Linux)', '1', '1', '36', NULL,
'512', '1', '1024', '100', NULL , '5', '0', '0', NOW(), '1', '0', 'vcl', '1500',
'x86', NULL , NULL , '0'
);
|
Step 2: Insert imagerevision information into imagerevision table
Code Block |
---|
INSERT INTO `vcl`.`imagerevision` (
`id` ,
`imageid` ,
`revision` ,
`userid` ,
`datecreated` ,
`deleted` ,
`datedeleted` ,
`production` ,
`comments` ,
`imagename`
)
VALUES (
NULL , '8', '1', '1', NOW(), '0', NULL , '1', NULL , 'vmwarelinux-base8-v1'
)
|
Step 3. Insert resource information into resource table.
...
Tip |
---|
ssh-copy-id -i /etc/vcl/vcl.key <hostname or IP address> |
Tip |
---|
ssh -i /etc/vcl/vcl.key <hostname or IP address> |
Tip |
---|
cd /etc/sysconfig/network-scripts |
Tip |
---|
rm -f /etc/sysconfig/network-scripts/ifcfg-*.bak |
Tip |
---|
vi ifcfg-eth0 |
Tip |
---|
vi ifcfg-eth1 |
No Format |
---|
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
|
No Format |
---|
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
|
Tip |
---|
shutdown -r now |
Tip |
---|
ls /etc/sysconfig/network-scripts |
Tip |
---|
cat /etc/sysconfig/network-scripts/ifcfg-eth0 |
Tip |
---|
cat /etc/sysconfig/network-scripts/ifcfg-eth1 |
Include Page | ||||
---|---|---|---|---|
|