Table of Contents
Open Table of Contents
Server Configuration Overview
Recently, I purchased an affordable Alibaba Cloud ECS server with the following specs:
- CPU: 2 cores (vCPU)
- Memory: 2 GiB
- Storage: 40 GiB cloud disk (2120 IOPS)
- Network: Fixed bandwidth 3M
The specs are quite low-end. This article documents various issues encountered during use and their solutions.
Configuration Optimization
pnpm Configuration Optimization
Due to memory and CPU limitations, pnpm tends to hang during dependency installation. We need to limit concurrency and retry parameters:
# Limit concurrency to avoid memory exhaustion
pnpm config set concurrency 2
# Disable pnpm's automatic lock file updates to reduce disk IO load during installation
pnpm config set auto-install-peers=false
# Set retry count to improve success rate on unstable networks
pnpm config set fetch-retries 3
# Set retry factor to increase retry interval
pnpm config set fetch-retry-factor 2
# Set network timeout
pnpm config set network-timeout 60000
SSH Key Management
Use the keychain tool to centrally manage SSH and GPG key agents, enabling one-time unlock and multi-session sharing.
# Install keychain
# Debian/Ubuntu
sudo apt install keychain
# CentOS/RHEL
sudo dnf install keychain
Configure automatic loading by editing your shell initialization file (such as .bash_profile or .profile), and add the following content (adjust according to your actual key paths):
# Start keychain to manage SSH and GPG keys
if command -v keychain > /dev/null; then
eval $(keychain --quiet --eval ~/.ssh/id_rsa)
fi
# If using GPG for signing or encryption, you can also manage it together:
eval $(keychain --quiet --eval ~/.ssh/id_rsa GPG_KEY_EMAIL@DOMAIN.COM)
Using the
--quietparameter avoids output prompts on each login (e.g.,* Found existing ssh-agent: 1996), suitable for silent operation in production environments. ReplaceGPG_KEY_EMAIL@DOMAIN.COMwith your GPG key’s associated email.
On first login, you’ll be prompted for the private key password. Subsequent new terminals or SSH sessions will automatically reuse the unlocked agent. Multiple shells share the same set of keys without needing to decrypt repeatedly.