Troubleshooting Common CentOS VPS Errors and Solutions

This tutorial provides a guide to troubleshooting common errors on your CentOS VPS, offering solutions to frequent issues to ensure smooth server operation.

centos
Micro
VPS
1
vCPU
2 GB
Memory
20 GB
NVMe Disk
1024 GB
Traffic
4.90
/month
* Up to 6GB RAM, 60GB NVMe Disk Space and 1Gbit/s Network Speed
#### Prerequisites Before you begin, ensure you have: - A CentOS VPS (This guide is tested with CentOS 8) - A user account with sudo privileges - Basic familiarity with the command line #### Error 1: Network Connectivity Issues **Symptoms:** - Unable to connect to the server. - Network services are unreachable. **Solution:** 1. **Check Network Configuration:** ```bash sudo nmcli device status ``` 2. **Restart Network Service:** ```bash sudo systemctl restart NetworkManager ``` 3. **Verify IP Configuration:** ```bash ip addr show ``` 4. **Check Firewall Rules:** Ensure the necessary ports are open. ```bash sudo firewall-cmd --list-all ``` #### Error 2: SSH Connection Refused **Symptoms:** - Unable to connect via SSH. - "Connection refused" error. **Solution:** 1. **Verify SSH Service Status:** ```bash sudo systemctl status sshd ``` 2. **Start SSH Service:** ```bash sudo systemctl start sshd ``` 3. **Check Firewall Rules for SSH:** ```bash sudo firewall-cmd --zone=public --add-service=ssh --permanent sudo firewall-cmd --reload ``` 4. **Verify SSH Configuration:** Ensure `sshd_config` is correctly configured. ```bash sudo nano /etc/ssh/sshd_config ``` Ensure `Port` is set to 22 (or your custom SSH port) and `PermitRootLogin` is set to `no` or `yes` as needed. Restart SSH service after changes: ```bash sudo systemctl restart sshd ``` #### Error 3: Disk Space Full **Symptoms:** - "No space left on device" error. - Unable to write to disk. **Solution:** 1. **Check Disk Usage:** ```bash df -h ``` 2. **Identify Large Files:** ```bash sudo du -ah / | sort -n -r | head -n 20 ``` 3. **Clean Up Log Files:** ```bash sudo journalctl --vacuum-time=2weeks ``` 4. **Remove Unnecessary Packages:** ```bash sudo dnf autoremove ``` 5. **Clear Package Cache:** ```bash sudo dnf clean all ``` #### Error 4: High CPU or Memory Usage **Symptoms:** - Slow server performance. - High load averages. **Solution:** 1. **Check System Resource Usage:** ```bash top ``` 2. **Identify Resource-Heavy Processes:** ```bash ps aux --sort=-%mem | head ``` 3. **Restart Services or Kill Processes:** ```bash sudo systemctl restart service_name sudo kill -9 PID ``` 4. **Install and Use Monitoring Tools:** ```bash sudo dnf install htop htop ``` #### Error 5: Yum Update Errors **Symptoms:** - Errors when running `yum update`. - Package conflicts or missing dependencies. **Solution:** 1. **Clean Yum Cache:** ```bash sudo dnf clean all ``` 2. **Remove Problematic Packages:** ```bash sudo dnf remove package_name ``` 3. **Rebuild RPM Database:** ```bash sudo rpm --rebuilddb ``` 4. **Check and Repair Dependencies:** ```bash sudo dnf check sudo dnf repoquery --unsatisfied ``` #### Error 6: MySQL/MariaDB Connection Issues **Symptoms:** - Unable to connect to MySQL/MariaDB. - "Can't connect to local MySQL server" error. **Solution:** 1. **Verify MySQL/MariaDB Service Status:** ```bash sudo systemctl status mariadb ``` 2. **Start MySQL/MariaDB Service:** ```bash sudo systemctl start mariadb ``` 3. **Check MySQL/MariaDB Logs:** ```bash sudo less /var/log/mariadb/mariadb.log ``` 4. **Verify MySQL/MariaDB Configuration:** ```bash sudo nano /etc/my.cnf ``` Ensure proper settings and restart the service: ```bash sudo systemctl restart mariadb ``` #### Conclusion By following this guide, you can troubleshoot and resolve common issues on your CentOS VPS, ensuring your server remains operational and secure. Regular maintenance and monitoring can prevent many of these issues from occurring. **Additional Resources:** - **CentOS Documentation:** [https://www.centos.org/docs/](https://www.centos.org/docs/) - **Linux Command Reference:** [https://linux.die.net/man/](https://linux.die.net/man/) - **MySQL Documentation:** [https://dev.mysql.com/doc/](https://dev.mysql.com/doc/) - **Firewalld Documentation:** [https://firewalld.org/documentation/](https://firewalld.org/documentation/)

Related Tutorials



    Created with ❤ at Estonia
    EcoStack Technology OÜ