{"id":487,"date":"2012-03-03T09:02:43","date_gmt":"2012-03-03T14:02:43","guid":{"rendered":"http:\/\/blog.alanporter.com\/?p=487"},"modified":"2026-05-04T13:08:44","modified_gmt":"2026-05-04T17:08:44","slug":"caldav-iphone","status":"publish","type":"post","link":"https:\/\/alanporter.com\/blog\/2012\/03\/03\/caldav-iphone\/","title":{"rendered":"Host your own calendar server &#8211; iPhone client"},"content":{"rendered":"<p>I am a bit of a do-it-yourselfer. When looking for a new service like an online photo gallery, my first instinct is to find an open source package where I can host photos on my own web server. I know that many will skip this step and go directly to Picasa.<\/p>\n<p>These days, it seems to come down to those choices: do it yourself, or give another slice of your life to Google. In this post, we&#8217;re going to do it ourselves.<\/p>\n<p>Ever since the days of the Palm Pilot, I have made heavy use of the calendar application. When I switched to the iphone in 2009, I decided that I wanted to use a online calendar that I could access from my laptop and from the iphone. I looked at the open source world, and I found a package called <strong>DavICal<\/strong>, by Andrew McMillan in New Zealand. It uses the <strong>CalDAV<\/strong> protocol to exchange event information with clients like the iphone&#8217;s calendar, iCal on the Mac, Mozilla Thunderbird with the Lightning plug-in, Mozilla Sunbird, and (I think) Outlook.<\/p>\n<p>Setting up the server is pretty well documented on the DavICal web site. On a Debian-based server, it&#8217;s a simple &#8220;apt-get&#8221; operation (after you add their site to your sources list).<\/p>\n<p>Below, I will talk about how my calendars are organized, and then I&#8217;ll walk through the steps of setting up a new user and calendars on the server, and then setting up the iphone to access these new calendars.<\/p>\n<p><strong>How I organize my calendars<\/strong><\/p>\n<p>I organized my calendars in two groups, owned by users &#8220;alan&#8221; and &#8220;shared&#8221;.\u00a0 The &#8220;alan&#8221; user owns a set of calendars that I use, but that my family does not care about.\u00a0 The &#8220;shared&#8221; user is stuff that we all need to see. This might seem a little weird, but it makes things work out well on the iphone. Below is a picture of the iphone&#8217;s &#8220;calendars&#8221; screen, which shows this grouping. Notice the orange calendar called &#8220;meetings&#8221;. I have meetings at work all day, and my wife really doesn&#8217;t need to see them on her ipod, and she does not need to hear the reminders throughout the day. So the meetings calendar is owned by the &#8220;alan&#8221; user. On the other hand, we all need to know about family events (yellow), &#8220;his&#8221; stuff (blue) and &#8220;her&#8221; stuff (red).\u00a0 That stuff is owned by the &#8220;shared&#8221; user.<\/p>\n<p>Below, when we set up the iphone calendar accounts, I will have two accounts (&#8220;alan&#8221; and &#8220;shared&#8221;), and my wife will only have one (&#8220;shared&#8221;).\u00a0 I am sure there are other ways to get the permissions to work out, but this is dead-simple, and it shows the division in the screen shot below.<\/p>\n<div id=\"attachment_508\" style=\"width: 330px\" class=\"wp-caption aligncenter\"><a href=\"\/blog\/wp-content\/uploads\/2012\/03\/calendars.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-508\" class=\"size-full wp-image-508\" title=\"calendars\" src=\"\/blog\/wp-content\/uploads\/2012\/03\/calendars.png\" alt=\"iphone calendar screen\" width=\"320\" height=\"480\" \/><\/a><p id=\"caption-attachment-508\" class=\"wp-caption-text\">iphone calendar screen<\/p><\/div>\n<p>In case you wondered, &#8220;calvin&#8221; is my server.\u00a0 And &#8220;FWIW&#8221; stands for &#8220;for what it&#8217;s worth&#8221;&#8230; stuff that I want to know about, but that I am not planning on attending.\u00a0 I want to know when Mardi Gras and Burning Man and DefCon are taking place, but I am not going to any of them.<\/p>\n<p><strong>On the server<\/strong><\/p>\n<p>We&#8217;ll start with the DavICal web interface, which is functional, but not very polished. You need a user account, and that user can own several calendars (called &#8220;collections&#8221;).<\/p>\n<p>To create a user on the DavICal web interface, you need to log in as an administrator and use the menu to &#8220;create a principle&#8221; of type &#8220;person&#8221;. See? Precise, carefully worded, but not so user-friendly.<\/p>\n<p>The new user can now add calendars by logging into the same web interface and selecting &#8220;User Functions&#8221; and &#8220;List My Details&#8221;. That screen shows a bunch of junk you don&#8217;t care about at the top. But at the bottom, there is a list of &#8220;collections&#8221;. That&#8217;s the CalDAV term for a calendar. Use the &#8220;Create Collection&#8221; button to make one or more calendars. Make sure to give them a &#8220;display name&#8221;. That&#8217;s the name that will show up in the iphone&#8217;s calendar list.<\/p>\n<p><strong>On the iphone<\/strong><\/p>\n<p>Once you have the calendars on the web system, the iphone part is easy. Go to &#8220;Settings&#8221;, &#8220;Mail, contacts, calendar&#8221;, and &#8220;add account&#8221; of type &#8220;other&#8221;. Select &#8220;CalDAV&#8221;. Enter four things:<\/p>\n<pre>Server=(the nostname of your CalDAV server)\nUsername=(your new user's name)\nPassword=(your password)\nDescription=(some name)<\/pre>\n<p>When you hit &#8220;next&#8221;, it may pop up a box complaining about SSL certificates. In my case, I don&#8217;t have proper SSL certificates, so we&#8217;re going to just say &#8220;continue&#8221;. Setting up SSL on the server is a future blog post. So we&#8217;ll say &#8220;continue&#8221;. At this point, you wait&#8230; and wait&#8230; for the iphone to guess all of the rest of the settings it can think of.<\/p>\n<p>It will finally finish, and you&#8217;ll have to again tell it &#8220;don&#8217;t use SSL&#8221;. But surprisingly, it should have figured out the rest of the settings.<\/p>\n<pre>SSL=off\nport=80\nURL=http:\/\/USER@SERVER\/caldav.php\/USER<\/pre>\n<p>At that point, when you open the iphone&#8217;s calendar application, your server should show up in the calendar list, with all of the individual calendar names below it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am a bit of a do-it-yourselfer. When looking for a new service like an online photo gallery, my first instinct is to find an open source package where I can host photos on my own web server. I know that many will skip this step and go directly to Picasa. These days, it seems [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-software","category-iphone","count-0","even alt","author-alan","last"],"_links":{"self":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/comments?post=487"}],"version-history":[{"count":1,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/487\/revisions"}],"predecessor-version":[{"id":1136,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/487\/revisions\/1136"}],"wp:attachment":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/media?parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/categories?post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/tags?post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}