Get started with Linode scripts.

Linode $100 Credit for new users 👉

Step 1

Once you create an account with Linode, you’ll have access to the Linode dashboard. Here, you will click Create, then Linode, and it will take you to the “Create” menu, where you can set the specific settings for your server.

If you want to store your settings so you can quickly use them again to set up a similar server, You can select the “Create Using Command Line” button at the bottom.

Copy this curl command into your favorite text editor or save it as a quick launch script. For this example, I’m going to use the Linux command line to create a script for quick launching VPS, Virtual Private Servers, that I will use for simple one-and-done testing purposes.

Step 2

On the command line, I’ll create a new file name, Linode-start. I’m using the text editor nano.

bmorgan@pdt50:~$ sudo nano linode-start

Then, I’ll pass the curl command that I copied from the Linode web interface. Your command will be different depending on the setting you chose in step 1.

curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X POST -d '{
    "authorized_users": [
    "backups_enabled": false,
    "booted": true,
    "image": "linode/ubuntu22.04",
    "label": "ubuntu-us-ord",
    "private_ip": false,
    "region": "us-ord",
    "root_pass": "msHOA2b2021",
    "tags": [],
    "type": "g6-nanode-1"

Looking at the curl command, it references a variable called “$TOKEN.” This is your user’s API token.

Step 3

To create your API token, click the drop-down menu by your user name, then select API Tokens.

In the menu that opens you select Create A Personal Access Token

The created menu will open, and you will be able to give your token a memorable name, set an expiration date, and limit its access as needed for your specific environment. When you are ready click Create Token at the bottom

Be sure to copy the Access Token it gives you because if you close this screen, you won’t be able to copy it again.

Step 4

Take the access token you just created and copy it into your command line script, replacing the variable $TOKEN. Be sure you have the correct set of quotations around it, or it will not run.

Now save your script and make it executable by running the chmod command

bmorgan@pdt50:~$ sudo chmod +x linode-start

You can now run the script to create a single-use VPS from the command line, saving you the time of having to log in through the web interface every time. It will echo back out your settings, but as long as you don’t see an ERROR, it should run successfully.

bmorgan@pdt50:~$ ./linode-start
{"id": 53572313, "label": "ubuntu-us-ord", "group": "", "status": "provisioning", "created": "2023-12-30T15:55:50", "updated": "2023-12-30T15:55:50", "type": "g6-nanode-1", "ipv4": [""], "ipv6": "2600:3c06::f03c:94ff:fefb:9c0e/128", "image": "linode/ubuntu22.04", "region": "us-ord", "specs": {"disk": 25600, "memory": 1024, "vcpus": 1, "gpus": 0, "transfer": 1000}, "alerts": {"cpu": 90, "network_in": 10, "network_out": 10, "transfer_quota": 80, "io": 10000}, "backups": {"enabled": false, "available": false, "schedule": {"day": null, "window": null}, "last_successful": null}, "hypervisor": "kvm", "watchdog_enabled": true, "tags": [], "host_uuid": "20929382d8aa656d869282135fa74e8eeb43ec25", "has_user_data": false}bmorgan@pdt50:~$

You can verify this by going back to the linode web interface and you should see a new linode instance starting.

Final Thoughts

Linode will only let you use a label one time, and this script stores a “Default” label. Before you run the script a second time, you will need to either destroy the Linode we just created or rename it.

Rename Linode Server

Renaming the server is as simple as clicking on its current name to go to its individual settings menu and then clicking the edit icon next to the name. This will open a text box allowing you to rename it to something memorable or descriptive of what it will be doing if you are going to be using it long term.

Destroying a Linode Server

If this was a single-use “test” server and you want to remove it. You can click the Settings label, then scroll all the way to the bottom, and you will see a Delete button.

A prompt will then come up asking to confirm its deletion.

Scroll to Top