Maintaining a List on Your Server
There are several sites with free lists of IPs for specific countries, ready to download.
Once you have a list, you can block the IPs in htaccess or httpd.conf. In my view, this is a cumbersome way of blocking visitors from certain countries, because IPs change all the time. Do you want to update your IP country table all the time?
If you did want to use this method, you might add lines like these to your .htaccess:
Allow from all
Deny from 18.104.22.168/15
Deny from 22.214.171.124/16
… etc. (huge list of IP addresses or ranges