Configure CloudLinux LVE Limits to Prevent Server Crashes
Securely isolate users on AlmaLinux 8 with CloudLinux LVE: install the kernel, enable LVE manager, set CPU, RAM & IOPS limits, and monitor usage.
5 min read
Introduction
In shared hosting and VPS environments a single misbehaving account can consume all server resources, causing crashes and slowdowns. CloudLinux addresses this with its Lightweight Virtual Environment (LVE) technology, which isolates each user and lets you set hard limits for CPU, RAM and I/O operations per second (IOPS). This guide shows how to install CloudLinux on an AlmaLinux 8 server, enable the LVE manager, and configure per‑user limits that keep the system stable while maintaining performance.
1. Install CloudLinux on AlmaLinux 8
To use LVE limits you first need to replace the default kernel with the CloudLinux kernel and install the core packages.
# Download the conversion script
wget -O cldeploy https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
chmod +x cldeploy
# Run the script (you will be asked for a license key)
./cldeploy -i
# The script will:
# • Register the server with CloudLinux
# • Replace the kernel with the CloudLinux kernel
# • Install core CloudLinux packages
# • Reboot the server automatically
After the reboot, confirm that the CloudLinux kernel is active:
# uname -r
4.18.0-cloudlinux
2. Install and enable the LVE manager
The LVE manager provides a web‑based UI and command‑line tools for setting limits.
# Install the required packages
dnf install -y cagefs lve-utils lve-utils-daemon lve-manager
# Enable and start the services
systemctl enable --now lveond.service
systemctl enable --now lve-manager.service
When the services are running, the UI is reachable at https://your-server-ip:8443. Log in with the root account (or a sudo‑enabled user) to begin configuring limits.
3. Understanding LVE resource counters
CPU – measured in “CPU shares”. One share is roughly 1 % of a single CPU core. The default for a new user is 100 (≈1 core).
RAM – physical memory a user may allocate, including file cache. Specified in megabytes (MB).
IOPS – limits the number of read/write operations per second on the disk, preventing a single account from saturating storage throughput.
EP (Entry Processes) – maximum concurrent PHP processes for a user. Often tuned alongside CPU, RAM and IOPS.
All counters are enforced by the kernel; when a limit is reached the offending processes are throttled or blocked, protecting the rest of the system.
4. Set per‑user LVE limits via the command line
While the UI is convenient, many administrators prefer scripting limits. The examples below use a user named exampleuser. Adjust the values to match your hosting plans.
4.1. Set CPU shares
# Set a maximum of 200 CPU shares (≈2 cores)
lve-set-cpu exampleuser 200
# Verify the setting
lveinfo --user exampleuser | grep CPU
4.2. Set RAM limit
# Limit RAM to 1 GB (1024 MB)
lve-set-mem exampleuser 1024
# Verify the setting
lveinfo --user exampleuser | grep MEM
4.3. Set IOPS limit
# Allow up to 5 000 IOPS
lve-set-iops exampleuser 5000
# Verify the setting
lveinfo --user exampleuser | grep IOPS
4.4. Apply all limits in a single command (optional)
# Apply CPU, RAM and IOPS limits together
lve-set --user exampleuser --cpu 200 --mem 1024 --iops 5000
# Show the complete profile
lveinfo --user exampleuser
Each command writes the new limits to /etc/lve/lve.conf; the kernel enforces them immediately, so no reboot is required.
5. Using the LVE manager UI for bulk changes
If you manage many accounts, the UI lets you create templates that apply a common set of limits to multiple users.
Log in to https://your-server-ip:8443 and navigate to LVE → Limits.
Click Add Template, give it a name (e.g., “Starter‑Plan”), and enter the desired CPU, RAM and IOPS values.
Save the template, select the users to update, choose Apply Template, and confirm.
The UI also provides real‑time graphs of each user’s resource consumption, helping you identify accounts that regularly hit their caps and may need a plan upgrade.
6. Monitoring and adjusting limits over time
Limits should be reviewed regularly to avoid throttling legitimate traffic or leaving gaps for abuse.
6.1. Command‑line monitoring
# Top users by CPU usage
lveinfo -p cpu | sort -k2 -nr | head
# Users hitting RAM limits
lveinfo -p mem | awk '$2 > 0' | sort -k2 -nr | head
# IOPS usage
lveinfo -p iops | sort -k2 -nr | head
6.2. Automated alerts
Integrate LVE statistics with monitoring tools such as Zabbix or Prometheus. Both support an lveinfo exporter that pushes metrics to your dashboard, where you can set thresholds (e.g., “CPU > 90 % for 5 minutes”) and receive email or Slack notifications.
6.3. Periodic review process
Weekly: Review the top five users for each resource. Lower limits for users consistently using only a fraction of their allocation.
Monthly: Compare plan specifications with actual usage. Create new tiers if many users approach current caps.
Quarterly: Run a stress test on a staging server to verify that limits still protect the host under peak load.
Conclusion
CloudLinux’s LVE limits give you granular control over CPU, RAM and IOPS per account, turning a potentially chaotic shared environment into a predictable, stable platform. By installing CloudLinux on AlmaLinux 8, enabling the LVE manager, and applying well‑thought‑out limits—both via CLI and the UI—you can prevent runaway processes from crashing the server while still offering flexible resource packages to your customers. Regular monitoring and periodic adjustments ensure the limits stay aligned with your clients’ needs, providing long‑term reliability.