Create and Manage StackScripts - A Tutorial
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
What are StackScripts?
StackScripts provide Linode users with the ability to automate the deployment of custom systems on top of Linode’s default Linux distribution images. For example, every time you deploy a new Linode you might execute the same tasks, including:
- Updating your system’s software
- Installing your favorite Linux tools
- Adding a limited user account
These tasks can be automated using a StackScript that performs these actions for you as part of your Linode’s first boot process.
All StackScripts are stored in the Linode Cloud Manager and can be accessed whenever you deploy a Linode. A StackScript authored by you is an Account StackScript. While a Community StackScript is a StackScript created by a Linode community member that has made their StackScript publicly available in the Linode Cloud Manager.
In this Guide
This guide shows you how to do the following:
- Create a new StackScript
- Edit an Account StackScript
- Make your Account StackScript Public
- Delete an Account StackScript
NoteFor information on authoring a script to be used in a Linode StackScript, see the Writing Scripts for Use with Linode StackScripts.
Create a New StackScript
Log into the Linode Cloud Manager.
Click on the StackScripts link in the left-hand navigation menu. You are brought to the StackScripts page.
Viewing the Account StackScripts section, click on the Create New StackScript link at the top of the page.
On the Create New StackScript page, provide the required configurations to create your StackScript.
Field Description StackScript Label The name with which to identify your StackScript. Required. Description An overview of what your StackScript does. Target Images The Linux distributions that can run this StackScript. Required. Script The body of the script. See the Writing Scripts for Use with Linode StackScripts section for more details. Required. Revision Note A short description of the updates made to your StackScript in this version of your script. The file below displays an example of a simple script that executes some basic set up steps on a Linode. Review the example’s comments for details on what each line of the script does.
- File: Example Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/bash # This block defines the variables the user of the script needs to provide # when deploying using this script. # # #<UDF name="hostname" label="The hostname for the new Linode."> # HOSTNAME= # #<UDF name="fqdn" label="The new Linode's Fully Qualified Domain Name"> # FQDN=
# This sets the variable $IPADDR to the IP address the new Linode receives. IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
# This updates the packages on the system from the distribution repositories. apt-get update apt-get upgrade -y
# This section sets the hostname. echo $HOSTNAME > /etc/hostname hostname -F /etc/hostname
# This section sets the Fully Qualified Domain Name (FQDN) in the hosts file. echo $IPADDR $FQDN $HOSTNAME >> /etc/hosts
The file below displays an example of a simple script that executes some basic set up steps on a …
Click Save when you are done (and you can always edit your script later if needed). You are brought back to the StackScripts page, where your new StackScript is visible and ready to use with a new Linode deployment.
Note
To deploy a new Linode with your StackScript, follow the steps in the Deploying a New Linode Using a StackScript guide.
Manage StackScripts
Edit an Account StackScript
After you’ve created an Account StackScript, you can go back and edit it as required. These instructions show you how to access a StackScript for editing.
Log into the Linode Cloud Manager.
Click on the StackScripts link in the left-hand navigation menu. You are brought to the StackScripts page.
A list of all of your account’s StackScripts appears under the Account StackScripts tab. This includes both private and public StackScripts. Click on the more options ellipsis corresponding to the StackScript you’d like to modify and select Edit from the dropdown menu.
On your StackScript’s Edit page, modify it as needed and click Save to keep your changes.
Make an Account StackScript Public
You can make any of your Account StackScripts public. When an account StackScript is public it becomes available to the rest of the Linode Community in the Cloud Manager as a Community StackScript.
CautionOnce you make an Account StackScript public, you will not be able to make it private again or to delete it. You can, however, edit your public StackScript, if needed.
Log into the Linode Cloud Manager.
Click on the StackScripts link in the left-hand navigation menu. You are brought to the StackScripts page.
A list of all of your account’s StackScripts appears under the Account StackScripts tab. This includes both private and public StackScripts. Click on the more options ellipsis corresponding to the StackScript you’d like to make public and select Make StackScript Public from the dropdown menu.
A dialog box appears asking you to confirm the action. Click on Yes, make me a star! if you would like to proceed. You are brought back to the Account StackScripts page.
Note
Your public Account StackScript is available to you for use on the Account StackScripts page. For Linode Community members, your StackScript is available to them from the Community StackScripts page.
Delete an Account StackScript
NoteYou cannot delete Account StackScripts that have been made public.
Click on the StackScripts link in the left-hand navigation menu. You are brought to the StackScripts page.
A list of all of your account’s StackScripts appears under the Account StackScripts tab. Click on the more options ellipsis corresponding to the StackScript you’d like to delete and select Delete from the dropdown menu.
A dialog box appears asking you to confirm the action. Click on Delete if you would like to proceed.
Next Steps
Now that you have created a StackScript, you can deploy a Linode using your StackScript. See the Deploying a New Linode Using a StackScript guide for details.
This page was originally published on