Before adding your first site, make sure you got Zotonic running and are looking at the nice Powered by Zotonic web page, as described in Installing Zotonic.
Now that you got Zotonic running, it is time to create your first website with it. In this example, the site we are going to add is called yoursite.
Edit your /etc/hosts file, adding an entry for yoursite to point at your local host:
127.0.0.1 yoursite
Create a user in PostgreSQL (change the password for the user!):
CREATE USER zotonic WITH PASSWORD 'zotonic';
Now, either give this user create rights to have Zotonic automatically create the database for you:
ALTER USER zotonic CREATEDB;
Alternatively, you can create the database manually:
CREATE DATABASE zotonic WITH OWNER = zotonic ENCODING = 'UTF8';
GRANT ALL ON DATABASE zotonic TO zotonic;
\c zotonic
CREATE LANGUAGE "plpgsql";
Create a new zotonic site, based on the “blog” skeleton site:
bin/zotonic addsite -s blog yoursite
Note
Zotonic has to be running for the addsite command to succeed.
This will add a site named yoursite. Its default URL will be http://yoursite:8000/ so either put ‘yoursite’ in your hosts file as stated above, or change the {hostname} section of the site’s config file.
Look at Available skeleton sites to see which other skeletons are available to base your site on.
Edit the generated file user/sites/yoursite/config, to make sure your database credentials and the hostname are correct, and change the password for the admin.
Note
Your actual site location might be different, see the User sites directory.
Rebuild Zotonic by typing make, and then (re)start it using bin/zotonic debug.
Now Zotonic will install the initial database. If something goes wrong here, then it is almost always a problem with the database connection. Double-check your database configuration in the user/sites/yoursite/config file.
Visit http://yoursite:8000/ in your browser to see your new blog, or go directly to http://yoursite:8000/admin/ to visit the admin section.
Congratulations! You got your first site running.
To learn more about how sites work and what consists of a Zotonic site, please see the in-depth manual, Anatomy of a site.
Zotonic comes with four different skeletons to base your site on.