Ghost CMS is a popular open-source content management system designed for publishing. While it offers a sleek and user-friendly interface, there might be instances where you’d want to uninstall it from your Ubuntu server.
Whether you’re migrating to a different platform or simply cleaning up, this guide will walk you through the process step-by-step.
Let’s get started.
Step 1: Backup Your Data
Before making any changes, it’s essential to backup your Ghost CMS data. This ensures that you can restore your content if needed later.
Navigate to your Ghost CMS directory:
cd /path/to/your/ghost/directory
Use the Ghost CLI to export your content:
ghost export
Save the exported JSON file to a safe location.
Step 2: Stop the Ghost Service
Ensure that the Ghost instance is not running by stopping its service.
ghost stop
Step 3: Remove Ghost Directories and Files
Navigate to the directory where Ghost is installed:
cd /path/to/your/ghost/directory
Delete the Ghost directory:
sudo rm -rf /path/to/your/ghost/directory
Step 4: Uninstall Ghost CLI
If you no longer need the Ghost Command Line Interface, you can uninstall it.
sudo npm uninstall -g ghost-cli
Step 5: Cleanup Databases
If you used a database like MySQL for Ghost, ensure to remove the associated database and user.
Log in to MySQL:
mysql -u root -p
Drop the Ghost database:
DROP DATABASE ghost_db_name;
Remove the Ghost user:
DROP USER 'ghost_user'@'localhost';
Exit MySQL:
exit
Step 6: Remove Associated Dependencies
If you installed any software or dependencies solely for Ghost, consider removing them to free up space.
For example, if you installed Node.js just for Ghost:
sudo apt remove nodejs
Commands Mentioned
- ghost export – Exports Ghost content to a JSON file.
- ghost stop – Stops the Ghost service.
- npm uninstall -g ghost-cli – Uninstalls the Ghost CLI.
- mysql -u root -p – Logs into MySQL.
- DROP DATABASE – Deletes a MySQL database.
- DROP USER – Removes a MySQL user.
- apt remove – Removes a software package in Ubuntu.
FAQ
-
Do I need to backup before uninstalling?
Yes, it’s highly recommended to backup your Ghost CMS data before uninstalling. This ensures you can restore your content if needed.
-
Is it necessary to remove the Ghost CLI?
No, but if you don’t plan on using Ghost in the future, it’s a good idea to uninstall the Ghost CLI to free up space and reduce potential security risks.
-
What if I used SQLite for Ghost?
If you used SQLite, the database is stored as a file in the Ghost directory. Deleting the Ghost directory will remove the SQLite database.
-
How do I ensure all Ghost-related files are removed?
After following the steps, you can use the ‘find’ command to search for any remaining Ghost-related files and directories and remove them manually.
-
Can I reinstall Ghost later?
Yes, you can always reinstall Ghost later by following the official Ghost installation guide for Ubuntu.
Conclusion
Uninstalling Ghost CMS from your Ubuntu server is a straightforward process when following the steps outlined above. Always remember to backup your data before making any significant changes to your system.
If you’re considering other hosting options for your next project, learn the differences between dedicated server hosting, VPS server hosting, cloud hosting, and shared hosting to determine the best fit for your needs.