{% extends "baseTemplate/index.html" %} {% load i18n %} {% load static %} {% block title %}{% trans "Plugin Development Guide - CyberPanel" %}{% endblock %} {% block header_scripts %} {% endblock %} {% block content %}
{% trans "Complete guide for developing, installing, and managing CyberPanel plugins" %}
Install the test plugin with a single command using curl or wget.
Download and install manually with step-by-step instructions.
Simple install/uninstall process with proper cleanup.
# Install the test plugin with a single command
curl -sSL https://raw.githubusercontent.com/cyberpanel/testPlugin/main/install.sh | bash
git clone https://github.com/cyberpanel/testPlugin.git
cd testPlugin
chmod +x install.sh
./install.sh
https://your-domain:8090/testPlugin/Toggle the plugin on/off with a beautiful switch
Click to show popup messages from the side
Configure custom messages and preferences
View all plugin activities with filtering
Loads within CyberPanel interface
Works perfectly on all devices
# Uninstall the plugin
./install.sh --uninstall
If you encounter any issues:
tail -f /home/cyberpanel/logs/cyberpanel.log
systemctl restart lscpd
systemctl restart cyberpanel
ls -la /home/cyberpanel/plugins/testPlugin
ls -la /usr/local/CyberCP/testPlugin
Note: This plugin is designed for testing and development purposes. Always backup your system before installing any plugins.
Based on the official CyberPanel plugin development guide from the CyberPanel team.
Complete walkthrough from development environment setup to plugin installation.
Learn how to hook into CyberPanel events and respond to core functionality.
Source: This guide is based on the official CyberPanel documentation and the beautiful_names plugin repository.
Note: You can use plain JavaScript in your plugins or any JavaScript framework. You just have to follow the norms of Django framework, because CyberPanel plugin is just another Django app.
git clone https://github.com/usmannasir/cyberpanel/ --single-branch v1.7.2-plugin
cd v1.7.2-plugin
django-admin startapp pluginName
Choose your plugin name wisely as it's of great importance. Once the Django app is created, you need to define a meta file for your plugin so that CyberPanel can read information about your plugin.
cd pluginName
nano meta.xml
Paste the following content in the meta.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<cyberpanelPluginConfig>
<name>customplugin</name>
<type>plugin</type>
<description>Plugin to make custom changes</description>
<version>0</version>
</cyberpanelPluginConfig>
Create a signals.py file (you can name it anything, but signals.py is recommended). You can leave this file empty for now.
In your apps.py file, you need to import the signals file inside the ready function:
def ready(self):
import signals
You need to specify a default_app_config variable in this file:
default_app_config = 'examplePlugin.apps.ExamplepluginConfig'
Inside your app root directory, create urls.py and paste this content:
from django.conf.urls import url
import views
urlpatterns = [
url(r'^$', views.examplePlugin, name='examplePlugin'),
]
Important: Replace examplePlugin with your plugin name. This URL definition is very important for CyberPanel to register your plugin page.
You can create these optional files for database model management:
If your file is Python code, don't forget to include this line at the top:
#!/usr/local/CyberCP/bin/python2
To plug into events fired by CyberPanel core, you can respond to various events happening in the core. Visit the signal file documentation for a complete list of events.
Here's how you can respond to the postWebsiteDeletion event:
from django.dispatch import receiver
from django.http import HttpResponse
from websiteFunctions.signals import postWebsiteDeletion
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
@receiver(postWebsiteDeletion)
def rcvr(sender, **kwargs):
request = kwargs['request']
logging.writeToFile('Hello World from Example Plugin.')
return HttpResponse('Hello World from Example Plugin.')
After completing your plugin, zip your Django app. The zip file name should be your plugin name (e.g., examplePlugin.zip), otherwise installation will fail.
First, upload your plugin to /usr/local/CyberCP/pluginInstaller:
cd /usr/local/CyberCP/pluginInstaller
python pluginInstaller.py install --pluginName examplePlugin
cd /usr/local/CyberCP/pluginInstaller
python pluginInstaller.py remove --pluginName examplePlugin
CyberPanel has released an official plugin called Beautiful Names that removes the admin_ prefix from Package and FTP account names. This plugin serves as a great example of how to create CyberPanel plugins.
cd /usr/local/CyberCP/pluginInstaller
wget https://cyberpanel.net/beautifulNames.zip
python pluginInstaller.py install --pluginName beautifulNames
cd /usr/local/CyberCP/pluginInstaller
python pluginInstaller.py remove --pluginName beautifulNames
The plugin installation facility is in beta and not available with the official install yet. To install plugins, you need to install CyberPanel via the test version:
sh <(curl https://mirror.cyberpanel.net/install-test.sh || wget -O - https://mirror.cyberpanel.net/install-test.sh)
Note: This guide is based on the official CyberPanel documentation. For the most up-to-date information, always refer to the official sources.
# Download and run the installation script
curl -sSL https://raw.githubusercontent.com/cyberpanel/testPlugin/main/install.sh | bash
# Or download first, then run
wget https://raw.githubusercontent.com/cyberpanel/testPlugin/main/install.sh
chmod +x install.sh
./install.sh
mkdir -p /home/cyberpanel/plugins/yourPlugin
mkdir -p /usr/local/CyberCP/yourPlugin
cp -r yourPlugin/* /usr/local/CyberCP/yourPlugin/
chown -R cyberpanel:cyberpanel /usr/local/CyberCP/yourPlugin
chmod -R 755 /usr/local/CyberCP/yourPlugin
ln -sf /usr/local/CyberCP/yourPlugin /home/cyberpanel/plugins/yourPlugin
Add your plugin to INSTALLED_APPS in /usr/local/CyberCP/cyberpanel/settings.py:
INSTALLED_APPS = [
# ... existing apps ...
'yourPlugin',
]
Add your plugin URLs in /usr/local/CyberCP/cyberpanel/urls.py:
urlpatterns = [
# ... existing patterns ...
path("yourPlugin/", include("yourPlugin.urls")),
]
cd /usr/local/CyberCP
python3 manage.py makemigrations yourPlugin
python3 manage.py migrate yourPlugin
python3 manage.py collectstatic --noinput
systemctl restart lscpd
systemctl restart cyberpanel
# Run with uninstall flag
./install.sh --uninstall
rm -rf /usr/local/CyberCP/yourPlugin
rm -f /home/cyberpanel/plugins/yourPlugin
sed -i '/yourPlugin/d' /usr/local/CyberCP/cyberpanel/settings.py
sed -i '/yourPlugin/d' /usr/local/CyberCP/cyberpanel/urls.py
systemctl restart lscpd
systemctl restart cyberpanel
Create a meta.xml file in your plugin root directory:
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>Your Plugin Name</name>
<type>Utility</type>
<description>Your plugin description</description>
<version>1.0.0</version>
<author>Your Name</author>
<website>https://your-website.com</website>
<license>MIT</license>
<dependencies>
<python>3.6+</python>
<django>2.2+</django>
</dependencies>
<permissions>
<admin>true</admin>
<user>false</user>
</permissions>
<settings>
<enable_toggle>true</enable_toggle>
<test_button>true</test_button>
<popup_messages>true</popup_messages>
<inline_integration>true</inline_integration>
</settings>
</plugin>
name: Plugin display nametype: Plugin category (Utility, Security, Performance, etc.)description: Plugin descriptionversion: Plugin versionauthor: Plugin authorwebsite: Plugin websitelicense: License typedependencies: Required dependenciespermissions: Access permissionssettings: Plugin-specific settings<div class="control-group">
<label for="plugin-toggle" class="toggle-label">
Enable Feature
</label>
<label class="toggle-switch">
<input type="checkbox" id="plugin-toggle" {% if feature_enabled %}checked{% endif %}>
<span class="slider"></span>
</label>
</div>
.toggle-switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
transition: .4s;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
background-color: #5856d6;
}
input:checked + .slider:before {
transform: translateX(26px);
}
document.getElementById('plugin-toggle').addEventListener('change', function() {
fetch('/yourPlugin/toggle/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': getCSRFToken()
}
})
.then(response => response.json())
.then(data => {
if (data.status === 1) {
showNotification('success', 'Toggle Updated', data.message);
} else {
showNotification('error', 'Error', data.error_message);
// Revert toggle state
this.checked = !this.checked;
}
});
});
# views.py
from plogical.httpProc import httpProc
def your_view(request):
context = {
'data': 'your_data',
'plugin_enabled': True
}
proc = httpProc(request, 'yourPlugin/your_template.html', context, 'admin')
return proc.render()
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Your Plugin - CyberPanel" %}{% endblock %}
{% block header_scripts %}
<style>
/* Your plugin-specific styles */
.your-plugin-wrapper {
background: transparent;
padding: 20px;
}
.your-plugin-container {
max-width: 1200px;
margin: 0 auto;
}
</style>
{% endblock %}
{% block content %}
<div class="your-plugin-wrapper">
<div class="your-plugin-container">
<!-- Your plugin content here -->
</div>
</div>
{% endblock %}
# urls.py
from django.urls import path
from . import views
app_name = 'yourPlugin'
urlpatterns = [
path('', views.your_view, name='your_view'),
path('settings/', views.settings_view, name='settings'),
# ... other URLs
]
# In /usr/local/CyberCP/cyberpanel/urls.py
urlpatterns = [
# ... existing patterns ...
path("yourPlugin/", include("yourPlugin.urls")),
]
yourPlugin/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ models.py
โโโ views.py
โโโ urls.py
โโโ signals.py
โโโ meta.xml
โโโ install.sh
โโโ templates/
โ โโโ yourPlugin/
โ โโโ plugin_home.html
โ โโโ plugin_settings.html
โ โโโ plugin_logs.html
โโโ static/
โ โโโ yourPlugin/
โ โโโ css/
โ โ โโโ yourPlugin.css
โ โโโ js/
โ โโโ yourPlugin.js
โโโ migrations/
โโโ __init__.py
python3 manage.py collectstaticpython3 manage.py makemigrationstail -f /home/cyberpanel/logs/cyberpanel.log
tail -f /home/cyberpanel/logs/django.log
ls -la /home/cyberpanel/plugins/
ls -la /usr/local/CyberCP/yourPlugin/
cd /usr/local/CyberCP
python3 manage.py shell
systemctl status lscpd
systemctl status cyberpanel
Conclusion: This guide provides comprehensive instructions for developing CyberPanel plugins. Follow the best practices and troubleshooting steps to ensure your plugins integrate seamlessly with CyberPanel while maintaining security and performance standards.
Comprehensive support for all CyberPanel-supported operating systems.
Intelligent OS detection and configuration for seamless installation.
Built-in compatibility testing to verify system requirements.
Package Manager: apt-get
Web Server: apache2
Package Manager: dnf/yum
Web Server: httpd
Package Manager: yum
Web Server: httpd
The plugin requires Python 3.6+ and automatically detects the correct Python executable:
# Detection order:
1. python3.12
2. python3.11
3. python3.10
4. python3.9
5. python3.8
6. python3.7
7. python3.6
8. python3
9. python (fallback)
The installation script automatically detects your operating system and configures the plugin accordingly:
# Automatic detection includes:
- OS name and version
- Python executable path
- Package manager (apt-get, dnf, yum)
- Service manager (systemctl, service)
- Web server (apache2, httpd)
- User and group permissions
Run the built-in compatibility test to verify your system:
# Navigate to plugin directory
cd /usr/local/CyberCP/testPlugin
# Run compatibility test
python3 test_os_compatibility.py
# Or make it executable and run
chmod +x test_os_compatibility.py
./test_os_compatibility.py
The compatibility test checks:
# Package Manager: apt-get
# Python: python3
# Pip: pip3
# Service Manager: systemctl
# Web Server: apache2
# User/Group: cyberpanel:cyberpanel
# Installation commands
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-venv git curl
sudo apt-get install -y build-essential python3-dev
# Package Manager: dnf (RHEL 8+) / yum (RHEL 7)
# Python: python3
# Pip: pip3
# Service Manager: systemctl
# Web Server: httpd
# User/Group: cyberpanel:cyberpanel
# Installation commands (RHEL 8+)
sudo dnf install -y python3 python3-pip python3-devel git curl
sudo dnf install -y gcc gcc-c++ make
# Installation commands (RHEL 7)
sudo yum install -y python3 python3-pip python3-devel git curl
sudo yum install -y gcc gcc-c++ make
# Package Manager: yum
# Python: python3
# Pip: pip3
# Service Manager: systemctl
# Web Server: httpd
# User/Group: cyberpanel:cyberpanel
# Installation commands
sudo yum install -y python3 python3-pip python3-devel git curl
sudo yum install -y gcc gcc-c++ make
# CageFS configuration
cagefsctl --enable cyberpanel
cagefsctl --update
# Check SELinux status
sestatus
# Set proper context for plugin files
setsebool -P httpd_can_network_connect 1
chcon -R -t httpd_exec_t /usr/local/CyberCP/testPlugin/
# Check AppArmor status
aa-status
# Allow Apache to access plugin files
aa-complain apache2
# Ubuntu/Debian (ufw)
sudo ufw allow 8090/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
# RHEL-based (firewalld)
sudo firewall-cmd --permanent --add-port=8090/tcp
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y python3 python3-pip
# RHEL-based
sudo dnf install -y python3 python3-pip
# or
sudo yum install -y python3 python3-pip
sudo chown -R cyberpanel:cyberpanel /home/cyberpanel/plugins
sudo chown -R cyberpanel:cyberpanel /usr/local/CyberCP/testPlugin
sudo systemctl daemon-reload
sudo systemctl restart lscpd
sudo systemctl restart apache2 # Ubuntu/Debian
sudo systemctl restart httpd # RHEL-based
# Check OS information
cat /etc/os-release
uname -a
# Check Python installation
python3 --version
which python3
which pip3
# Check services
systemctl status lscpd
systemctl status apache2 # Ubuntu/Debian
systemctl status httpd # RHEL-based
# Check file permissions
ls -la /home/cyberpanel/plugins/
ls -la /usr/local/CyberCP/testPlugin/
# Check CyberPanel logs
tail -f /home/cyberpanel/logs/cyberpanel.log
tail -f /home/cyberpanel/logs/django.log
Note: The plugin is designed to work seamlessly across all supported operating systems. If you encounter any compatibility issues, please run the compatibility test and check the troubleshooting section above.