For Ubuntu, Debian or Linux Mint, you can just do:

sudo apt-get install xdotool

For rpm-based distribution, open a terminal and run the following command:

sudo yum install xdotool

For CentOS user, the package is available in EPEL repo. After enabling EPEL repo, simply use yum command as above.

For Arch user, the package is available in the Community repo:

sudo pacman -S xdotool