Step 1: Backup Your Data
Before making any significant changes to your server, it’s crucial to back up all your data. This includes website files, databases, emails, and configurations. Use tools like rsync or tar to create backups of your essential data.
1.1. Using rsync for Backing Up
rsync is a powerful tool that allows you to synchronize files and directories between two locations. Here’s how you can use it:
$$
Backup website files
rsync -avz /path/to/your/website/ /path/to/backup/location/
Backup email data
rsync -avz /path/to/email/data/ /path/to/backup/location/
$$
Replace /path/to/your/website/ with the actual path to your website files and /path/to/backup/location/ with where you want to store the backup.
See also How to Install Traceroute on Linux (Ubuntu, CentOS, RHEL, Fedora)
1.2. Using tar for Backing Up
tar is a utility that allows you to create archive files. It’s especially useful for backing up:
$$
Backup website files
tar -czvf backup_website.tar.gz /path/to/your/website/
Backup email data
tar -czvf backup_email.tar.gz /path/to/email/data/
$$
Again, replace the paths with the actual paths on your server.
1.3. Database Backup
If you’re using a database like MySQL, you can use the mysqldump command:
$$
mysqldump -u [username] -p[password] [database_name] > backup_database.sql
$$
Replace [username], [password], and [database_name] with your actual database credentials.
Step 2: Log in to Your Server
Access your Ubuntu server using SSH. You can do this by opening a terminal and typing:
$$
ssh username@your_server_ip
$$
Replace username with your server’s username and your_server_ip with the IP address of your server.
Step 3: Stop All cPanel Services
Before uninstalling, ensure that all cPanel services are stopped. Execute the following command:
$$
sudo /etc/init.d/cpanel stop
$$
Step 4: Remove cPanel Directories
Once all services are stopped, you can start removing cPanel directories. Use the following commands:
$$
sudo rm -rf /usr/local/cpanel
sudo rm -rf /var/cpanel
$$
Step 5: Remove cPanel Users
cPanel creates various users for its operation. Remove these users:
$$
sudo deluser cpanel
sudo deluser cpaneleximscanner
$$
Step 6: Clean Up Remaining Files and Dependencies
To ensure that all cPanel-related files and dependencies are removed, execute:
$$
sudo apt-get remove --purge cpanel*
sudo apt-get autoremove
$$
Step 7: Restart Your Server
After all the steps are completed, restart your server to ensure all changes take effect:
sudo reboot
sumber:
https://webhostinggeeks.com/howto/how-to-uninstall-cpanel-on-ubuntu/