How to Install crontab on CentOS 6.2

Crontab is a utility in Unix-like operating systems that allows users to schedule jobs (commands or scripts) to run automatically at specified times or intervals. It is very useful for performing routine tasks such as backups, system maintenance, and other automated processes.

[root@centos62 ~]# crontab -e
bash: crontab: command not found

In this guide, we will show you how to install crontab on CentOS 6.2.

Step 1: Update Your System

Before installing crontab, it is important to make sure your system is up-to-date. You can do this by running the following command:

sudo yum update

This command will update your system’s packages and dependencies.

Step 2: Install Crontab

To install crontab on CentOS 6.2, run the following command:

sudo yum install cronie

This command will install the cronie package, which includes the crontab utility.

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * updates:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package cronie.i686 0:1.4.4-7.el6 will be installed
--> Processing Dependency: dailyjobs for package: cronie-1.4.4-7.el6.i686
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-7.el6.i686
--> Running transaction check
---> Package cronie-anacron.i686 0:1.4.4-7.el6 will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-7.el6.i686
---> Package exim.i686 0:4.72-2.el6 will be installed
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                 Arch            Version                Repository                     Size
 cronie                  i686            1.4.4-7.el6            CentOS6.2-Repository           70 k
Installing for dependencies:
 cronie-anacron          i686            1.4.4-7.el6            CentOS6.2-Repository           29 k
 crontabs                noarch          1.10-33.el6            CentOS6.2-Repository           10 k
 exim                    i686            4.72-2.el6             epel                          1.2 M

Transaction Summary
Install       4 Package(s)

Total download size: 1.3 M
Installed size: 3.9 M
Downloading Packages:
(1/4): exim-4.72-2.el6.i686.rpm                                              | 1.2 MB     00:11
Total                                                               111 kB/s | 1.3 MB     00:12
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : exim-4.72-2.el6.i686                                                             1/4
  Installing : cronie-1.4.4-7.el6.i686                                                          2/4
  Installing : crontabs-1.10-33.el6.noarch                                                      3/4
  Installing : cronie-anacron-1.4.4-7.el6.i686                                                  4/4

  cronie.i686 0:1.4.4-7.el6

Dependency Installed:
  cronie-anacron.i686 0:1.4.4-7.el6     crontabs.noarch 0:1.10-33.el6     exim.i686 0:4.72-2.el6


Step 3: Start the Crond Service

Now that crontab is installed, you need to start the crond service. Run the following command:

sudo service crond start

This command will start the crond service and enable it to run at system startup.

See also  How to Install MySQL Database Server on Fedora 16

Step 4: Verify Crontab Installation

To verify that crontab is installed and working correctly, you can create a test cron job. Run the following command:

crontab -e

This command will open the crontab editor. Add the following line to the file:

* * * * * echo "Hello World" >> /tmp/crontab-test.txt

This cron job will run every minute and append the text “Hello World” to the file /tmp/crontab-test.txt. Save and exit the crontab editor by pressing Ctrl + X, then Y, and finally Enter.

Wait a minute, and then check the contents of the file /tmp/crontab-test.txt by running the following command:

cat /tmp/crontab-test.txt

If crontab is working correctly, you should see the text “Hello World” in the file.

See also  How to Install Apache httpd on Linux Fedora 16 Server

Commands Mentioned:

  • sudo yum update – Update your system
  • sudo yum install cronie – Install crontab
  • sudo service crond start – Start the crond service
  • crontab -e – Open the crontab editor
  • cat /tmp/crontab-test.txt – Check the contents of the file `/tmp/crontab-test.txt`


In this guide, we have shown you how to install crontab on CentOS 6.2. By following these steps, you can schedule jobs to run automatically at specified times or intervals, which can save you time and effort in performing routine tasks. We hope this guide has been helpful to you. If you have any comments or suggestions for improvements, please feel free to share them below.


1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *