How can I view the IP addresses of visitors who view the home page of my site?
If you are using Apache, all page requests are recorded in the log directory. On a Ubuntu machine the location of this directory will be /var/log/apache2.

To block spam traffic, I recommend the mod_spamhaus module. This link contains information on how to setup mod_spamhaus on a Ubuntu machine. The module checks for blacklisted IPs listed on the Spamhaus project and subsequently refuses the connection if a positive match is found.