π§ How to Host MP3s on Linode Object Storage and Embed Them in WordPress
Take control of your file hosting with Linode Object Storage and simplify your WordPress audio playlists. This guide walks you through:
- Creating a bucket
- Uploading MP3s
- Generating playlist shortcode
- Embedding everything in WordPress
π§ Step 1: Log Into Your Linode Account
- Go to: https://cloud.linode.com
- Log in to your Linode account
- In the left sidebar, click Object Storage
π Step 2: Create a Bucket
- Click Create Bucket
- Fill in the following:
- Label: Something simple, like
your-bucket-name
- Region: Choose the same as your server for low latency (e.g.,
us-southeast
) - β Leave Cluster as default
- Label: Something simple, like
- Click Create Bucket
π Step 3: Create Access Keys
- Under Object Storage, click the Access Keys tab
- Click Create Access Key
- Fill in:
- Label: e.g.,
wpmp3
- Bucket: Select your created bucket
- Label: e.g.,
- Copy and save:
- Access Key
- Secret Key β οΈ You wonβt be able to view this again
π» Using s3cmd
with Linode
β
Step 1: Install s3cmd
macOS (Homebrew):
brew install s3cmd
Ubuntu/Debian:
sudo apt update
sudo apt install s3cmd
β
Step 2: Configure s3cmd
for Linode
Run:
s3cmd --configure
Enter the following when prompted:
Prompt | What to Enter |
---|---|
Access Key | From Linode Object Storage |
Secret Key | From Linode Object Storage |
S3 Endpoint | us-east-1.linodeobjects.com |
Use HTTPS | Yes |
HTTP Proxy | Leave blank |
Test | Type y |
Save | Type y |
π Settings are saved in ~/.s3cfg
β Step 3: Apply a Bucket Policy
Create a file named bucket-policy.json
and paste this in:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}
Then run:
s3cmd setpolicy ~/bucket-policy.json s3://your-bucket-name/
Verify:
s3cmd info s3://your-bucket-name/
πΆ Upload Your MP3 Folder
Assuming your local folder is:
/Users/me/Music/beach/
And your bucket is:
s3://your-bucket-name/
Upload everything:
s3cmd put --acl-public --recursive /Users/me/Music/beach/ s3://your-bucket-name/beach/
Breakdown of the command:
put
: Uploads files--acl-public
: Makes files public--recursive
: Uploads subfolders/Users/me/Music/beach/
: Local source folders3://your-bucket-name/beach/
: Destination in Linode
πͺ Auto-Generate WordPress Playlist Code
To generate shortcode with public URLs for WordPress:
printf "
β Outputs a clean shortcode
β Removes trailing comma
β Handles filenames with spaces
β Ready to paste into WordPress!
π Final Step: Embed It!
Paste the generated code into your WordPress page or post using a shortcode block.
Now youβve got a custom, public MP3 playlist hosted on Linode and embedded directly into your site. π
printf ‘\n’