How to install crond/crontab on CentOS/RHEL servers?
The daemon crond is pre-installed in almost all servers. In some rare situations, we need to install it manually on our servers. Here I’m going to explain the steps to install cron daemon on CentOS and RHEL servers. We all know ‘What is crond?’ and its importance in servers. The daemon crond is using for job scheduling.
Crontab is the program used to install, remove or list the tables used to drive the cron daemon. Cronjobs are predefined jobs which are running periodically according to the settings we have done previously. In the /etc folder there is a file called crontab where we can write the command or name of the script that is to be executed at as per our customized time. You can refer the link pasted below to schedule jobs using crontab.
How to check whether it’s already installed on the server?
Yeah.. This is important to check if it’s installed, before going to start the installation steps. We can check this by using the following commands:
rpm -qa|grep cron
[[email protected] ~]$ rpm -qa|grep cron crontabs-1.11-6.20121102git.el7.noarch cronie-anacron-1.4.11-14.el7_2.1.x86_64 cronie-1.4.11-14.el7_2.1.x86_64
Installation steps – for CentOS/RHEL 6
This is how I install crond onto my CentOS server edition as it doesn’t seem to come preinstalled, this might not be true for other distributions and the following command may not work for all distributions.
Execute the following command:
yum -y install vixie-cron crontabs
And then start it with:
/sbin/service crond start
To start the daemon on boot, add it to chkconfig:
chkconfig crond on
That’s it dude!!
Hey, I have a CentOS 7 / RHEL 7 server. How can I enable crond on it?
On CentOS 7 vixie-cron is not longer available, so you need to use cronie to install cron daemon on this server. Please use the following command to install crond on CentOS 7 server:
yum install cronie
Let me know if you’ve any questions!