OwnCloud

From Wikislax
Revision as of 16:14, 19 January 2025 by Wikislax (talk | contribs) (Configure Caching and File Locking)
Jump to: navigation, search

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

# 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 ldap synchronization

Note : instructions copied from OwnCloud documentation and not used at the time of this writing

If you need to sync your users from an LDAP or Active Directory Server, add this additional Cron job. Every 4 hours this cron job will sync LDAP users in ownCloud and disable the ones who are not available for ownCloud. Additionally, you get a log file in /var/log/ldap-sync/user-sync.log for debugging.

# echo "1 */6 * * * /var/www/owncloud/occ user:sync \
 'OCA\User_LDAP\User_Proxy' -m disable -vvv >> \
 /var/log/ldap-sync/user-sync.log 2>&1" \
 | sudo -u www-data -g crontab tee -a \
 /var/spool/cron/crontabs/www-data
# mkdir -p /var/log/ldap-sync
# touch /var/log/ldap-sync/user-sync.log
# chown www-data. /var/log/ldap-sync/user-sync.log

Configure Caching and File Locking

If using these features the required modules must be installed.

# occ config:system:set memcache.local --value '\OC\Memcache\APCu'
System config value memcache.local set to string \OC\Memcache\APCu
# occ config:system:set memcache.locking --value '\OC\Memcache\Redis'
System config value memcache.locking set to string \OC\Memcache\Redis
# occ config:system:set redis --value '{"host": "127.0.0.1", "port": "6379"}' --type json
System config value redis set to json {"host": "127.0.0.1", "port": "6379"}
#

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