Counter-intuitively, none of these names have to match any of the others.
Changing hostname name
Change the file /etc/hostconfig. It has a line saying:
HOSTNAME=-AUTOMATIC-
Change the "-AUTOMATIC-" to be the name you want.
If it is kept as "-AUTOMATIC-" the system gets its hostname while booting
either from bootp or dhcp.
The file is included by /etc/rc.common which is read by
various shell scripts during bootup. It sets sh variables that are
used by the scripts to determine how the system is to be setup.
Changing DNS hostname
Set the hostname like this
sudo hostname -s yournewhostname.your.domain
Changing Appleshare name
Use the "Sharing" pane of the System Preferences -> Network panel.