Install the CLI tool
CloudBase CLI is the officially provided command-line tool for CloudBase, enabling you to rapidly manage CloudBase resources, deploy applications, manage databases, and more via the command line.
🌟 Advantages of the CLI Tool
- 🚀 Rapid Deployment: One-click deployment for cloud functions and static websites
- 📊 Resource Management: Managing databases, storage, and environment configurations
- 🔄 Automation: Supports CI/CD integration
- 💻 Cross-platform: Supports Windows, macOS, Linux
- 🛠️ Rich Features: Covers all core features of CloudBase.
📋 System Requirements
- Node.js: Version ≥ 12.0.0 (LTS version recommended)
- npm: Version ≥ 6.0.0
- Operating System: Windows, macOS, Linux
🚀 Step 1: Install Node.js
If you haven't installed Node.js yet, please install it first:
Method 1: Download from the official website (Recommended)
- Visit the Node.js official website
- Download the LTS version (Long Term Support version)
- Complete the installation by following the installation wizard.
Option 2: Use package manager
macOS (using Homebrew):
brew install node
Windows (using Chocolatey):
choco install nodejs
Ubuntu/Debian:
sudo apt update
sudo apt install nodejs npm
Verifying Installation
node --version
npm --version
⚡ Step 2: Install CloudBase CLI
Open the command-line terminal and execute the following command:
npm install -g @cloudbase/cli
Troubleshooting Installation Issues
Permission Error (macOS/Linux):
sudo npm install -g @cloudbase/cli
Network Issues:
# Using Taobao Mirror
npm install -g @cloudbase/cli --registry=https://registry.npmmirror.com
Windows Permission Issues: Run Command Prompt or PowerShell as administrator
- It is recommended to use the LTS version of Node.js
- If the installation fails, you may need to modify npm permissions
- Enterprise network environments may require proxy configuration.
✅ Step 3: Verifying Installation
After installation is complete, verify that the CLI is functioning properly:
# Check Version
cloudbase --version
# Or use the abbreviated command
tcb --version
If the version number is displayed, the installation was successful!
🎯 Step 4: Learn Basic Commands
CloudBase CLI provides a rich set of commands, including the following commonly used ones:
View Help
# View all commands
cloudbase --help
# View Help for a Specific Command
cloudbase login --help
Login and Environment Management
# Log in to CloudBase
cloudbase login
# View Environment List
cloudbase env:list
# Switch Environment
cloudbase env:switch
Deployment Related
# Deploy Cloud Function
cloudbase functions:deploy
# Deploy Static Website
cloudbase hosting:deploy
# One-Click Deployment (Based on Configuration File)
cloudbase deploy
To simplify input, the cloudbase
command can be abbreviated as tcb
:
cloudbase login
=tcb login
cloudbase deploy
=tcb deploy
tcb` is the English abbreviation for the CloudBase product: Tencent CloudBase
🔧 Step 5: Configure Proxy (Optional)
If your network environment requires a proxy to access the external network, you can configure an HTTP proxy:
Temporary Settings
# macOS/Linux
export HTTP_PROXY=http://127.0.0.1:8000
export HTTPS_PROXY=http://127.0.0.1:8000
# Windows
set HTTP_PROXY=http://127.0.0.1:8000
set HTTPS_PROXY=http://127.0.0.1:8000
Permanent Settings
Add the proxy configuration to the system environment variables or terminal configuration files (such as .bashrc
, .zshrc
).
🚀 Step 6: Get Started
You can now start using the CLI tool!
First-Time Setup Process
- Log in:
cloudbase login
- Select environment:
cloudbase env:list
to view environments,cloudbase env:switch
to switch - Initialize project:
cloudbase init
creates a project template - Deploy application:
cloudbase deploy
for one-click deployment
🆘 Get Help
If you encounter any issues during use:
- View help:
cloudbase --help
orcloudbase <command> --help
- View documentation: CLI documentation
- Submit Issue: GitHub Issues
🎉 Congratulations! You have successfully installed the CloudBase CLI tool. You can now start your efficient cloud development journey!