Don't leave your system unpatched for 7 years at a time.Can you tell me what are the measures we can take to not happen this kind of attack ?
All software has bugs. When a bug is discovered and fixed, the people who want to break into systems will use those bugs to gain access to your system. If you don't patch then they will succeed. Once a vulnerability is discovered, people set up scans to identify unpatched systems so they can break into them.
Subscribe to the Centos-announce mailing list and tailor your mails to just the ones for the systems/architectures you're interested in. Read the mails and when they're marked as important/critical, you need to patch ASAP.