Given the end of free iTools, I decided to post a guide on how to set up your own domain on your OS X box at home with an email and web server. This requires an always-on connection (though dynamic IP is okay). Also, it assumes the use of OS X 10.1.5, and some steps require the Developer Tools. Finally, a good understanding of UNIX would definitely be useful. I can't guarantee the success, as most of this was written in hindsight, so proceed at your own risk. I would suggest reading the comments by other people to make sure nothing extremely bad is done by following these instructions.
Read the rest of the artcile for the detailed how-to...
Port ServiceYou might notice that FTP is missing. This is because the FTP server is often used for a Denial of Service attack, something that can drastically slow down your connection. Since I do not know how to defend against this, I figure it's better to just leave it off. I also leave SSH blocked by my router, as leaving it on can give complete access to a machine through hacking a password. By now SSH and afpovertcp should already work with your domain.
22 ssh (remote login)
25 smtp and mail (mail server)
80 http (web server)
143 imap (used for remote access of mail)
548 afpovertcp (Apple File Server, for remote access of files)
% cd /etcNow edit the file "hostconfig", using sudo so that we can save: % sudo hostconfigThis should open up an editor window with this file. Find the line "HOSTNAME=-AUTOMATIC-" and replace "-AUTOMATIC-" with "yourdomain.com". Now we need to turn on what services this server provides. Turn all "-NO-" to "-YES-" for each service. For example:
MAILSERVER=-YES-Save the file (type Control-x Control-s) and exit emacs (Control-x Control-c). Now we need to take care of the OS X side of things. Open "NetInfo Manger.app" in the Utilities folder. Authenticate. Browse to /machines/localhost. Edit the "name" property, so that it is a list with "yourdomain.com" first and "localhost" second.
SSHSERVER=-YES-
WEBSERVER=-YES-
% cd /etc/httpd/This directory holds the Apache config files. Open httpd.conf in emacs:
% sudo emacs httpd.confSearch for the line with a commented out "ServerName", or in other words hit Control-s, type "ServerName", and hit return. The cursor should be in the correct place. Uncomment the line and replace "fisheye" with "www.yourdomain.com". There are several other configuration details you may wish to do, so just look through this file and read the comments. Finally we need to turn on the web server. Simply open "System Preferences", go to "Sharing", and click the button to turn on "Web Sharing". That should be it. Your web documents should be placed in in "~/Sites", or "/Library/WebServer/Documents".
% cd /usr/share/sendmail/conf/cfThe default should work as is. So we need to compile it and put it in the correct place, but first backup the original configuration file:
% sudo cp generic-darwin.mc yourdomain.mc
% sudo cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.origWe also need to tell NetInfo where to look for the configuration file:
% m4 ../m4/cf.m4 yourdomain.mc > /tmp/sendmail.cf
% sudo cp /tmp/sendmail.cf /etc/mail/
% sudo niutil -create . /locations/sendmailThis is the command line version of "NetInfo Manager.app". Now do some other miscellaneous things that sendmail requires to work properly:
% sudo niutil -createprop . /locations/sendmail sendmail.cf /etc/mail/sendmail.cf
% sudo chgrp smmsp /var/spool/clientmqueueThe last line will make the root directory uneditable. This is a security measure, though if this really is a problem, it is possible to get around it. Look at the various other sendmail articles to see how.
% sudo chmod g-w /
% sudo emacs /System/Library/StartupItems/Sendmail/SendmailDirectly below the line "/usr/sbin/sendmail -bd -q1h", which is near the bottom, add the line:
/usr/sbin/sendmail -C /etc/mail/submit.cf -q1hRestart. Now sendmail (which incidently also receives mail) should be working find. Try it out:
% mail any@emailaddress.comYou can use any email address, and to finish the email type a line with a single '.' You should also be able to receive mail now. Try sending an email to username@yourdomain.com, where username is the short name to any OS X User on the server computer. To read the email on the command line type:
% cd ~/Library/MailNow we need to setup Mail.app. Open the preferences window. Click "Create Account". Choose Account Type: "UNIX Account". Fill out the remaining information using "localhost" for SMTP Server. Now go to the "Account Options" tab. Set "Account Directory: " to "~/Library/Mail/UNIX:username@yourdomain.com". This will add "Inbox" to your personal mailboxes, which should show all your unix mail.
% mkdir UNIX:username@yourdomain.com
% chmod 700 UNIX:username@yourdomain.com
% mkdir -p /usr/local/libexecFinally, we need to setup imapd so it runs at startup. Open "/etc/inetd.conf" in emacs:
% sudo cp imapd/imapd /usr/local/libexec
% sudo ./imap.sh
% sudo ./mailbox.sh username
% sudo emacs /etc/inetd.confUncomment (remove all # signs) the line:
##imap4 stream tcp nowait root /usr/libexec/tcpd /usr/local/libexec/imapdRestart. Imap should now work.
Mac OS X Hints
http://hints.macworld.com/article.php?story=2002072810534382