What kind of maintenance tasks should I be thinking about on a LAMP server?

August 20, 2013 2.6k views
Hi everyone, I recently set up a new LAMP server for two moderately trafficked blogs in my content network. The performance so far has been great and my 1 gig server still has plenty of RAM and processing speed available. This is the first time I've hosted a server on my own. The first 48 hours were smoother than I expected but I did have a MySQL database lockup that brought my sites down until I cycled the process. So my question is - what kind of maintenance tasks should I be doing on the server? Should I set up a cron to restart my database and apache services or reboot the droplet on some regular basis? Any other maintenance tasks I should be doing beyond offsite backups to ensure reliability?
4 Answers
The servers should take care of themselves if configured correctly. I would set up logwatch as it emails you every day details about whats happening on the server.

Also consider something like OSSEC and/or ConfigServer CFS/LFD as they monitor connections and attempts to access the server. Also recommend doing security tweaks.

Oh, and update using yum frequently.
Make sure you keep your server updated so that you're up to date on all of the security patches. Also backup your files and databases.

> Should I set up a cron to restart my database and apache services or reboot the droplet on some regular basis?

No. If you have to do that, you're doing it wrong. It should run flawlessly without having to restart any services.
On my 512Mb when doing some load testing, my MYSQL processes quit due to not having enough RAM. I've since set up a swap partition and have had no issues, so I would suggest that! :)
Take a snapshot of your droplet on occasion, especially b/f any major programming modifications and/or updates. That way, if you end up f'-ing something up, you can simply spin up a new droplet from your (hopefully recent) snapshot and subsequently destroy the tarnished droplet – and pick up right where you left off. (Talking from personal experience here. I was not smart enough to do that and eventually crashed my droplet w/5 WordPress installations and, believe me, salvaging what I can and rebuilding the rest from scratch has been a B!t@H!)
Have another answer? Share your knowledge.