xiaohongshu
xiaohongshu
configure-ubuntu
Ubuntu server configuration via cloud-init and systemd. Use when writing cloud-init YAML, configuring systemd services, setting up nginx, or troubleshooting VM configuration issues.
Full skill instructions
This skill provides guidance for configuring Ubuntu LTS servers via cloud-init automation for any cloud platform (AWS, Azure, GCP, DigitalOcean, etc.).
Note: All examples in this skill currently use Ubuntu 24.04 LTS. Update version-specific package names or paths as needed for other LTS releases.
Use this skill when:
Choose the appropriate reference based on your task:
| Task | Reference File |
|---|---|
| Complete cloud-init configurations | references/examples/*.yaml |
| Cloud-init syntax and patterns | references/cloud-init-patterns.md |
| systemd service units | references/systemd-patterns.md |
| Debugging failures or errors | references/common-pitfalls.md |
| Example | File |
|---|---|
| SSH bastion host | references/examples/bastion.yaml |
| Nginx reverse proxy (HTTP) | references/examples/proxy-http.yaml ← default |
| Nginx reverse proxy (HTTPS, self-signed) | references/examples/proxy-https.yaml |
| Nginx reverse proxy (HTTPS, Let's Encrypt) | references/examples/proxy-https-letsencrypt.yaml |
| Nginx static file server | references/examples/static-files.yaml |
| Python/Flask server | references/examples/flask.yaml |
| Node.js server | references/examples/nodejs.yaml |
| Java/Spring Boot server | references/examples/java.yaml |
| .NET server | references/examples/dotnet.yaml |
HTTPS Options:
- Use
proxy-http.yamlby default (no SSL)- Use
proxy-https.yamlfor self-signed certificates (development/internal)- Use
proxy-https-letsencrypt.yamlfor trusted certificates (requires domain name)
These rules prevent the most common failures:
users: directive in cloud-init — Deletes default SSH user, breaks accessAfter=network.target # comment fails'0640' not 0640 in cloud-init/opt/app/venv/bin/python not pythonWhen the request is ambiguous, use these defaults:
| Decision | Default Choice | Rationale |
|---|---|---|
| Application framework | Flask/Python | Course standard, most examples |
| Reverse proxy | HTTP (not HTTPS) | Simpler, use proxy-http.yaml |
| Application port | 5001 | Avoids conflict with common ports |
| Proxy port | 80 (HTTP) or 443 (HTTPS) | Standard web ports |
| App directory | /opt/<app-name>/ | Standard for third-party apps |
| Config directory | /etc/<app-name>/ | Standard for system config |
| Service user | <app-name> | Same as app, no login shell |
| Ownership pattern | deployuser:servicegroup | Deploy user writes, service reads |
| Directory permissions | 775 | Group can write (venv installs) |
| Config file permissions | 640 | Owner writes, group reads |
| WSGI server | Gunicorn | Production-ready, simple config |
"Set up a web application server" → Use:
examples/flask.yaml for application VMexamples/proxy-http.yaml for proxy VM"Configure nginx" → Use:
examples/proxy-http.yaml (reverse proxy, not static files)proxy-https.yaml"Set up a secure bastion" → Use:
examples/bastion.yaml (includes UFW + fail2ban)This is the standard way to handle environment variables (database credentials, API keys, connection strings) on the server.
/etc/<app-name>/
└── environment # All environment variables for the application
runcmd:
# Create config directory owned by root, readable by app group
- mkdir -p /etc/myapp
- chown root:myapp /etc/myapp
- chmod 750 /etc/myapp
# Create environment file with restricted permissions
- touch /etc/myapp/environment
- chown root:myapp /etc/myapp/environment
- chmod 640 /etc/myapp/environment
[Service]
EnvironmentFile=/etc/myapp/environment
# /etc/myapp/environment
DATABASE_URL=postgresql://user:password@host:5432/dbname
SECRET_KEY=your-secret-key-here
API_KEY=external-service-api-key
DEBUG=false
| Concern | Solution |
|---|---|
| Security | File owned by root, only readable by app group (mode 640) |
| Separation | Config in /etc/, code in /opt/ — different concerns, different locations |
| Deployment | Environment file can be updated without redeploying code |
| systemd integration | EnvironmentFile= loads variables automatically |
| Provider | Default User |
|---|---|
| AWS (Amazon Linux) | ec2-user |
| AWS (Ubuntu) | ubuntu |
| Azure | azureuser |
| GCP | Your Google account username |
| DigitalOcean | root |
| Linode | root |
| Purpose | Owner:Group | Mode |
|---|---|---|
| Application code | deployuser:appgroup | 640 |
| Application directory | deployuser:appgroup | 775 |
| Config with secrets | root:appgroup | 640 |
| Config directory | root:appgroup | 750 |
| systemd service files | root:root | 644 |
sudo systemctl daemon-reload # After editing service files
sudo systemctl enable myapp # Start on boot
sudo systemctl start myapp # Start now
sudo systemctl status myapp # Check status
sudo journalctl -u myapp -f # Follow logs
cloud-init status # Check status
cloud-init status --wait # Block until complete
sudo cat /var/log/cloud-init-output.log # View logs
Ready-to-use cloud-init YAML files for common server types. Copy and customize for your use case.
Reference documentation for cloud-init syntax:
packages, package_update)write_files)runcmd)Reference documentation for systemd services:
[Unit], [Service], [Install])simple, forking, oneshot)Prevention checklist and solutions for:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience