Monday, September 29, 2008

How to install caldev server in ubuntu

>>>>>>>>>>>>>process to install caldev server in ubuntu>>>>>>>>>>>>

a>Open terminal.
b>sudo gedit /etc/apt/sources.list.
c>Add (deb unstable awm ) to the end of the line.
d>Save and close gedit.
e>sudo apt-key advanced --keyserver --recv-keys CCA377BD77494424B0DB674F8C90347F8F068012
f>sudo apt-get update

sudo apt-get install libawl-php
sudo apt-get install rscds
g>Install postgresql in ubuntu

$ sudo apt-get install postgresql postgresql-client postgresql-contrib
$ sudo apt-get install pgadmin3

h>Reset the password for the ‘postgres’ admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account):

$ sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD 'password';
template1=# \q

That alters the password for within the database, now we need to do the same for the unix user ‘postgres’:

$ sudo passwd -d postgres
$ sudo su postgres -c passwd

Now enter the same password that you used previously.

i>Then, from here on in we can use both pgAdmin and command-line access (as the postgres user) to run the database server. But before you jump into pgAdmin we should set-up the PostgreSQL admin pack that enables better logging and monitoring within pgAdmin. Run the following at the command-line:

$ sudo su postgres -c psql < /usr/share/postgresql/8.3/contrib/adminpack.sql j>Finally, we need to open up the server so that we can access and use it remotely - unless you only want to access the database on the local machine. To do this, first, we need to edit the postgresql.conf file:

$ sudo gedit /etc/postgresql/8.3/main/postgresql.conf

Now, to edit a couple of lines in the ‘Connections and Authentication’ section…

Change the line:

#listen_addresses = 'localhost'


and also change the line:

#password_encryption = on


password_encryption = on

Then save the file and close gedit.

Now for the final step, we must define who can access the server. This is all done using the pg_hba.conf file.

$ sudo gedit /etc/postgresql/8.3/main/pg_hba.conf

Comment out, or delete the current contents of the file, then add this text to the bottom of the file:

# If you change this first entry you will need to make sure that the
# database
# super user can access the database using some other method.
# Noninteractive
# access to all databases is required during automatic maintenance
# (autovacuum, daily cronjob, replication, and similar tasks).
# Database administrative login by UNIX sockets
local all postgres ident sameuser

# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all md5
# IPv6 local connections:
host all all ::1/128 md5

# Connections for all PCs on the subnet
host all all localhost md5

That’s it, now all you have to do is restart the server:

$ sudo /etc/init.d/postgresql-8.3 restart

And all should be working.

j>install Apache, PHP and finally MySQL.

k> Database Stuff

Once all the package installations are done you start by making the DAViCal database in PostgreSQL. To this purpose you create 2 functional accounts in postgreSQL. Assuming you have root or sudo rights;

>sudo su
>su postgres -c "createuser davical_app"

You will get asked about superusers, roles and databases, but "just say NO" to all questions, this functional ID needs only minimum rights. Repeat the process to create one more user, "davical_dba".

l>Once these 2 functional IDs are created go to "/etc/postgresql/8.1/main/" and open the file pg_hba.conf with an editor of choice. (You may want to back up the file before editing, just in case.) Add the following 3 lines near or at the top;

local all all trust
local davical davical_dba trust
local davical davical_app trust

Then restart your postgreSQL server by;

>/etc/init.d/postgresql-8.1 restart

Now you can run the script to create the DAViCal database. This is done as follows;

>su postgres -c /usr/share/rscds/dba/

(previously I had ">su postgres -c /usr/share/davical/dba/" but that was a
mistake due to me doing a cut'n'paste from an older document. Someone was kind enough to
point that out in an edit.)

i>Once the creation script has run correctly, go back to the pg_hba.conf file and remove the line

local all all trust

m>restart the database daemon. (This step is not strictly necessary for the installation, but do you really want just anybody with a local account free access to all the databases? Thought not.)

If you want to test that your database creation was successful,

>sudo su
>su postgres
>psql davical
davical=# \z

You should see about 30 tables all with some sort of access permission to "davical_dba". (Type "\q" to exit pqsl)


cd /var/www
sudo mkdir cal

sudo ln -s /usr/share/rscds/htdocs/ cal/

sudo /etc/init.d/apache2 restart

Next step is to actually configure DAViCal. Go to "/etc/davical/". Currently it should be an empty directory. Create a configuration file with the naming convention localhost-conf.php,
The content of the configuration file should be as follows;

domain_name = "localhost";
// $c->sysabbr = 'rscds';
$c->admin_email = '';
$c->system_name = "Really Simple CalDAV Store";
// $c->collections_always_exist = true;
// $c->enable_row_linking = true;
$c->default_locale = en_US.UTF-8;
$c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';

Creating a symbolic link to localhost-conf.php helps when you want to test or administer the installation from the server locally.

cd /etc/rscds/
ln -s localhost-conf.php localhost-conf.php

cd /usr/share/rscds/inc
ln -s /usr/share/awl/inc/* .

1. In a browser go to "http://localhost/cal/".
2. You will find a login screen.
3. Enter "admin" for username.
4. Enter the password obtained after running the database creation script.

Congratulations! You should now find yourself in the administration screen, with the ability to create new users.

If you forgot the Admin Password

If at this point you are saying, "d*mn, where is that admin password I wrote down...", no sweat. Do the following;

>sudo su
>su postgres
>psql davical -c 'select username, password from usr;'

Only the initial "admin" password is stored in plain text. All subsequent users have their password stored in an encrypted state. If you change the admin password through the web interface it will also be encrypted from that point forward.

give me the half share of the money after the installation.

1 comment:

Big Daddy Lewis said...

Great howto.
So far.
I changed some of your instructions to point at the postgresql 8.3 instead of 8.1 under section L
I now have a different problem though...
1st the directory /etc/rscdss doesn't exist.

Using Ubuntu 8.10 with LAMP, OpenSSH, and postgresql installed from cd repositories.
Setup APT sources as indicated and installed rscds and pgadmin3, then began configuration according to your instructions.

I guess I will attempt a barebones install and manually install each individual package as you've done. I'll let you know how it goes.