In order to enable remote control of iTunes in Mac, first configure your Firewall to allow incoming connection. To do this, go to System Preferences -> Security and then click on the Firewall tab. Make sure not to allow all incoming connections as it may lead to security threat to your Mac. Simply set access for specific services and select iTunes from the App list.
To enable sharing of music library, first startup your iTunes. Go to Preferences and in the Sharing tab, check the “Share my library on my local network”. For the share, you can also set a password.