Checklist on how to monitor and maintain a VPS server yourself List of all the maintenance tasks and console commands I need to run every day/week/month to keep my Virtual Private Server healthy, up to date and secure.

by
on December 15, 2014
(4 min read)

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.

Things I’m buying on Amazon this week

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:

htop

Once a week

Software updates

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

Apache

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

Access 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:

sudo reboot

Simple Cloud Hosting Built for Developers

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

Did you enjoy this article?

Buy the author a coffee 🤗☕

2 comments

  • Tony says:

    Hi, Is this cPanel you’re using or zPanel and what is the difference between them and pros and cons

  • Xavi Author says:

    Hi Tony,

    I don’t use any of them, you don’t really need them unless you don’t want to be bothered with learning Linux and Server settings.

Follow me for cool new products and interesting findings on graphic design, web development, marketing, startups, life and humor.


/*Twitter*/ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); /*Facebook*/ (function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=28624667607";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk')); /*Google+*/ window.___gcfg = {lang: 'en-GB'};(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();
Airbnb 30€ discount