Difference between revisions of "OwnCloud"

From Wikislax
Jump to: navigation, search
(Created page with "{{RightTOC}} == What is OwnCloud ? == [http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different cli...")
 
(Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am:)
 
(18 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
[http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.
 
[http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.
 +
 +
The [https://doc.owncloud.com/server/10.15/admin_manual/installation/quick_guides/ubuntu_20_04.html/ Owncloud install doc] provided is for Ubuntu.
 +
 +
It is adapted below for Slackware 15.0.
  
 
== Installing OwnCloud ==
 
== Installing OwnCloud ==
  
OwnCloud is available as a PHP application relying on various databases. See the OwnCloud documentation for details. We will be using MySQL. [https://owncloud.com/download-server download] tarball then untar and install.
+
OwnCloud is a PHP application. [https://owncloud.com/download-server download] tarball then untar and install.
  
 
  # tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
 
  # tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
Line 13: Line 17:
 
  # cd /var/www/htdocs
 
  # cd /var/www/htdocs
 
  # ln -s /usr/local/owncloud owncloud
 
  # ln -s /usr/local/owncloud owncloud
# cd ..
 
 
  # chown -R apache:apache owncloud
 
  # chown -R apache:apache owncloud
  
That's it. <u>Note</u> : the other package Dahdi-tools is not required. <u>Other note</u> : Dahdi requires a kernel compiled with CONFIG_CRC_CCITT=y.
+
== Creating the occ helper script ==
 
 
== Installing Jansson ==
 
  
Jansson is a required Json development library. [http://www.digip.org/jansson/releases/ Download] then untar and install.
+
occ is an OwnCloud administration command.
  
  # tar -C /usr/local -xvf jansson-x.y.z.tar.gz
+
  # FILE="/usr/local/bin/occ"
  # cd /usr/local/jansson-linux-x.y.z
+
# cat <<EOM >$FILE
  # ./configure --prefix=/usr/local --libdir=/usr/local/lib64
+
  > #! /bin/bash
  # make
+
> cd /usr/local/owncloud
  # make install
+
  > sudo -E -u apache /usr/bin/php /usr/local/owncloud/occ "\$@"
# make clean
+
  > EOM
 +
  # chmod u+x $FILE
  
== Installing c-client ==
+
== Creating the OwnCloud database ==
  
The asterisk imap option requires presence of library c-lient.a, which is part of Imap-uw, by the University of Washington. The University of Washington seems to be no longer distributing the software so we keep a copy for your convenience. [{{SERVER}}/wikislax/download/c-client.tar.Z Download] then untar and install :
+
OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :
  
  # gunzip c-client.tar.Z
+
  # mysql -u root -e \
# tar -C /usr/local -xvf c-client.tar
+
  "CREATE DATABASE IF NOT EXISTS owncloud; \
# cd /usr/local
+
  CREATE USER IF NOT EXISTS 'owncloud'@'localhost' IDENTIFIED BY 'password'; \
# chown -R root:root imap-2007f
+
  GRANT ALL PRIVILEGES ON *.* TO 'owncloud'@'localhost' WITH GRANT OPTION; \
# chmod -R o-w imap-2007f
+
  FLUSH PRIVILEGES;"
# cd imap2007f
+
  #
  # make slx EXTRACFLAGS="-I/usr/include/openssl -g -O2 -fPIC" SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private
 
  
== Installing Speex ==
+
It is also possible to create user owncloud@localhost and database from phpmyadmin.
  
Speex is a required free codec. [https://www.speex.org/downloads/ Download] speex source code then untar and install.
+
== setting up the owncloud database ==
  
# tar -C /usr/local -xvf speex-x.y.z.tar.gz
+
The admin user is the one who will manage the other users and OwnCloud from the OwnCloud web page.
# cd /usr/local/speex-x.y.z
 
# ./configure --prefix=/usr/local --libdir=/usr/local/lib64
 
# make
 
# make install
 
# make clean
 
  
== Installing Asterisk ==
+
# occ maintenance:install \
 +
    --database "mysql" \
 +
    --database-name "owncloud" \
 +
    --database-user "owncloud" \
 +
    --database-pass "password" \
 +
    --data-dir "/var/www/htdocs/owncloud/data" \
 +
    --admin-user "admin" \
 +
    --admin-pass "admin"
 +
ownCloud was successfully installed
 +
#
  
[http://www.asterisk.org/downloads Download Asterisk] then untar and install. Make menuselect affords choosing which components to use. If using mysql, be sure to read the next paragraph before invoking make. Otherwise proceed. make samples affords creating the configuration files in /usr/local/etc/asterisk.
+
== Configure ownCloud’s Trusted Domains ==
  
  # groupadd asterisk
+
  # my_ip=$(hostname -I|cut -f1 -d ' ')
# useradd -g asterisk asterisk
+
  # occ config:system:set trusted_domains 1 --value="$my_ip"
  # tar -C /usr/local --no-same-permissions --no-same-owner -xvf asterisk-x.y.z.t.tar.gz
+
  System config value trusted_domains => 1 set to string x.y.z.t
  # cd /usr/local/asterisk-x.y.z.t
+
  # occ config:system:set trusted_domains 2 --value="$HOSTNAME"
  # ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --mandir=/usr/local/man \
+
  System config value trusted_domains => 2 set to string your.domain.tld
  --with-asound --with-crypto --with-iconv --with-imap=/usr/local/imap-2007f \
+
  #
--with-jansson --with-ldap --with-speex --with-ssl
 
# make menuselect
 
# make
 
# make install
 
# make install-logrotate
 
  # make samples
 
# make clean
 
# chown -R asterisk:asterisk /usr/local/lib64/asterisk
 
# chown -R asterisk:asterisk /usr/local/var/lib/asterisk
 
# chown -R asterisk:asterisk /usr/local/var/log/asterisk
 
# chown -R asterisk:asterisk /usr/local/var/run/asterisk
 
# chown -R asterisk:asterisk /usr/local/var/spool/asterisk
 
# chmod o+x /usr/local/etc/asterisk
 
# chmod o-x /usr/local/lib64/asterisk
 
# chmod o-x /usr/local/var/lib/asterisk
 
# chmod o-x /usr/local/var/log/asterisk
 
# chmod o-x /usr/local/var/run/asterisk
 
# chmod o-x /usr/local/var/spool/asterisk
 
  
If using mysql modules, there might be a glitch with the mysql include path. Replace in the files below the lines with "#include <mysql/mysql.h>" by lines with "#include <mysql.h>" (removing the directory) :
+
== Configure the cron jobs ==
  
addons/app_mysql.c
+
Set your background job mode to cron:
addons/cdr_mysql.c
 
addons/res_config_mysql.c
 
  
It is then possible to launch asterisk in the foreground with various levels of verbosity (depending on the number of v's). However the default configuration files include a number of options that we don't want, so we'll rename them first and start with empty files. Asterisk includes a console and then proposes a shell :
+
# occ background:cron
 +
Set mode for background jobs to 'cron'
 +
  #
  
# cd /usr/local/etc/asterisk
+
== Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am: ==
# mv extensions.conf extensions.conf.sample
 
# mv extensions.ael extensions.ael.sample
 
# mv sip.conf sip.conf.sample
 
# sudo -u asterisk asterisk -vvvc
 
. . .
 
*CLI>
 
  
Type '''help''' to view the available commands, however before doing anything useful we'll need to modify the configuration files so let's just '''core stop gracefully''' here.
+
# echo "MIN HOUR DAY MONTH DAYOFWEEK COMMAND" >> /var/spool/cron/crontabs/apache
 +
# echo "*/15  *  *  *  * /var/www/htdocs/owncloud/occ system:cron" >> /var/spool/cron/crontabs/apache
 +
# echo "0  2  *  *  * /var/www/htdocs/owncloud/occ dav:cleanup-chunks" >> /var/spool/cron/crontabs/apache
 +
# chgrp apache /var/spool/cron/crontabs/apache
 +
#
  
== Running asterisk ==
+
== Configure Log Rotation ==
  
Asterisk runs as a daemon so must be launched at startup and stopped at shutdown. Update /etc/rc.d/rc.local and /etc/rc.d/rc.local_shutdown accordingly :
+
  # FILE="/etc/logrotate.d/owncloud"
 
+
  # cat <<EOM >$FILE
  # vi /etc/rc.d/rc.local
+
  /var/www/htdocs/owncloud/data/owncloud.log {
. . .
+
  size 10M
  # start asterisk
+
  rotate 12
  if [ -x /usr/local/sbin/safe_asterisk ]; then
+
  copytruncate
        echo "Starting asterisk: /usr/local/sbin/safe_asterisk -G asterisk -U asterisk -p"
+
  missingok
        /usr/local/sbin/safe_asterisk -G asterisk -U asterisk -p
+
  compress
fi
+
  compresscmd /bin/gzip
  <esc>
+
  }
  :x
+
  EOM
  # vi /etc/rc.d/rc.local_shutdown
+
  #
  . . .
 
  # stop asterisk
 
  if [ -r /usr/local/var/run/asterisk/asterisk.pid ]; then
 
        echo "Stopping asterisk: kill -INT `cat /usr/local/var/run/asterisk/asterisk.pid`"
 
        kill -INT `cat /usr/local/var/run/asterisk/asterisk.pid`
 
  fi
 
  <esc>
 
  :x
 
 
 
== Configuring Asterisk ==
 
 
 
Asterisk running in the backgroung, it's possible to attach to the process using '''asterisk -r''' and to exit the asterisk shell by typing '''exit'''. Most of the configuration files can be modified externally then reloaded using commands such as '''dialplan reload''', '''sip reload''', or '''voicemail reload'''. A few files however cannot (example confbridge.conf), and require restarting using '''core restart now'''. Type '''help''' to get a complete list of commands.
 
 
 
The configuration files are created under EPREFIX/etc and there are many of them (112 in version 1.15.0.0 !). The bad news is that they must be all reviewed and modified to remove unneeded configuration options. When done though, modifying only a few will afford getting a working system with a reasonnable set of features. We decided to use LDAP to configure our users so this is what is detailed below.
 
 
 
<u>Note</u> : the asterisk configuration files are organized in contexts whose names are enclosed in square brackets on a line of its own. Definitions in these contexts - otherwise mentionned - are valid inside these contexts only.
 
 
 
{| {{thead}}
 
|-
 
! {{chead}} width="150" | Configuration file
 
! {{chead}} | Usage
 
|-
 
| [[Sip.conf|sip.conf]]
 
| to configure sip accounts
 
|-
 
| [[Res_ldap.conf|res_ldap.conf]]
 
| to configure LDAP users
 
|-
 
| [[Confbridge.conf|confbridge.conf]]
 
| to configure conferences
 
|-
 
| [[Voicemail.conf|voicemail.conf]]
 
| to configure voicemail boxes
 
|-
 
| [[Extensions.conf|extensions.conf]]
 
| to configure the dialplan
 
|}
 
  
 
<br clear=all>
 
<br clear=all>
  
== Documentation ==
+
{{pFoot|[[Asterisk]]|[[Main Page]]|[[Desktop software]]}}
 
 
[https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Documentation Asterisk Wiki]
 
 
 
[{{SERVER}}/wikislax/download/Asterisk.pdf Asterisk Book]
 
 
 
<br/>
 
 
 
{{pFoot|[[Sucknews]]|[[Main Page]]|[[Sip.conf]]}}
 

Latest revision as of 20:11, 19 January 2025

What is OwnCloud ?

OwnCloud is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.

The Owncloud install doc provided is for Ubuntu.

It is adapted below for Slackware 15.0.

Installing OwnCloud

OwnCloud is a PHP application. download tarball then untar and install.

# tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
# chown -R apache:apache owncloud
# cd /var/www/htdocs
# ln -s /usr/local/owncloud owncloud
# chown -R apache:apache owncloud

Creating the occ helper script

occ is an OwnCloud administration command.

# FILE="/usr/local/bin/occ"
# cat <<EOM >$FILE
> #! /bin/bash
> cd /usr/local/owncloud
> sudo -E -u apache /usr/bin/php /usr/local/owncloud/occ "\$@"
> EOM
# chmod u+x $FILE

Creating the OwnCloud database

OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :

# mysql -u root -e \
  "CREATE DATABASE IF NOT EXISTS owncloud; \
  CREATE USER IF NOT EXISTS 'owncloud'@'localhost' IDENTIFIED BY 'password'; \
  GRANT ALL PRIVILEGES ON *.* TO 'owncloud'@'localhost' WITH GRANT OPTION; \
  FLUSH PRIVILEGES;"
#

It is also possible to create user owncloud@localhost and database from phpmyadmin.

setting up the owncloud database

The admin user is the one who will manage the other users and OwnCloud from the OwnCloud web page.

# occ maintenance:install \
    --database "mysql" \
    --database-name "owncloud" \
    --database-user "owncloud" \
    --database-pass "password" \
    --data-dir "/var/www/htdocs/owncloud/data" \
    --admin-user "admin" \
    --admin-pass "admin"
ownCloud was successfully installed
#

Configure ownCloud’s Trusted Domains

# my_ip=$(hostname -I|cut -f1 -d ' ')
# occ config:system:set trusted_domains 1 --value="$my_ip"
System config value trusted_domains => 1 set to string x.y.z.t
# occ config:system:set trusted_domains 2 --value="$HOSTNAME"
System config value trusted_domains => 2 set to string your.domain.tld
#

Configure the cron jobs

Set your background job mode to cron:

# occ background:cron
Set mode for background jobs to 'cron'
#

Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am:

# echo "MIN HOUR DAY MONTH DAYOFWEEK COMMAND" >> /var/spool/cron/crontabs/apache
# echo "*/15  *  *  *  * /var/www/htdocs/owncloud/occ system:cron" >> /var/spool/cron/crontabs/apache
# echo "0  2  *  *  * /var/www/htdocs/owncloud/occ dav:cleanup-chunks" >> /var/spool/cron/crontabs/apache
# chgrp apache /var/spool/cron/crontabs/apache
#

Configure Log Rotation

# FILE="/etc/logrotate.d/owncloud"
# cat <<EOM >$FILE
/var/www/htdocs/owncloud/data/owncloud.log {
size 10M
rotate 12
copytruncate
missingok
compress
compresscmd /bin/gzip
}
EOM
#


Asterisk Main Page Desktop software