It’s been a few months since I moved to my own VPS (Virtual Private Server). It required some initial work to get things up and running as well as some maintenance although the performance and control you get is definitely worth it.
So now that my servers are somehow stable I’ve made a list of all the main tasks that I need to do every now and then to keep everything up to date and secure. These are the tasks for a small-medium VPS and the console commands for Linux Ubuntu 14.04 running Apache, MySQL, PHP and Postfix as the mail server. Unless there are some major and critical security bugs (such as the heartbleed bug) you can go a few days without having to do anything. Note that these are the basics for most system administrators and people in a shared hosting server that are thinking about migrating to a VPS and how much work it takes. Your mileage may vary depending on how big your server is and the software you use although this should be a pretty good indication.
In case you are wondering, I am using DigitalOcean VPS, I started with the $5/month and now have upgraded to the $20 because I needed more RAM (although the $10/month should have sufficed). It is extremely cheap and best of all the step-by-step tutorials they have are amazing, so far the experience has been amazing. If you are considering a VPS use this link to get 2 months free (a $10 voucher).
Once every 2-3 days
Memory and processes
I’ll check htop to see that RAM and Swap memory is kept at a nice level and also that all processes that should be running are in there:
Once a week
Check that all packages are up to date and clean the aptitude cache:
sudo apt-get update sudo apt-get upgrade sudo apt-get clean
Check the Apache log to see there’s no unnecessary or repetitive errors or memory leaks:
# Apache error log sudo tail -f /var/log/apache2/error.log
Check the access log for any bots, spammers or DoS attacks (although in case of attacks Pingdom will send me an alert):
# Apache access log sudo tail -f /var/log/apache2/access.log
Check that my server doesn’t go crazy sending emails (I am using MandrillApp as my SMTP server so I would get an alert too):
# Mail server log sudo tail -f /var/log/mail.log
Check the MySQL logs to see there’s no unnecessary or repetitive errors or memory leaks:
# MySQL error log sudo tail -f /var/log/mysql/error.log
Check the system and PHP logs (I like to keep these two in the same file, it saves time and forces me to keep PHP strictly clean):
# System log sudo tail -f /var/log/syslog
If the server uses WordPress I’ll go into the Updates section and update any installation, Theme or Plugin that needs an update.
Once every two weeks
I use CloudFlare as my CDN so I check in the Analytics panel that everything look normal.
I’ll check Pingdom too to see there’s no downtimes I haven’t heard about and that response times are acceptable.
Once a month or two
Remove old packages (autoremove is used to remove packages that were automatically
installed to satisfy dependencies for some package and that are no
more needed) although be careful and backup your packages if you are compiling some sources.
sudo apt-get autoremove
I’ll check there are no memory leaks and usually reboot the system, it takes 10 seconds to reboot so there’s no big deal:
So this is it! These are the commands and tasks I do to keep it smooth and running, if there’s something missing please let me know in the comments.
Get 2 months of DigitalOcean’s VPS here: Free VPS for 2 months