You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pd...@apache.org on 2015/03/08 15:32:51 UTC
[1/7] cloudstack-docs-admin git commit: minor formating
Repository: cloudstack-docs-admin
Updated Branches:
refs/heads/master 2e9e68ec9 -> 36338aa32
minor formating
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/ee2156ce
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/ee2156ce
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/ee2156ce
Branch: refs/heads/master
Commit: ee2156ce03216b8a6add6c922dfbc716f1a156dd
Parents: 2e9e68e
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Mar 8 10:11:33 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:11:33 2015 -0400
----------------------------------------------------------------------
source/service_offerings.rst | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/ee2156ce/source/service_offerings.rst
----------------------------------------------------------------------
diff --git a/source/service_offerings.rst b/source/service_offerings.rst
index e43537f..83df1e7 100644
--- a/source/service_offerings.rst
+++ b/source/service_offerings.rst
@@ -499,22 +499,22 @@ defaulted to the global parameter value.
The following table gives you an overview of how network rate is applied
on different types of networks in CloudStack.
-=============================================== ===============================
-Networks Network Rate Is Taken from
-=============================================== ===============================
-Guest network of Virtual Router Guest Network Offering
-Public network of Virtual Router Guest Network Offering
-Storage network of Secondary Storage VM System Network Offering
-Management network of Secondary Storage VM System Network Offering
-Storage network of Console Proxy VM System Network Offering
-Management network of Console Proxy VM System Network Offering
-Storage network of Virtual Router System Network Offering
-Management network of Virtual Router System Network Offering
-Public network of Secondary Storage VM System Network Offering
-Public network of Console Proxy VM System Network Offering
-Default network of a guest VM Compute Offering
-Additional networks of a guest VM Corresponding Network Offerings
-=============================================== ===============================
+=========================================== ===============================
+Networks Network Rate Is Taken from
+=========================================== ===============================
+Guest network of Virtual Router Guest Network Offering
+Public network of Virtual Router Guest Network Offering
+Storage network of Secondary Storage VM System Network Offering
+Management network of Secondary Storage VM System Network Offering
+Storage network of Console Proxy VM System Network Offering
+Management network of Console Proxy VM System Network Offering
+Storage network of Virtual Router System Network Offering
+Management network of Virtual Router System Network Offering
+Public network of Secondary Storage VM System Network Offering
+Public network of Console Proxy VM System Network Offering
+Default network of a guest VM Compute Offering
+Additional networks of a guest VM Corresponding Network Offerings
+=========================================== ===============================
A guest VM must have a default network, and can also have many
additional networks. Depending on various parameters, such as the host
[5/7] cloudstack-docs-admin git commit: split templates.rst to
multiple files
Posted by pd...@apache.org.
split templates.rst to multiple files
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/04505cae
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/04505cae
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/04505cae
Branch: refs/heads/master
Commit: 04505cae4391c9509d8ae777f52cf8064e775bf7
Parents: 9b36171
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Mar 8 10:25:11 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:25:11 2015 -0400
----------------------------------------------------------------------
source/templates/_create_linux.rst | 261 ++++++++++++++++++++++++++++++
source/templates/_create_windows.rst | 220 +++++++++++++++++++++++++
2 files changed, 481 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/04505cae/source/templates/_create_linux.rst
----------------------------------------------------------------------
diff --git a/source/templates/_create_linux.rst b/source/templates/_create_linux.rst
new file mode 100644
index 0000000..24a9061
--- /dev/null
+++ b/source/templates/_create_linux.rst
@@ -0,0 +1,261 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information#
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+Creating a Linux Template
+-------------------------
+
+Linux templates should be prepared using this documentation in order to
+prepare your linux VMs for template deployment. For ease of
+documentation, the VM which you are configuring the template on will be
+referred to as "Template Master". This guide currently covers legacy
+setups which do not take advantage of UserData and cloud-init and
+assumes openssh-server is installed during installation.
+
+An overview of the procedure is as follow:
+
+#. Upload your Linux ISO.
+
+ For more information, see `“Adding an
+ ISO” <virtual_machines.html#adding-an-iso>`_.
+
+#. Create a VM Instance with this ISO.
+
+ For more information, see `“Creating
+ VMs” <virtual_machines.html#creating-vms>`_.
+
+#. Prepare the Linux VM
+
+#. Create a template from the VM.
+
+ For more information, see `“Creating a Template from an Existing
+ Virtual Machine” <#creating-a-template-from-an-existing-virtual-machine>`_.
+
+
+System preparation for Linux
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following steps will prepare a basic Linux installation for
+templating.
+
+#. **Installation**
+
+ It is good practice to name your VM something generic during
+ installation, this will ensure components such as LVM do not appear
+ unique to a machine. It is recommended that the name of "localhost"
+ is used for installation.
+
+ .. warning::
+ For CentOS, it is necessary to take unique identification out of the
+ interface configuration file, for this edit
+ /etc/sysconfig/network-scripts/ifcfg-eth0 and change the content to
+ the following.
+
+ .. code:: bash
+
+ DEVICE=eth0
+ TYPE=Ethernet
+ BOOTPROTO=dhcp
+ ONBOOT=yes
+
+ The next steps updates the packages on the Template Master.
+
+ - Ubuntu
+
+ .. code:: bash
+
+ sudo -i
+ apt-get update
+ apt-get upgrade -y
+ apt-get install -y acpid ntp
+ reboot
+
+ - CentOS
+
+ .. code:: bash
+
+ ifup eth0
+ yum update -y
+ reboot
+
+#. **Password management**
+
+ .. note::
+ If preferred, custom users (such as ones created during the Ubuntu
+ installation) should be removed. First ensure the root user account
+ is enabled by giving it a password and then login as root to continue.
+
+ .. code:: bash
+
+ sudo passwd root
+ logout
+
+ As root, remove any custom user accounts created during the
+ installation process.
+
+ .. code:: bash
+
+ deluser myuser --remove-home
+
+ See :ref:`adding-password-management-to-templates` for
+ instructions to setup the password management script, this will allow
+ CloudStack to change your root password from the web interface.
+
+#. **Hostname Management**
+
+ CentOS configures the hostname by default on boot. Unfortunately
+ Ubuntu does not have this functionality, for Ubuntu installations use
+ the following steps.
+
+ - Ubuntu
+
+ The hostname of a Templated VM is set by a custom script in
+ `/etc/dhcp/dhclient-exit-hooks.d`, this script first checks if the
+ current hostname is localhost, if true, it will get the host-name,
+ domain-name and fixed-ip from the DHCP lease file and use those
+ values to set the hostname and append the `/etc/hosts` file for
+ local hostname resolution. Once this script, or a user has changed
+ the hostname from localhost, it will no longer adjust system files
+ regardless of its new hostname. The script also recreates
+ openssh-server keys, which should have been deleted before
+ templating (shown below). Save the following script to
+ `/etc/dhcp/dhclient-exit-hooks.d/sethostname`, and adjust the
+ permissions.
+
+ .. code:: bash
+
+ #!/bin/sh
+ # dhclient change hostname script for Ubuntu
+ oldhostname=$(hostname -s)
+ if [ $oldhostname = 'localhost' ]
+ then
+ sleep 10 # Wait for configuration to be written to disk
+ hostname=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /host-name/ { host = $3 } END { printf host } ' | sed 's/[";]//g' )
+ fqdn="$hostname.$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /domain-name/ { domain = $3 } END { printf domain } ' | sed 's/[";]//g')"
+ ip=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /fixed-address/ { lease = $2 } END { printf lease } ' | sed 's/[";]//g')
+ echo "cloudstack-hostname: Hostname _localhost_ detected. Changing hostname and adding hosts."
+ printf " Hostname: $hostname\n FQDN: $fqdn\n IP: $ip"
+ # Update /etc/hosts
+ awk -v i="$ip" -v f="$fqdn" -v h="$hostname" "/^127/{x=1} !/^127/ && x { x=0; print i,f,h; } { print $0; }" /etc/hosts > /etc/hosts.dhcp.tmp
+ mv /etc/hosts /etc/hosts.dhcp.bak
+ mv /etc/hosts.dhcp.tmp /etc/hosts
+ # Rename Host
+ echo $hostname > /etc/hostname
+ hostname -b -F /etc/hostname
+ echo $hostname > /proc/sys/kernel/hostname
+ # Recreate SSH2
+ export DEBIAN_FRONTEND=noninteractive
+ dpkg-reconfigure openssh-server
+ fi
+ ### End of Script ###
+
+ chmod 774 /etc/dhcp/dhclient-exit-hooks.d/sethostname
+
+ .. warning::
+ The following steps should be run when you are ready to template
+ your Template Master. If the Template Master is rebooted during
+ these steps you will have to run all the steps again. At the end
+ of this process the Template Master should be shutdown and the
+ template created in order to create and deploy the final template.
+
+#. **Remove the udev persistent device rules**
+
+ This step removes information unique to your Template Master such as
+ network MAC addresses, lease files and CD block devices, the files
+ are automatically generated on next boot.
+
+ - Ubuntu
+
+ .. code:: bash
+
+ rm -f /etc/udev/rules.d/70*
+ rm -f /var/lib/dhcp/dhclient.*
+
+ - CentOS
+
+ .. code:: bash
+
+ rm -f /etc/udev/rules.d/70*
+ rm -f /var/lib/dhclient/*
+
+#. **Remove SSH Keys**
+
+ This step is to ensure all your Templated VMs do not have the same
+ SSH keys, which would decrease the security of the machines
+ dramatically.
+
+ .. code:: bash
+
+ rm -f /etc/ssh/*key*
+
+#. **Cleaning log files**
+
+ It is good practice to remove old logs from the Template Master.
+
+ .. code:: bash
+
+ cat /dev/null > /var/log/audit/audit.log 2>/dev/null
+ cat /dev/null > /var/log/wtmp 2>/dev/null
+ logrotate -f /etc/logrotate.conf 2>/dev/null
+ rm -f /var/log/*-* /var/log/*.gz 2>/dev/null
+
+#. **Setting hostname**
+
+ In order for the Ubuntu DHCP script to function and the CentOS
+ dhclient to set the VM hostname they both require the Template
+ Master's hostname to be "localhost", run the following commands to
+ change the hostname.
+
+ .. code:: bash
+
+ hostname localhost
+ echo "localhost" > /etc/hostname
+
+#. **Set user password to expire**
+
+ This step forces the user to change the password of the VM after the
+ template has been deployed.
+
+ .. code:: bash
+
+ passwd --expire root
+
+#. **Clearing User History**
+
+ The next step clears the bash commands you have just run.
+
+ .. code:: bash
+
+ history -c
+ unset HISTFILE
+
+#. **Shutdown the VM**
+
+ Your now ready to shutdown your Template Master and create a
+ template!
+
+ .. code:: bash
+
+ halt -p
+
+#. **Create the template!**
+
+ You are now ready to create the template, for more information see
+ `“Creating a Template from an Existing Virtual
+ Machine” <#creating-a-template-from-an-existing-virtual-machine>`_.
+
+.. note::
+ Templated VMs for both Ubuntu and CentOS may require a reboot after
+ provisioning in order to pickup the hostname.
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/04505cae/source/templates/_create_windows.rst
----------------------------------------------------------------------
diff --git a/source/templates/_create_windows.rst b/source/templates/_create_windows.rst
new file mode 100644
index 0000000..cb1d554
--- /dev/null
+++ b/source/templates/_create_windows.rst
@@ -0,0 +1,220 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information#
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+Creating a Windows Template
+---------------------------
+
+Windows templates must be prepared with Sysprep before they can be
+provisioned on multiple machines. Sysprep allows you to create a generic
+Windows template and avoid any possible SID conflicts.
+
+.. note::
+ (XenServer) Windows VMs running on XenServer require PV drivers, which
+ may be provided in the template or added after the VM is created. The
+ PV drivers are necessary for essential management functions such as
+ mounting additional volumes and ISO images, live migration, and
+ graceful shutdown.
+
+An overview of the procedure is as follows:
+
+#. Upload your Windows ISO.
+
+ For more information, see `“Adding an
+ ISO” <virtual_machines.html#adding-an-iso>`_.
+
+#. Create a VM Instance with this ISO.
+
+ For more information, see `“Creating
+ VMs” <virtual_machines.html#creating-vms>`_.
+
+#. Follow the steps in Sysprep for Windows Server 2008 R2 (below) or
+ Sysprep for Windows Server 2003 R2, depending on your version of
+ Windows Server
+
+#. The preparation steps are complete. Now you can actually create the
+ template as described in Creating the Windows Template.
+
+
+System Preparation for Windows Server 2008 R2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For Windows 2008 R2, you run Windows System Image Manager to create a
+custom sysprep response XML file. Windows System Image Manager is
+installed as part of the Windows Automated Installation Kit (AIK).
+Windows AIK can be downloaded from `Microsoft Download
+Center <http://www.microsoft.com/en-us/download/details.aspx?id=9085>`_.
+
+Use the following steps to run sysprep for Windows 2008 R2:
+
+.. note::
+ The steps outlined here are derived from the excellent guide by
+ Charity Shelbourne, originally published at `Windows Server 2008
+ Sysprep Mini-Setup.
+ <http://blogs.technet.com/askcore/archive/2008/10/31/automating-the-oobe-process-during-windows-server-2008-sysprep-mini-setup.aspx>`_
+
+#. Download and install the Windows AIK
+
+ .. note::
+ Windows AIK should not be installed on the Windows 2008 R2 VM you
+ just created. Windows AIK should not be part of the template you
+ create. It is only used to create the sysprep answer file.
+
+#. Copy the install.wim file in the \\sources directory of the Windows
+ 2008 R2 installation DVD to the hard disk. This is a very large file
+ and may take a long time to copy. Windows AIK requires the WIM file
+ to be writable.
+
+#. Start the Windows System Image Manager, which is part of the Windows
+ AIK.
+
+#. In the Windows Image pane, right click the Select a Windows image or
+ catalog file option to load the install.wim file you just copied.
+
+#. Select the Windows 2008 R2 Edition.
+
+ You may be prompted with a warning that the catalog file cannot be
+ opened. Click Yes to create a new catalog file.
+
+#. In the Answer File pane, right click to create a new answer file.
+
+#. Generate the answer file from the Windows System Image Manager using
+ the following steps:
+
+ #. The first page you need to automate is the Language and Country or
+ Region Selection page. To automate this, expand Components in your
+ Windows Image pane, right-click and add the
+ Microsoft-Windows-International-Core setting to Pass 7 oobeSystem.
+ In your Answer File pane, configure the InputLocale, SystemLocale,
+ UILanguage, and UserLocale with the appropriate settings for your
+ language and country or region. Should you have a question about
+ any of these settings, you can right-click on the specific setting
+ and select Help. This will open the appropriate CHM help file with
+ more information, including examples on the setting you are
+ attempting to configure.
+
+ |sysmanager.png|
+
+ #. You need to automate the Software License Terms Selection page,
+ otherwise known as the End-User License Agreement (EULA). To do
+ this, expand the Microsoft-Windows-Shell-Setup component.
+ High-light the OOBE setting, and add the setting to the Pass 7
+ oobeSystem. In Settings, set HideEULAPage true.
+
+ |software-license.png|
+
+ #. Make sure the license key is properly set. If you use MAK key, you
+ can just enter the MAK key on the Windows 2008 R2 VM. You need not
+ input the MAK into the Windows System Image Manager. If you use
+ KMS host for activation you need not enter the Product Key.
+ Details of Windows Volume Activation can be found at
+ `http://technet.microsoft.com/en-us/library/bb892849.aspx
+ <http://technet.microsoft.com/en-us/library/bb892849.aspx>`_
+
+ #. You need to automate is the Change Administrator Password page.
+ Expand the Microsoft-Windows-Shell-Setup component (if it is not
+ still expanded), expand UserAccounts, right-click on
+ AdministratorPassword, and add the setting to the Pass 7
+ oobeSystem configuration pass of your answer file. Under Settings,
+ specify a password next to Value.
+
+ |change-admin-password.png|
+
+ You may read the AIK documentation and set many more options that
+ suit your deployment. The steps above are the minimum needed to
+ make Windows unattended setup work.
+
+#. Save the answer file as unattend.xml. You can ignore the warning
+ messages that appear in the validation window.
+
+#. Copy the unattend.xml file into the c:\\windows\\system32\\sysprep
+ directory of the Windows 2008 R2 Virtual Machine
+
+#. Once you place the unattend.xml file in
+ c:\\windows\\system32\\sysprep directory, you run the sysprep tool as
+ follows:
+
+ .. code:: bash
+
+ cd c:\Windows\System32\sysprep
+ sysprep.exe /oobe /generalize /shutdown
+
+ The Windows 2008 R2 VM will automatically shut down after sysprep is
+ complete.
+
+
+System Preparation for Windows Server 2003 R2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Earlier versions of Windows have a different sysprep tool. Follow these
+steps for Windows Server 2003 R2.
+
+#. Extract the content of \\support\\tools\\deploy.cab on the Windows
+ installation CD into a directory called c:\\sysprep on the Windows
+ 2003 R2 VM.
+
+#. Run c:\\sysprep\\setupmgr.exe to create the sysprep.inf file.
+
+ #. Select Create New to create a new Answer File.
+
+ #. Enter “Sysprep setup” for the Type of Setup.
+
+ #. Select the appropriate OS version and edition.
+
+ #. On the License Agreement screen, select “Yes fully automate the
+ installation”.
+
+ #. Provide your name and organization.
+
+ #. Leave display settings at default.
+
+ #. Set the appropriate time zone.
+
+ #. Provide your product key.
+
+ #. Select an appropriate license mode for your deployment
+
+ #. Select “Automatically generate computer name”.
+
+ #. Type a default administrator password. If you enable the password
+ reset feature, the users will not actually use this password. This
+ password will be reset by the instance manager after the guest
+ boots up.
+
+ #. Leave Network Components at “Typical Settings”.
+
+ #. Select the “WORKGROUP” option.
+
+ #. Leave Telephony options at default.
+
+ #. Select appropriate Regional Settings.
+
+ #. Select appropriate language settings.
+
+ #. Do not install printers.
+
+ #. Do not specify “Run Once commands”.
+
+ #. You need not specify an identification string.
+
+ #. Save the Answer File as c:\\sysprep\\sysprep.inf.
+
+#. Run the following command to sysprep the image:
+
+ .. code:: bash
+
+ c:\sysprep\sysprep.exe -reseal -mini -activated
+
+ After this step the machine will automatically shut down
[7/7] cloudstack-docs-admin git commit: split templates and close #26
Posted by pd...@apache.org.
split templates and close #26
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/36338aa3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/36338aa3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/36338aa3
Branch: refs/heads/master
Commit: 36338aa32f4db7f07a97323e4ecb4f4cc201aa24
Parents: 9d3aae6
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Mar 8 10:32:39 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:32:39 2015 -0400
----------------------------------------------------------------------
source/templates.rst | 786 +---------------------------------------------
1 file changed, 5 insertions(+), 781 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/36338aa3/source/templates.rst
----------------------------------------------------------------------
diff --git a/source/templates.rst b/source/templates.rst
index eecf823..021e481 100644
--- a/source/templates.rst
+++ b/source/templates.rst
@@ -281,791 +281,15 @@ End users and Administrators may export templates from the CloudStack.
Navigate to the template in the UI and choose the Download function from
the Actions menu.
+.. include:: templates/_create_linux.rst
-Creating a Linux Template
--------------------------
+.. include:: templates/_create_windows.rst
-Linux templates should be prepared using this documentation in order to
-prepare your linux VMs for template deployment. For ease of
-documentation, the VM which you are configuring the template on will be
-referred to as "Template Master". This guide currently covers legacy
-setups which do not take advantage of UserData and cloud-init and
-assumes openssh-server is installed during installation.
+.. include:: templates/_import_ami.rst
-An overview of the procedure is as follow:
+.. include:: templates/_convert_hyperv.rst
-#. Upload your Linux ISO.
-
- For more information, see `“Adding an
- ISO” <virtual_machines.html#adding-an-iso>`_.
-
-#. Create a VM Instance with this ISO.
-
- For more information, see `“Creating
- VMs” <virtual_machines.html#creating-vms>`_.
-
-#. Prepare the Linux VM
-
-#. Create a template from the VM.
-
- For more information, see `“Creating a Template from an Existing
- Virtual Machine” <#creating-a-template-from-an-existing-virtual-machine>`_.
-
-
-System preparation for Linux
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The following steps will prepare a basic Linux installation for
-templating.
-
-#. **Installation**
-
- It is good practice to name your VM something generic during
- installation, this will ensure components such as LVM do not appear
- unique to a machine. It is recommended that the name of "localhost"
- is used for installation.
-
- .. warning::
- For CentOS, it is necessary to take unique identification out of the
- interface configuration file, for this edit
- /etc/sysconfig/network-scripts/ifcfg-eth0 and change the content to
- the following.
-
- .. code:: bash
-
- DEVICE=eth0
- TYPE=Ethernet
- BOOTPROTO=dhcp
- ONBOOT=yes
-
- The next steps updates the packages on the Template Master.
-
- - Ubuntu
-
- .. code:: bash
-
- sudo -i
- apt-get update
- apt-get upgrade -y
- apt-get install -y acpid ntp
- reboot
-
- - CentOS
-
- .. code:: bash
-
- ifup eth0
- yum update -y
- reboot
-
-#. **Password management**
-
- .. note::
- If preferred, custom users (such as ones created during the Ubuntu
- installation) should be removed. First ensure the root user account
- is enabled by giving it a password and then login as root to continue.
-
- .. code:: bash
-
- sudo passwd root
- logout
-
- As root, remove any custom user accounts created during the
- installation process.
-
- .. code:: bash
-
- deluser myuser --remove-home
-
- See :ref:`adding-password-management-to-templates` for
- instructions to setup the password management script, this will allow
- CloudStack to change your root password from the web interface.
-
-#. **Hostname Management**
-
- CentOS configures the hostname by default on boot. Unfortunately
- Ubuntu does not have this functionality, for Ubuntu installations use
- the following steps.
-
- - Ubuntu
-
- The hostname of a Templated VM is set by a custom script in
- `/etc/dhcp/dhclient-exit-hooks.d`, this script first checks if the
- current hostname is localhost, if true, it will get the host-name,
- domain-name and fixed-ip from the DHCP lease file and use those
- values to set the hostname and append the `/etc/hosts` file for
- local hostname resolution. Once this script, or a user has changed
- the hostname from localhost, it will no longer adjust system files
- regardless of its new hostname. The script also recreates
- openssh-server keys, which should have been deleted before
- templating (shown below). Save the following script to
- `/etc/dhcp/dhclient-exit-hooks.d/sethostname`, and adjust the
- permissions.
-
- .. code:: bash
-
- #!/bin/sh
- # dhclient change hostname script for Ubuntu
- oldhostname=$(hostname -s)
- if [ $oldhostname = 'localhost' ]
- then
- sleep 10 # Wait for configuration to be written to disk
- hostname=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /host-name/ { host = $3 } END { printf host } ' | sed 's/[";]//g' )
- fqdn="$hostname.$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /domain-name/ { domain = $3 } END { printf domain } ' | sed 's/[";]//g')"
- ip=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /fixed-address/ { lease = $2 } END { printf lease } ' | sed 's/[";]//g')
- echo "cloudstack-hostname: Hostname _localhost_ detected. Changing hostname and adding hosts."
- printf " Hostname: $hostname\n FQDN: $fqdn\n IP: $ip"
- # Update /etc/hosts
- awk -v i="$ip" -v f="$fqdn" -v h="$hostname" "/^127/{x=1} !/^127/ && x { x=0; print i,f,h; } { print $0; }" /etc/hosts > /etc/hosts.dhcp.tmp
- mv /etc/hosts /etc/hosts.dhcp.bak
- mv /etc/hosts.dhcp.tmp /etc/hosts
- # Rename Host
- echo $hostname > /etc/hostname
- hostname -b -F /etc/hostname
- echo $hostname > /proc/sys/kernel/hostname
- # Recreate SSH2
- export DEBIAN_FRONTEND=noninteractive
- dpkg-reconfigure openssh-server
- fi
- ### End of Script ###
-
- chmod 774 /etc/dhcp/dhclient-exit-hooks.d/sethostname
-
- .. warning::
- The following steps should be run when you are ready to template
- your Template Master. If the Template Master is rebooted during
- these steps you will have to run all the steps again. At the end
- of this process the Template Master should be shutdown and the
- template created in order to create and deploy the final template.
-
-#. **Remove the udev persistent device rules**
-
- This step removes information unique to your Template Master such as
- network MAC addresses, lease files and CD block devices, the files
- are automatically generated on next boot.
-
- - Ubuntu
-
- .. code:: bash
-
- rm -f /etc/udev/rules.d/70*
- rm -f /var/lib/dhcp/dhclient.*
-
- - CentOS
-
- .. code:: bash
-
- rm -f /etc/udev/rules.d/70*
- rm -f /var/lib/dhclient/*
-
-#. **Remove SSH Keys**
-
- This step is to ensure all your Templated VMs do not have the same
- SSH keys, which would decrease the security of the machines
- dramatically.
-
- .. code:: bash
-
- rm -f /etc/ssh/*key*
-
-#. **Cleaning log files**
-
- It is good practice to remove old logs from the Template Master.
-
- .. code:: bash
-
- cat /dev/null > /var/log/audit/audit.log 2>/dev/null
- cat /dev/null > /var/log/wtmp 2>/dev/null
- logrotate -f /etc/logrotate.conf 2>/dev/null
- rm -f /var/log/*-* /var/log/*.gz 2>/dev/null
-
-#. **Setting hostname**
-
- In order for the Ubuntu DHCP script to function and the CentOS
- dhclient to set the VM hostname they both require the Template
- Master's hostname to be "localhost", run the following commands to
- change the hostname.
-
- .. code:: bash
-
- hostname localhost
- echo "localhost" > /etc/hostname
-
-#. **Set user password to expire**
-
- This step forces the user to change the password of the VM after the
- template has been deployed.
-
- .. code:: bash
-
- passwd --expire root
-
-#. **Clearing User History**
-
- The next step clears the bash commands you have just run.
-
- .. code:: bash
-
- history -c
- unset HISTFILE
-
-#. **Shutdown the VM**
-
- Your now ready to shutdown your Template Master and create a
- template!
-
- .. code:: bash
-
- halt -p
-
-#. **Create the template!**
-
- You are now ready to create the template, for more information see
- `“Creating a Template from an Existing Virtual
- Machine” <#creating-a-template-from-an-existing-virtual-machine>`_.
-
-.. note::
- Templated VMs for both Ubuntu and CentOS may require a reboot after
- provisioning in order to pickup the hostname.
-
-
-Creating a Windows Template
----------------------------
-
-Windows templates must be prepared with Sysprep before they can be
-provisioned on multiple machines. Sysprep allows you to create a generic
-Windows template and avoid any possible SID conflicts.
-
-.. note::
- (XenServer) Windows VMs running on XenServer require PV drivers, which
- may be provided in the template or added after the VM is created. The
- PV drivers are necessary for essential management functions such as
- mounting additional volumes and ISO images, live migration, and
- graceful shutdown.
-
-An overview of the procedure is as follows:
-
-#. Upload your Windows ISO.
-
- For more information, see `“Adding an
- ISO” <virtual_machines.html#adding-an-iso>`_.
-
-#. Create a VM Instance with this ISO.
-
- For more information, see `“Creating
- VMs” <virtual_machines.html#creating-vms>`_.
-
-#. Follow the steps in Sysprep for Windows Server 2008 R2 (below) or
- Sysprep for Windows Server 2003 R2, depending on your version of
- Windows Server
-
-#. The preparation steps are complete. Now you can actually create the
- template as described in Creating the Windows Template.
-
-
-System Preparation for Windows Server 2008 R2
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-For Windows 2008 R2, you run Windows System Image Manager to create a
-custom sysprep response XML file. Windows System Image Manager is
-installed as part of the Windows Automated Installation Kit (AIK).
-Windows AIK can be downloaded from `Microsoft Download
-Center <http://www.microsoft.com/en-us/download/details.aspx?id=9085>`_.
-
-Use the following steps to run sysprep for Windows 2008 R2:
-
-.. note::
- The steps outlined here are derived from the excellent guide by
- Charity Shelbourne, originally published at `Windows Server 2008
- Sysprep Mini-Setup.
- <http://blogs.technet.com/askcore/archive/2008/10/31/automating-the-oobe-process-during-windows-server-2008-sysprep-mini-setup.aspx>`_
-
-#. Download and install the Windows AIK
-
- .. note::
- Windows AIK should not be installed on the Windows 2008 R2 VM you
- just created. Windows AIK should not be part of the template you
- create. It is only used to create the sysprep answer file.
-
-#. Copy the install.wim file in the \\sources directory of the Windows
- 2008 R2 installation DVD to the hard disk. This is a very large file
- and may take a long time to copy. Windows AIK requires the WIM file
- to be writable.
-
-#. Start the Windows System Image Manager, which is part of the Windows
- AIK.
-
-#. In the Windows Image pane, right click the Select a Windows image or
- catalog file option to load the install.wim file you just copied.
-
-#. Select the Windows 2008 R2 Edition.
-
- You may be prompted with a warning that the catalog file cannot be
- opened. Click Yes to create a new catalog file.
-
-#. In the Answer File pane, right click to create a new answer file.
-
-#. Generate the answer file from the Windows System Image Manager using
- the following steps:
-
- #. The first page you need to automate is the Language and Country or
- Region Selection page. To automate this, expand Components in your
- Windows Image pane, right-click and add the
- Microsoft-Windows-International-Core setting to Pass 7 oobeSystem.
- In your Answer File pane, configure the InputLocale, SystemLocale,
- UILanguage, and UserLocale with the appropriate settings for your
- language and country or region. Should you have a question about
- any of these settings, you can right-click on the specific setting
- and select Help. This will open the appropriate CHM help file with
- more information, including examples on the setting you are
- attempting to configure.
-
- |sysmanager.png|
-
- #. You need to automate the Software License Terms Selection page,
- otherwise known as the End-User License Agreement (EULA). To do
- this, expand the Microsoft-Windows-Shell-Setup component.
- High-light the OOBE setting, and add the setting to the Pass 7
- oobeSystem. In Settings, set HideEULAPage true.
-
- |software-license.png|
-
- #. Make sure the license key is properly set. If you use MAK key, you
- can just enter the MAK key on the Windows 2008 R2 VM. You need not
- input the MAK into the Windows System Image Manager. If you use
- KMS host for activation you need not enter the Product Key.
- Details of Windows Volume Activation can be found at
- `http://technet.microsoft.com/en-us/library/bb892849.aspx
- <http://technet.microsoft.com/en-us/library/bb892849.aspx>`_
-
- #. You need to automate is the Change Administrator Password page.
- Expand the Microsoft-Windows-Shell-Setup component (if it is not
- still expanded), expand UserAccounts, right-click on
- AdministratorPassword, and add the setting to the Pass 7
- oobeSystem configuration pass of your answer file. Under Settings,
- specify a password next to Value.
-
- |change-admin-password.png|
-
- You may read the AIK documentation and set many more options that
- suit your deployment. The steps above are the minimum needed to
- make Windows unattended setup work.
-
-#. Save the answer file as unattend.xml. You can ignore the warning
- messages that appear in the validation window.
-
-#. Copy the unattend.xml file into the c:\\windows\\system32\\sysprep
- directory of the Windows 2008 R2 Virtual Machine
-
-#. Once you place the unattend.xml file in
- c:\\windows\\system32\\sysprep directory, you run the sysprep tool as
- follows:
-
- .. code:: bash
-
- cd c:\Windows\System32\sysprep
- sysprep.exe /oobe /generalize /shutdown
-
- The Windows 2008 R2 VM will automatically shut down after sysprep is
- complete.
-
-
-System Preparation for Windows Server 2003 R2
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Earlier versions of Windows have a different sysprep tool. Follow these
-steps for Windows Server 2003 R2.
-
-#. Extract the content of \\support\\tools\\deploy.cab on the Windows
- installation CD into a directory called c:\\sysprep on the Windows
- 2003 R2 VM.
-
-#. Run c:\\sysprep\\setupmgr.exe to create the sysprep.inf file.
-
- #. Select Create New to create a new Answer File.
-
- #. Enter “Sysprep setup” for the Type of Setup.
-
- #. Select the appropriate OS version and edition.
-
- #. On the License Agreement screen, select “Yes fully automate the
- installation”.
-
- #. Provide your name and organization.
-
- #. Leave display settings at default.
-
- #. Set the appropriate time zone.
-
- #. Provide your product key.
-
- #. Select an appropriate license mode for your deployment
-
- #. Select “Automatically generate computer name”.
-
- #. Type a default administrator password. If you enable the password
- reset feature, the users will not actually use this password. This
- password will be reset by the instance manager after the guest
- boots up.
-
- #. Leave Network Components at “Typical Settings”.
-
- #. Select the “WORKGROUP” option.
-
- #. Leave Telephony options at default.
-
- #. Select appropriate Regional Settings.
-
- #. Select appropriate language settings.
-
- #. Do not install printers.
-
- #. Do not specify “Run Once commands”.
-
- #. You need not specify an identification string.
-
- #. Save the Answer File as c:\\sysprep\\sysprep.inf.
-
-#. Run the following command to sysprep the image:
-
- .. code:: bash
-
- c:\sysprep\sysprep.exe -reseal -mini -activated
-
- After this step the machine will automatically shut down
-
-
-Importing Amazon Machine Images
--------------------------------
-
-The following procedures describe how to import an Amazon Machine Image
-(AMI) into CloudStack when using the XenServer hypervisor.
-
-Assume you have an AMI file and this file is called CentOS\_6.2\_x64.
-Assume further that you are working on a CentOS host. If the AMI is a
-Fedora image, you need to be working on a Fedora host initially.
-
-You need to have a XenServer host with a file-based storage repository
-(either a local ext3 SR or an NFS SR) to convert to a VHD once the image
-file has been customized on the Centos/Fedora host.
-
-.. note::
- When copying and pasting a command, be sure the command has pasted as
- a single line before executing. Some document viewers may introduce
- unwanted line breaks in copied text.
-
-To import an AMI:
-
-#. Set up loopback on image file:
-
- .. code:: bash
-
- # mkdir -p /mnt/loop/centos62
- # mount -o loop CentOS_6.2_x64 /mnt/loop/centos54
-
-#. Install the kernel-xen package into the image. This downloads the PV
- kernel and ramdisk to the image.
-
- .. code:: bash
-
- # yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen
-
-#. Create a grub entry in /boot/grub/grub.conf.
-
- .. code:: bash
-
- # mkdir -p /mnt/loop/centos62/boot/grub
- # touch /mnt/loop/centos62/boot/grub/grub.conf
- # echo "" > /mnt/loop/centos62/boot/grub/grub.conf
-
-#. Determine the name of the PV kernel that has been installed into the
- image.
-
- .. code:: bash
-
- # cd /mnt/loop/centos62
- # ls lib/modules/
- 2.6.16.33-xenU 2.6.16-xenU 2.6.18-164.15.1.el5xen 2.6.18-164.6.1.el5.centos.plus 2.6.18-xenU-ec2-v1.0 2.6.21.7-2.fc8xen 2.6.31-302-ec2
- # ls boot/initrd*
- boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img
- # ls boot/vmlinuz*
- boot/vmlinuz-2.6.18-164.15.1.el5xen boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus boot/vmlinuz-2.6.18-xenU-ec2-v1.0 boot/vmlinuz-2.6.21-2952.fc8xen
-
- Xen kernels/ramdisk always end with "xen". For the kernel version you
- choose, there has to be an entry for that version under lib/modules,
- there has to be an initrd and vmlinuz corresponding to that. Above,
- the only kernel that satisfies this condition is
- 2.6.18-164.15.1.el5xen.
-
-#. Based on your findings, create an entry in the grub.conf file. Below
- is an example entry.
-
- .. code:: bash
-
- default=0
- timeout=5
- hiddenmenu
- title CentOS (2.6.18-164.15.1.el5xen)
- root (hd0,0)
- kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda
- initrd /boot/initrd-2.6.18-164.15.1.el5xen.img
-
-#. Edit etc/fstab, changing “sda1” to “xvda” and changing “sdb” to
- “xvdb”.
-
- .. code:: bash
-
- # cat etc/fstab
- /dev/xvda / ext3 defaults 1 1
- /dev/xvdb /mnt ext3 defaults 0 0
- none /dev/pts devpts gid=5,mode=620 0 0
- none /proc proc defaults 0 0
- none /sys sysfs defaults 0 0
-
-#. Enable login via the console. The default console device in a
- XenServer system is xvc0. Ensure that etc/inittab and etc/securetty
- have the following lines respectively:
-
- .. code:: bash
-
- # grep xvc0 etc/inittab
- co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
- # grep xvc0 etc/securetty
- xvc0
-
-#. Ensure the ramdisk supports PV disk and PV network. Customize this
- for the kernel version you have determined above.
-
- .. code:: bash
-
- # chroot /mnt/loop/centos54
- # cd /boot/
- # mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak
- # mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --omit-scsi-modules 2.6.18-164.15.1.el5xen
-
-#. Change the password.
-
- .. code:: bash
-
- # passwd
- Changing password for user root.
- New UNIX password:
- Retype new UNIX password:
- passwd: all authentication tokens updated successfully.
-
-#. Exit out of chroot.
-
- .. code:: bash
-
- # exit
-
-#. Check `etc/ssh/sshd_config` for lines allowing ssh login using a
- password.
-
- .. code:: bash
-
- # egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config
- PermitRootLogin yes
- PasswordAuthentication yes
-
-#. If you need the template to be enabled to reset passwords from the
- CloudStack UI or API, install the password change script into the
- image at this point. See :ref:`adding-password-management-to-templates`.
-
-#. Unmount and delete loopback mount.
-
- .. code:: bash
-
- # umount /mnt/loop/centos54
- # losetup -d /dev/loop0
-
-#. Copy the image file to your XenServer host's file-based storage
- repository. In the example below, the Xenserver is "xenhost". This
- XenServer has an NFS repository whose uuid is
- a9c5b8c8-536b-a193-a6dc-51af3e5ff799.
-
- .. code:: bash
-
- # scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/
-
-#. Log in to the Xenserver and create a VDI the same size as the image.
-
- .. code:: bash
-
- [root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799
- [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# ls -lh CentOS_6.2_x64
- -rw-r--r-- 1 root root 10G Mar 16 16:49 CentOS_6.2_x64
- [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-create virtual-size=10GiB sr-uuid=a9c5b8c8-536b-a193-a6dc-51af3e5ff799 type=user name-label="Centos 6.2 x86_64"
- cad7317c-258b-4ef7-b207-cdf0283a7923
-
-#. Import the image file into the VDI. This may take 10–20 minutes.
-
- .. code:: bash
-
- [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923
-
-#. Locate a the VHD file. This is the file with the VDI’s UUID as its
- name. Compress it and upload it to your web server.
-
- .. code:: bash
-
- [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2
- [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# scp CentOS_6.2_x64.vhd.bz2 webserver:/var/www/html/templates/
-
-
-Converting a Hyper-V VM to a Template
--------------------------------------
-
-To convert a Hyper-V VM to a XenServer-compatible CloudStack template,
-you will need a standalone XenServer host with an attached NFS VHD SR.
-Use whatever XenServer version you are using with CloudStack, but use
-XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6).
-Additionally, it may help to have an attached NFS ISO SR.
-
-For Linux VMs, you may need to do some preparation in Hyper-V before
-trying to get the VM to work in XenServer. Clone the VM and work on the
-clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V
-Integration Components and check for any references to device names in
-/etc/fstab:
-
-#. From the linux\_ic/drivers/dist directory, run make uninstall (where
- "linux\_ic" is the path to the copied Hyper-V Integration Components
- files).
-
-#. Restore the original initrd from backup in /boot/ (the backup is
- named \*.backup0).
-
-#. Remove the "hdX=noprobe" entries from /boot/grub/menu.lst.
-
-#. Check /etc/fstab for any partitions mounted by device name. Change
- those entries (if any) to mount by LABEL or UUID. You can get that
- information with the blkid command.
-
-The next step is make sure the VM is not running in Hyper-V, then get
-the VHD into XenServer. There are two options for doing this.
-
-Option one:
-
-#. Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual
- Appliance Tools>Disk Image Import.
-
-#. Choose the VHD, then click Next.
-
-#. Name the VM, choose the NFS VHD SR under Storage, enable "Run
- Operating System Fixups" and choose the NFS ISO SR.
-
-#. Click Next, then Finish. A VM should be created.
-
-Option two:
-
-#. Run XenConvert, under From choose VHD, under To choose XenServer.
- Click Next.
-
-#. Choose the VHD, then click Next.
-
-#. Input the XenServer host info, then click Next.
-
-#. Name the VM, then click Next, then Convert. A VM should be created.
-
-Once you have a VM created from the Hyper-V VHD, prepare it using the
-following steps:
-
-#. Boot the VM, uninstall Hyper-V Integration Services, and reboot.
-
-#. Install XenServer Tools, then reboot.
-
-#. Prepare the VM as desired. For example, run sysprep on Windows VMs.
- See `“Creating a Windows
- Template” <#creating-a-windows-template>`_.
-
-Either option above will create a VM in HVM mode. This is fine for
-Windows VMs, but Linux VMs may not perform optimally. Converting a Linux
-VM to PV mode will require additional steps and will vary by
-distribution.
-
-#. Shut down the VM and copy the VHD from the NFS storage to a web
- server; for example, mount the NFS share on the web server and copy
- it, or from the XenServer host use sftp or scp to upload it to the
- web server.
-
-#. In CloudStack, create a new template using the following values:
-
- - URL. Give the URL for the VHD
-
- - OS Type. Use the appropriate OS. For PV mode on CentOS, choose
- Other PV (32-bit) or Other PV (64-bit). This choice is available
- only for XenServer.
-
- - Hypervisor. XenServer
-
- - Format. VHD
-
-The template will be created, and you can create instances from it.
-
-
-.. _adding-password-management-to-templates:
-
-Adding Password Management to Your Templates
---------------------------------------------
-
-CloudStack provides an optional password reset feature that allows users
-to set a temporary admin or root password as well as reset the existing
-admin or root password from the CloudStack UI.
-
-To enable the Reset Password feature, you will need to download an
-additional script to patch your template. When you later upload the
-template into CloudStack, you can specify whether reset admin/root
-password feature should be enabled for this template.
-
-The password management feature works always resets the account password
-on instance boot. The script does an HTTP call to the virtual router to
-retrieve the account password that should be set. As long as the virtual
-router is accessible the guest will have access to the account password
-that should be used. When the user requests a password reset the
-management server generates and sends a new password to the virtual
-router for the account. Thus an instance reboot is necessary to effect
-any password changes.
-
-If the script is unable to contact the virtual router during instance
-boot it will not set the password but boot will continue normally.
-
-
-Linux OS Installation
-~~~~~~~~~~~~~~~~~~~~~
-
-Use the following steps to begin the Linux OS installation:
-
-#. Download the script file cloud-set-guest-password:
-
- - `http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in
- <http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in>`_
-
-#. Copy this file to /etc/init.d.
-
- On some Linux distributions, copy the file to ``/etc/rc.d/init.d``.
-
-#. Run the following command to make the script executable:
-
- .. code:: bash
-
- chmod +x /etc/init.d/cloud-set-guest-password
-
-#. Depending on the Linux distribution, continue with the appropriate
- step.
-
- On Fedora, CentOS/RHEL, and Debian, run:
-
- .. code:: bash
-
- chkconfig --add cloud-set-guest-password
-
-
-Windows OS Installation
-~~~~~~~~~~~~~~~~~~~~~~~
-
-Download the installer, CloudInstanceManager.msi, from the `Download
-page <http://sourceforge.net/projects/cloudstack/files/Password%20Management%20Scripts/CloudInstanceManager.msi/download>`_
-and run the installer in the newly created Windows VM.
+.. include:: templates/_password.rst
Deleting Templates
[4/7] cloudstack-docs-admin git commit: Update templates.rst
Posted by pd...@apache.org.
Update templates.rst
echo does not print backslash-newline as a newline.
Use printf instead, and remove trailing spaces
Signed-off-by: Pierre-Luc Dion <pd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/4ee92ca1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/4ee92ca1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/4ee92ca1
Branch: refs/heads/master
Commit: 4ee92ca1c1add254d68bc3fde0d4dbe539522fea
Parents: 708cb99
Author: Martijn Koster <ma...@greenhills.co.uk>
Authored: Wed Feb 18 23:17:32 2015 +0000
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:16:47 2015 -0400
----------------------------------------------------------------------
source/templates.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/4ee92ca1/source/templates.rst
----------------------------------------------------------------------
diff --git a/source/templates.rst b/source/templates.rst
index 69480ad..0673032 100644
--- a/source/templates.rst
+++ b/source/templates.rst
@@ -414,7 +414,7 @@ templating.
fqdn="$hostname.$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /domain-name/ { domain = $3 } END { printf domain } ' | sed 's/[";]//g')"
ip=$(cat /var/lib/dhcp/dhclient.eth0.leases | awk ' /fixed-address/ { lease = $2 } END { printf lease } ' | sed 's/[";]//g')
echo "cloudstack-hostname: Hostname _localhost_ detected. Changing hostname and adding hosts."
- echo " Hostname: $hostname \n FQDN: $fqdn \n IP: $ip"
+ printf " Hostname: $hostname\n FQDN: $fqdn\n IP: $ip"
# Update /etc/hosts
awk -v i="$ip" -v f="$fqdn" -v h="$hostname" "/^127/{x=1} !/^127/ && x { x=0; print i,f,h; } { print $0; }" /etc/hosts > /etc/hosts.dhcp.tmp
mv /etc/hosts /etc/hosts.dhcp.bak
[3/7] cloudstack-docs-admin git commit: Update templates.rst
Posted by pd...@apache.org.
Update templates.rst
There is no /etc/init.d/hostname.sh in ubuntu 14.04.1.
You could instead do 'service hostname start', or just do 'hostname -b -F /etc/hostname' which is what that upscript actually does.
Signed-off-by: Pierre-Luc Dion <pd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/708cb991
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/708cb991
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/708cb991
Branch: refs/heads/master
Commit: 708cb991c511e578fbd9344c6f2d6755af33e81c
Parents: ee2156c
Author: Martijn Koster <ma...@greenhills.co.uk>
Authored: Wed Feb 18 23:14:13 2015 +0000
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:16:47 2015 -0400
----------------------------------------------------------------------
source/templates.rst | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/708cb991/source/templates.rst
----------------------------------------------------------------------
diff --git a/source/templates.rst b/source/templates.rst
index b473043..69480ad 100644
--- a/source/templates.rst
+++ b/source/templates.rst
@@ -421,8 +421,7 @@ templating.
mv /etc/hosts.dhcp.tmp /etc/hosts
# Rename Host
echo $hostname > /etc/hostname
- hostname $hostname
- /etc/init.d/hostname.sh start
+ hostname -b -F /etc/hostname
echo $hostname > /proc/sys/kernel/hostname
# Recreate SSH2
export DEBIAN_FRONTEND=noninteractive
[2/7] cloudstack-docs-admin git commit: Update templates.rst
Posted by pd...@apache.org.
Update templates.rst
it's -> its
Signed-off-by: Pierre-Luc Dion <pd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/9b36171d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/9b36171d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/9b36171d
Branch: refs/heads/master
Commit: 9b36171d0c61e49ea1619c9737441344e6c13dd3
Parents: 4ee92ca
Author: Martijn Koster <ma...@greenhills.co.uk>
Authored: Wed Feb 18 23:20:46 2015 +0000
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:16:47 2015 -0400
----------------------------------------------------------------------
source/templates.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9b36171d/source/templates.rst
----------------------------------------------------------------------
diff --git a/source/templates.rst b/source/templates.rst
index 0673032..eecf823 100644
--- a/source/templates.rst
+++ b/source/templates.rst
@@ -396,7 +396,7 @@ templating.
values to set the hostname and append the `/etc/hosts` file for
local hostname resolution. Once this script, or a user has changed
the hostname from localhost, it will no longer adjust system files
- regardless of it's new hostname. The script also recreates
+ regardless of its new hostname. The script also recreates
openssh-server keys, which should have been deleted before
templating (shown below). Save the following script to
`/etc/dhcp/dhclient-exit-hooks.d/sethostname`, and adjust the
[6/7] cloudstack-docs-admin git commit: split templates.rst
Posted by pd...@apache.org.
split templates.rst
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/9d3aae6f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/9d3aae6f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/9d3aae6f
Branch: refs/heads/master
Commit: 9d3aae6fbdac6a222d37604ff7ac3815336c6668
Parents: 04505ca
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Mar 8 10:31:43 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:31:43 2015 -0400
----------------------------------------------------------------------
source/templates/_convert_hyperv.rst | 88 ++++++++++++++
source/templates/_import_ami.rst | 192 ++++++++++++++++++++++++++++++
source/templates/_password.rst | 79 ++++++++++++
3 files changed, 359 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_convert_hyperv.rst
----------------------------------------------------------------------
diff --git a/source/templates/_convert_hyperv.rst b/source/templates/_convert_hyperv.rst
new file mode 100644
index 0000000..9e15490
--- /dev/null
+++ b/source/templates/_convert_hyperv.rst
@@ -0,0 +1,88 @@
+Converting a Hyper-V VM to a Template
+-------------------------------------
+
+To convert a Hyper-V VM to a XenServer-compatible CloudStack template,
+you will need a standalone XenServer host with an attached NFS VHD SR.
+Use whatever XenServer version you are using with CloudStack, but use
+XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6).
+Additionally, it may help to have an attached NFS ISO SR.
+
+For Linux VMs, you may need to do some preparation in Hyper-V before
+trying to get the VM to work in XenServer. Clone the VM and work on the
+clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V
+Integration Components and check for any references to device names in
+/etc/fstab:
+
+#. From the linux\_ic/drivers/dist directory, run make uninstall (where
+ "linux\_ic" is the path to the copied Hyper-V Integration Components
+ files).
+
+#. Restore the original initrd from backup in /boot/ (the backup is
+ named \*.backup0).
+
+#. Remove the "hdX=noprobe" entries from /boot/grub/menu.lst.
+
+#. Check /etc/fstab for any partitions mounted by device name. Change
+ those entries (if any) to mount by LABEL or UUID. You can get that
+ information with the blkid command.
+
+The next step is make sure the VM is not running in Hyper-V, then get
+the VHD into XenServer. There are two options for doing this.
+
+Option one:
+
+#. Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual
+ Appliance Tools>Disk Image Import.
+
+#. Choose the VHD, then click Next.
+
+#. Name the VM, choose the NFS VHD SR under Storage, enable "Run
+ Operating System Fixups" and choose the NFS ISO SR.
+
+#. Click Next, then Finish. A VM should be created.
+
+Option two:
+
+#. Run XenConvert, under From choose VHD, under To choose XenServer.
+ Click Next.
+
+#. Choose the VHD, then click Next.
+
+#. Input the XenServer host info, then click Next.
+
+#. Name the VM, then click Next, then Convert. A VM should be created.
+
+Once you have a VM created from the Hyper-V VHD, prepare it using the
+following steps:
+
+#. Boot the VM, uninstall Hyper-V Integration Services, and reboot.
+
+#. Install XenServer Tools, then reboot.
+
+#. Prepare the VM as desired. For example, run sysprep on Windows VMs.
+ See `“Creating a Windows
+ Template” <#creating-a-windows-template>`_.
+
+Either option above will create a VM in HVM mode. This is fine for
+Windows VMs, but Linux VMs may not perform optimally. Converting a Linux
+VM to PV mode will require additional steps and will vary by
+distribution.
+
+#. Shut down the VM and copy the VHD from the NFS storage to a web
+ server; for example, mount the NFS share on the web server and copy
+ it, or from the XenServer host use sftp or scp to upload it to the
+ web server.
+
+#. In CloudStack, create a new template using the following values:
+
+ - URL. Give the URL for the VHD
+
+ - OS Type. Use the appropriate OS. For PV mode on CentOS, choose
+ Other PV (32-bit) or Other PV (64-bit). This choice is available
+ only for XenServer.
+
+ - Hypervisor. XenServer
+
+ - Format. VHD
+
+The template will be created, and you can create instances from it.
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_import_ami.rst
----------------------------------------------------------------------
diff --git a/source/templates/_import_ami.rst b/source/templates/_import_ami.rst
new file mode 100644
index 0000000..b81829f
--- /dev/null
+++ b/source/templates/_import_ami.rst
@@ -0,0 +1,192 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information#
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+Importing Amazon Machine Images
+-------------------------------
+
+The following procedures describe how to import an Amazon Machine Image
+(AMI) into CloudStack when using the XenServer hypervisor.
+
+Assume you have an AMI file and this file is called CentOS\_6.2\_x64.
+Assume further that you are working on a CentOS host. If the AMI is a
+Fedora image, you need to be working on a Fedora host initially.
+
+You need to have a XenServer host with a file-based storage repository
+(either a local ext3 SR or an NFS SR) to convert to a VHD once the image
+file has been customized on the Centos/Fedora host.
+
+.. note::
+ When copying and pasting a command, be sure the command has pasted as
+ a single line before executing. Some document viewers may introduce
+ unwanted line breaks in copied text.
+
+To import an AMI:
+
+#. Set up loopback on image file:
+
+ .. code:: bash
+
+ # mkdir -p /mnt/loop/centos62
+ # mount -o loop CentOS_6.2_x64 /mnt/loop/centos54
+
+#. Install the kernel-xen package into the image. This downloads the PV
+ kernel and ramdisk to the image.
+
+ .. code:: bash
+
+ # yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen
+
+#. Create a grub entry in /boot/grub/grub.conf.
+
+ .. code:: bash
+
+ # mkdir -p /mnt/loop/centos62/boot/grub
+ # touch /mnt/loop/centos62/boot/grub/grub.conf
+ # echo "" > /mnt/loop/centos62/boot/grub/grub.conf
+
+#. Determine the name of the PV kernel that has been installed into the
+ image.
+
+ .. code:: bash
+
+ # cd /mnt/loop/centos62
+ # ls lib/modules/
+ 2.6.16.33-xenU 2.6.16-xenU 2.6.18-164.15.1.el5xen 2.6.18-164.6.1.el5.centos.plus 2.6.18-xenU-ec2-v1.0 2.6.21.7-2.fc8xen 2.6.31-302-ec2
+ # ls boot/initrd*
+ boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img
+ # ls boot/vmlinuz*
+ boot/vmlinuz-2.6.18-164.15.1.el5xen boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus boot/vmlinuz-2.6.18-xenU-ec2-v1.0 boot/vmlinuz-2.6.21-2952.fc8xen
+
+ Xen kernels/ramdisk always end with "xen". For the kernel version you
+ choose, there has to be an entry for that version under lib/modules,
+ there has to be an initrd and vmlinuz corresponding to that. Above,
+ the only kernel that satisfies this condition is
+ 2.6.18-164.15.1.el5xen.
+
+#. Based on your findings, create an entry in the grub.conf file. Below
+ is an example entry.
+
+ .. code:: bash
+
+ default=0
+ timeout=5
+ hiddenmenu
+ title CentOS (2.6.18-164.15.1.el5xen)
+ root (hd0,0)
+ kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda
+ initrd /boot/initrd-2.6.18-164.15.1.el5xen.img
+
+#. Edit etc/fstab, changing “sda1” to “xvda” and changing “sdb” to
+ “xvdb”.
+
+ .. code:: bash
+
+ # cat etc/fstab
+ /dev/xvda / ext3 defaults 1 1
+ /dev/xvdb /mnt ext3 defaults 0 0
+ none /dev/pts devpts gid=5,mode=620 0 0
+ none /proc proc defaults 0 0
+ none /sys sysfs defaults 0 0
+
+#. Enable login via the console. The default console device in a
+ XenServer system is xvc0. Ensure that etc/inittab and etc/securetty
+ have the following lines respectively:
+
+ .. code:: bash
+
+ # grep xvc0 etc/inittab
+ co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
+ # grep xvc0 etc/securetty
+ xvc0
+
+#. Ensure the ramdisk supports PV disk and PV network. Customize this
+ for the kernel version you have determined above.
+
+ .. code:: bash
+
+ # chroot /mnt/loop/centos54
+ # cd /boot/
+ # mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak
+ # mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --omit-scsi-modules 2.6.18-164.15.1.el5xen
+
+#. Change the password.
+
+ .. code:: bash
+
+ # passwd
+ Changing password for user root.
+ New UNIX password:
+ Retype new UNIX password:
+ passwd: all authentication tokens updated successfully.
+
+#. Exit out of chroot.
+
+ .. code:: bash
+
+ # exit
+
+#. Check `etc/ssh/sshd_config` for lines allowing ssh login using a
+ password.
+
+ .. code:: bash
+
+ # egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config
+ PermitRootLogin yes
+ PasswordAuthentication yes
+
+#. If you need the template to be enabled to reset passwords from the
+ CloudStack UI or API, install the password change script into the
+ image at this point. See :ref:`adding-password-management-to-templates`.
+
+#. Unmount and delete loopback mount.
+
+ .. code:: bash
+
+ # umount /mnt/loop/centos54
+ # losetup -d /dev/loop0
+
+#. Copy the image file to your XenServer host's file-based storage
+ repository. In the example below, the Xenserver is "xenhost". This
+ XenServer has an NFS repository whose uuid is
+ a9c5b8c8-536b-a193-a6dc-51af3e5ff799.
+
+ .. code:: bash
+
+ # scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/
+
+#. Log in to the Xenserver and create a VDI the same size as the image.
+
+ .. code:: bash
+
+ [root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799
+ [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# ls -lh CentOS_6.2_x64
+ -rw-r--r-- 1 root root 10G Mar 16 16:49 CentOS_6.2_x64
+ [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-create virtual-size=10GiB sr-uuid=a9c5b8c8-536b-a193-a6dc-51af3e5ff799 type=user name-label="Centos 6.2 x86_64"
+ cad7317c-258b-4ef7-b207-cdf0283a7923
+
+#. Import the image file into the VDI. This may take 10–20 minutes.
+
+ .. code:: bash
+
+ [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923
+
+#. Locate a the VHD file. This is the file with the VDI’s UUID as its
+ name. Compress it and upload it to your web server.
+
+ .. code:: bash
+
+ [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2
+ [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# scp CentOS_6.2_x64.vhd.bz2 webserver:/var/www/html/templates/
http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_password.rst
----------------------------------------------------------------------
diff --git a/source/templates/_password.rst b/source/templates/_password.rst
new file mode 100644
index 0000000..90a1b60
--- /dev/null
+++ b/source/templates/_password.rst
@@ -0,0 +1,79 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information#
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+.. _adding-password-management-to-templates:
+
+Adding Password Management to Your Templates
+--------------------------------------------
+
+CloudStack provides an optional password reset feature that allows users
+to set a temporary admin or root password as well as reset the existing
+admin or root password from the CloudStack UI.
+
+To enable the Reset Password feature, you will need to download an
+additional script to patch your template. When you later upload the
+template into CloudStack, you can specify whether reset admin/root
+password feature should be enabled for this template.
+
+The password management feature works always resets the account password
+on instance boot. The script does an HTTP call to the virtual router to
+retrieve the account password that should be set. As long as the virtual
+router is accessible the guest will have access to the account password
+that should be used. When the user requests a password reset the
+management server generates and sends a new password to the virtual
+router for the account. Thus an instance reboot is necessary to effect
+any password changes.
+
+If the script is unable to contact the virtual router during instance
+boot it will not set the password but boot will continue normally.
+
+
+Linux OS Installation
+~~~~~~~~~~~~~~~~~~~~~
+
+Use the following steps to begin the Linux OS installation:
+
+#. Download the script file cloud-set-guest-password:
+
+ - `http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in
+ <http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in>`_
+
+#. Copy this file to /etc/init.d.
+
+ On some Linux distributions, copy the file to ``/etc/rc.d/init.d``.
+
+#. Run the following command to make the script executable:
+
+ .. code:: bash
+
+ chmod +x /etc/init.d/cloud-set-guest-password
+
+#. Depending on the Linux distribution, continue with the appropriate
+ step.
+
+ On Fedora, CentOS/RHEL, and Debian, run:
+
+ .. code:: bash
+
+ chkconfig --add cloud-set-guest-password
+
+
+Windows OS Installation
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Download the installer, CloudInstanceManager.msi, from the `Download
+page <http://sourceforge.net/projects/cloudstack/files/Password%20Management%20Scripts/CloudInstanceManager.msi/download>`_
+and run the installer in the newly created Windows VM.