Step-by-Step Guide: Set Up a Linode Compute Instance with Best Practices
Linode (Akamai Cloud) offers powerful cloud hosting with lightning-fast performance, transparent pricing, and a user-friendly interface, making it ideal for everything from personal projects to large-scale deployments.
Ready to unlock the full potential of your cloud infrastructure? Let's dive into setting up, backing up, and restoring your Linode compute instances!
Prerequisites #
Before you begin, ensure you have:
- A Linode (Akamai) account.
- SSH access to your terminal.
- Basic knowledge of Linux commands.
Set Up Compute Instance #
Compute instance: In cloud computing, a compute instance is basically the same as a virtual machine (VM). It's a virtual computer with its own CPU, RAM, storage, operating system, and network access.
Cloud providers like Linode, AWS, and GCP use the term compute instance to describe a VM running in their infrastructure. The term reflects a cloud-focused way of thinking, but functionally, it's a virtual machine.
Step 1: Create Linode #
- Log in to Linode Cloud Manager.
- Go to Compute > Linodes and click Create Linode.
- Configure:
- Region: Nearest to your location
- OS: Ubuntu (latest LTS)
- Plan: Shared CPU Nanode 1GB
- Label: Provide descriptive label (example:
prod-web-blog
) - Root password: Strong and secure
- Disk Encryption: Enable
- Click Create Linode.
Best practices for labels:
Practice | Description |
---|---|
Use consistent naming conventions | Create a standard format for all labels, such as <environment>-<service>-<description> . Example: prod-web-blog . |
Include environment information | Indicate if the Linode is for prod , dev , stage , or test . |
Reflect function or role | Specify the purpose of the Linode, such as db , web , cache , or proxy . |
Include location (optional) | If you deploy in multiple data centres, include the datacentre or region code, like lon1 , fra1 , nyc1 . |
Keep it human-readable | Avoid overly cryptic labels. A person should understand the label quickly. |
Use lowercase letters | Lowercase is standard practice and avoids confusion in scripts and automation. |
Avoid special characters | Use hyphens - to separate words, and avoid underscores _ , spaces, and special symbols. |
Instance numbering (optional) | Add sequential numbers if you have multiple similar Linodes. Example: prod-api-lon1-02 . |
Examples:
- Production web server in London:
prod-web-lon1-01
- Development database in Frankfurt:
dev-db-fra1-01
Step 2: Set Up Firewall #
Firewall label: use a format like prod-web-fw
or dev-db-fw
.
- Go to Networking > Firewalls and click Create Firewall.
- Configure:
- Label: Provide descriptive label (example:
prod-web-fw
). - Default inbound policy: Drop
- Default outbound policy: Accept
- Linodes: Select target Linode(s)
- Label: Provide descriptive label (example:
- Add Custom Inbound Rules as needed.
- Click Save Changes.
Example custom inbound rules:
Service | Protocol | Port | Sources | Action |
---|---|---|---|---|
HTTP | TCP | 80 | All IPv4, All IPv6 | Accept |
HTTPS | TCP | 443 | All IPv4, All IPv6 | Accept |
SSH | TCP | 22 | All IPv4, All IPv6 | Accept |
Step 3: Access Instance via SSH #
Log in as root:
ssh root@<public_ipv4>
Step 4: Update Packages #
sudo apt update && sudo apt upgrade -y
Step 5: Create Non-Root User #
Create user with sudo privileges:
adduser <user>
usermod -aG sudo <user>
Check user privileges:
groups <user>
Logout:
logout
Log in as non-root user to verify:
ssh <user>@<public_ipv4>
Step 6: Set Hostname #
To see the hostname change, log out and log back in.
hostnamectl set-hostname <hostname>
- Example
<hostname>
:prod-web-blog
- Result: The prompt will change from
localhost
to the new hostname.
Step 7: Set Timezone #
sudo dpkg-reconfigure tzdata
Verify time:
date
Or:
timedatectl