CentOS minimal template’s issue with crontab

On my CentOS 5.x 64bit XEN PV template (XEN PV is a virtualization type, this means I am talking about a VPS) doing ‘crontab -e’ gave me the following error

[root@vpsadmin ~]# crontab -e
no crontab for root - using an empty one
/bin/sh: /bin/vi: No such file or directory
crontab: "/bin/vi" exited with status 127

To correct this issue, do the following

[root@vpsadmin ~]# touch ~/.bashrc
[root@vpsadmin ~]# export VISUAL=nano
[root@vpsadmin ~]# source ~/.bashrc

So, now if you do ‘crontab -e’ it will work as it should

[root@vpsadmin ~]# crontab -e
no crontab for root - using an empty one
crontab: no changes made to crontab