https://wiki.davical.org/index.php?title=Debian_7_shared&feed=atom&action=history
Debian 7 shared - Revision history
2024-03-28T14:19:27Z
Revision history for this page on the wiki
MediaWiki 1.40.1
https://wiki.davical.org/index.php?title=Debian_7_shared&diff=3783&oldid=prev
Narcisgarcia: Dedicated to Debian 7 - old
2019-02-08T08:08:44Z
<p>Dedicated to Debian 7 - old</p>
<p><b>New page</b></p><div>This guide is intended to systems where can be more than one DAViCal installation, and permissions are not open to other users in the system or in Apache websites.<br />
<br />
'''Systems tested:'''<br />
* Debian 7 (Wheezy)<br />
* See for other [[Debian]] versions<br />
<br />
'''Software versions tested:'''<br />
* DAViCal 1.1.3.1<br />
* PostgreSql 9.1<br />
<br />
== Install guide ==<br />
Install PostgreSQL service, HTTP service and PHP specific components:<br />
sudo apt-get update<br />
sudo apt-get install postgresql task-web-server php5-curl php5-cgi<br />
<br />
Install current DAViCal version with wheezy dependencies:<br />
sudo apt-get install davical davical-doc<br />
<br />
(optional) If you want a newer version of DAViCal;<br />
Create Jessie repository entry to update only DAViCal:<br />
DebLine="$(cat /etc/apt/sources.list | grep -e '^deb .* wheezy.* main' | grep -ve 'updates')"<br />
echo "$DebLine" | sed -e 's|wheezy|jessie|g' | sudo tee /etc/apt/sources.list.d/jessie.list<br />
sudo apt-get update<br />
sudo apt-get install davical davical-doc<br />
# Disable Jessie repository:<br />
DebLines="$(cat /etc/apt/sources.list.d/jessie.list | sed -e 's|^|#|g')"<br />
echo "$DebLines" | sudo tee /etc/apt/sources.list.d/jessie.list<br />
sudo apt-get update<br />
<br />
Prepare the DAViCal database values<br />
DatabaseName=mycaldb<br />
DBUsername_dba=mycaluser_dba<br />
DBUsername_app=mycaluser_app<br />
DBPassword=12345<br />
AdminPassword=1234<br />
<br />
Add open permissions temporarily for the installation scripts:<br />
MediumPgVersion="$(psql --version | grep -ie "sql" | tr -s " " "\n" | tail --lines=1 | cut -f 1,2 -d ".")"<br />
PgConfig="/etc/postgresql/${MediumPgVersion}/main/pg_hba.conf"<br />
sudo mv "$PgConfig" "${PgConfig}.davical-bak"<br />
sudo cp -a "${PgConfig}.davical-bak" "$PgConfig"<br />
echo "# Permissions for the DAViCal CMS" | sudo tee "$PgConfig"<br />
echo "local $DatabaseName $DBUsername_dba trust" | sudo tee --append "$PgConfig"<br />
echo "local $DatabaseName $DBUsername_app trust" | sudo tee --append "$PgConfig"<br />
echo "" | sudo tee --append "$PgConfig"<br />
sudo cat "${PgConfig}.davical-bak" | sudo tee --append "$PgConfig"<br />
# Service name can be only "postgresql" or more:<br />
sudo service postgresql-${MediumPgVersion} reload<br />
<br />
Apply a temporary patch to creation script:<br />
CScript="/usr/share/davical/dba/create-database.sh"<br />
sudo mv "$CScript" "${CScript}.davical-bak"<br />
sudo cp -a "${CScript}.davical-bak" "$CScript"<br />
cat "${CScript}.davical-bak" | sed -e "s/DBNAME=.*/DBNAME=${DatabaseName}/g" | sed -e "s/AWL_DBAUSER=.*/AWL_DBAUSER=${DBUsername_dba}/g" | sed -e "s/AWL_APPUSER=.*/AWL_APPUSER=${DBUsername_app}/g" | sudo tee "$CScript"<br />
<br />
Apply a temporary patch to update script:<br />
UScript="/usr/share/davical/dba/update-davical-database"<br />
sudo mv "$UScript" "${UScript}.davical-bak"<br />
sudo cp -a "${UScript}.davical-bak" "$UScript"<br />
cat "${UScript}.davical-bak" | sed -e "s/\$dbname = .*/\$dbname = \"${DatabaseName}\";/g" | sed -e "s/\$dbuser = .*/\$dbuser = \"${DBUsername_dba}\";/g" | sed -e "s/\$appuser = .*/\$appuser = \"${DBUsername_app}\";/g" | sed -e "s/\$dbpass = .*/\$dbpass = \"${DBPassword}\";/g" | sudo tee "$UScript"<br />
<br />
'''(only fresh install)''' Run main installation script and take note of the shown password for the 'admin' user:<br />
sudo su -l postgres -c "$CScript" "$DatabaseName" "$AdminPassword"<br />
<br />
'''(only restoration of a backup)''' Restore data and run update script:<br />
echo "DROP DATABASE IF EXISTS mycaldb;" | sudo su -l postgres -c psql<br />
echo "DROP USER IF EXISTS mycaluser_dba;" | sudo su -l postgres -c psql<br />
sudo su -l postgres -c "psql --quiet --file mycaluser_dba.pgdump"<br />
echo "DROP USER IF EXISTS mycaluser_app;" | sudo su -l postgres -c psql<br />
sudo su -l postgres -c "psql --quiet --file mycaluser_app.pgdump"<br />
sudo su -l postgres -c "psql --quiet --file mycaldb.pgdump"<br />
sudo su -l postgres -c "$UScript"<br />
<br />
Restore installation scripts to original:<br />
sudo mv "${UScript}.davical-bak" "$UScript"<br />
sudo mv "${CScript}.davical-bak" "$CScript"<br />
<br />
'''(only fresh install)''' Set password authentication for the database:<br />
echo "ALTER USER $DBUsername_dba WITH PASSWORD '${DBPassword}';" | sudo su -l postgres -c psql<br />
echo "ALTER USER $DBUsername_app WITH PASSWORD '${DBPassword}';" | sudo su -l postgres -c psql<br />
<br />
Allow these authenticated access to PostgreSql:<br />
echo "# Permissions for the DAViCal CMS" | sudo tee "$PgConfig"<br />
echo "local $DatabaseName $DBUsername_dba password" | sudo tee --append "$PgConfig"<br />
echo "local $DatabaseName $DBUsername_app password" | sudo tee --append "$PgConfig"<br />
echo "" | sudo tee --append "$PgConfig"<br />
sudo cat "${PgConfig}.davical-bak" | sudo tee --append "$PgConfig"<br />
# Service name can be only "postgresql" or more:<br />
sudo service postgresql-${MediumPgVersion} reload<br />
<br />
Create or restore configuration file as /etc/davical/caldav.example.net-conf.php (for a virtualhost ''caldav.example.net'') with its content as in the following example:<br />
<?php<br />
$c->admin_email = 'admin@example.net';<br />
$c->system_name = "My CalDAV Server";<br />
$c->enable_row_linking = true;<br />
$c->default_locale = 'en_US.UTF-8';<br />
<br />
$c->pg_connect[] = 'dbname=mycaldb port=5432 user=mycaluser_app password=12345';<br />
Avoid permissions issues:<br />
sudo chmod a+r /etc/davical/caldav.example.net-conf.php<br />
<br />
Create or restore Apache virtualhost with its profile content as in this example:<br />
<VirtualHost *:80 *:8008 *:8800><br />
ServerName caldav.example.net<br />
DocumentRoot /usr/share/davical/htdocs<br />
DirectoryIndex index.php index.html<br />
Alias /images/ /usr/share/davical/htdocs/images/<br />
<Directory /usr/share/davical/htdocs/><br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all<br />
</Directory><br />
php_value include_path /usr/share/awl/inc<br />
php_value magic_quotes_gpc 0<br />
php_value magic_quotes_runtime 0<br />
php_value register_globals 0<br />
php_value error_reporting "E_ALL & ~E_NOTICE"<br />
php_value default_charset "utf-8"<br />
</VirtualHost><br />
(Apache may need to be configured in ports.conf to listen also ports 8008 and 8800)<br />
<br />
Enable Apache website:<br />
sudo a2ensite caldav.example.net<br />
<br />
==== Login to DAViCAL Admin ====<br />
<br />
If all is going well you should now be able to browse to the site pages and log in as 'admin' with the password set during installation.<br />
<br />
== Backup all data ==<br />
* Database (example for accessing mycaldb with user "mycaluser" and password "12345")<br />
env PGPASSWORD=12345 pg_dump --create --inserts --attribute-inserts --disable-dollar-quoting --username=mycaluser -f "mycaldb.pgdump" mycaldb<br />
<br />
* PostgreSql users/roles (example for mycaluser_dba + mycaluser_app)<br />
cat /dev/null > mycaluser_dba.pgdump<br />
sudo su -l postgres -c "pg_dumpall --roles-only" | grep -e " ROLE mycaluser_dba;" >> mycaluser_dba.pgdump<br />
sudo su -l postgres -c "pg_dumpall --roles-only" | grep -e " ROLE mycaluser_dba " >> mycaluser_dba.pgdump<br />
cat /dev/null > mycaluser_app.pgdump<br />
sudo su -l postgres -c "pg_dumpall --roles-only" | grep -e " ROLE mycaluser_app;" >> mycaluser_app.pgdump<br />
sudo su -l postgres -c "pg_dumpall --roles-only" | grep -e " ROLE mycaluser_app " >> mycaluser_app.pgdump<br />
<br />
* CMS configuration:<br />
/etc/davical/caldav.example.net-conf.php<br />
<br />
* Apache site profile:<br />
/etc/apache2/sites-available/caldav.example.net<br />
<br />
== Additional tips ==<br />
<br />
==== Reset the admin password ====<br />
Useful after an installation, when we want to be sure of our wanted password (example for database name "mycaldb" and password "1234")<br />
echo "UPDATE usr SET password = '**1234' WHERE user_no=1;" | sudo su -l postgres -c "psql --dbname mycaldb"<br />
<br />
==== TroubleShooting ====<br />
<br />
See [[Problems and Solutions]] and [[Frequently Asked Questions]]<br />
<br />
[[Category:Debian]]</div>
Narcisgarcia