LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 04-26-2012, 11:08 AM   #1
kkoene
Member
 
Registered: May 2008
Location: Wisconsin
Distribution: Fedora, Ubuntu, RHEL, AIX6
Posts: 33

Rep: Reputation: 0
Setting up a firstboot script after cloning a virtual machine


I am looking for a script I can run that will handle setting up the hostname, IP address, network configs, install some 3rd party software and some other tasks. The script needs to be run on the first boot of a cloned virtual machine.

Either script examples or even just websites for reference would be helpful. I've never messed with firstboot so just looking for a starting point.

Thanks!
 
Old 04-27-2012, 03:57 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I'm not sure if a (firstboot) script is the way to go.

After cloning a VM the safest way to go is to start the clone in runlevel 1 right after the cloning is finished and change the network settings. If you don't udev will create a rule for a second network interface due to certain things not being unique, which would make things unclear and harder to trouble-shoot/fix.

If I assume you use a RedHat based distro you need to change /etc/sysconfig/network-scripts/ifcfg-ethX Don't forget to change the hardware address (HWADDR). Depending on how things are set up you might also need to change /etc/sysconfig/network.

After that reboot into your normal runlevel and add the 3rd party software (with or without the use of a script).

Hope this helps.
 
Old 04-27-2012, 07:11 AM   #3
kkoene
Member
 
Registered: May 2008
Location: Wisconsin
Distribution: Fedora, Ubuntu, RHEL, AIX6
Posts: 33

Original Poster
Rep: Reputation: 0
Thanks druuna. That is what we are currently doing. What I've been tasked with is to come up with a way that all that runlevel 1 stuff is done automagically. So the entire clone and boot process is hands off.
 
Old 04-27-2012, 08:16 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I'm not sure it is possible to automate it the way you want/need. The system you need to clone needs to be edited before you clone it (and be restored to the original settings afterwards). You need to change the default RL to 1, create and link a script in init.d that changes the appropriate settings when the clone boots. The clone process might be made hands-free this way, but you move the human actions to the original.

Wouldn't it be easier to use a kickstart file to create the copies? The %post section could possibly be used to install the 3rd party software.

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie needs help setting up Virtual Machine sprawl Linux - Newbie 3 01-15-2011 05:21 PM
[SOLVED] The script to shut down the virtual machine liuqiong7618 Linux - Virtualization and Cloud 1 09-06-2010 08:09 PM
The script to shut down the virtual machine liuqiong7618 Linux - General 1 09-02-2010 04:44 AM
Help Setting Up Virtual Machine TentativeChaos Linux - Newbie 5 03-23-2008 07:20 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration