Difference between pages "DVDless install" and "OwnCloud"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Configuring NFS)
 
(Configure Caching and File Locking)
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
The (local) network is an additional choice to install Slackware from when your hardware has this capability. Installing from the local network is particularly fast and is a good choice when playing around with the installation. This page explains how to configure a Slackware server for this usage. It was inspired by the [http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:pxe AlienBob's blog page] on the same topic. To install Slackware over the network we need :
+
== What is OwnCloud ? ==
  
* A service to download the Slackware files during the Slackware setup. HTTP, FTP, or NFS can be used. In the example below we show how to use the NFS and FTP services included with Slackware.
+
[http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.
* A service implementing the TFTP protocol. TFTP is used to effectively download the bootstrap code from the server identified. We will use the TFTP protocol included with Slackware.
 
  
* A service implementing the BOOTP protocol. BOOTP is used by the PXE firmware to identify on the network a server to download the bootloader code from. The DHCP server included with the Slackware distribution has this capability.
+
The [https://doc.owncloud.com/server/10.15/admin_manual/installation/quick_guides/ubuntu_20_04.html/ Owncloud install doc] provided is for Ubuntu.
  
== Configuring NFS ==
+
It is adapted below for Slackware 15.0.
  
NFS is SUN's Network File System. It is fast and can be used as a mount point, but depending on configuration may be unsecure and must be used locally only. Also, it uses some random port numbers that need to be fixed if firewalling. The directories used are defined in '''/etc/exports'''. Copy the content of the slackware DVD slackware64 subdirectory to a directory, for instance '''/var/pub/slackware64-14.2''', then edit /etc/exports as below. '''ro''' means read-only, '''sync''' makes sure that no asynchronous requests are made, '''insecure''' affords using different NFS ports from other NFS implementations, '''all_squash''' maps all uids and gids to the anonymous user for public access, '''no_subtree_check''' improves reliability in some circumstances. See '''man exports''' for more details.
+
== Installing OwnCloud ==
  
# mkdir /mnt/dvd
+
OwnCloud is a PHP application. [https://owncloud.com/download-server download] tarball then untar and install.
# mkdir /var/pub/slackware64-15.0
 
# mount -o loop slackware64-15.0-install-dvd.iso /mnt/dvd
 
# cp -a /mnt/dvd/slackware64/* /var/pub/slackware64-15.0/
 
  
  # See exports(5) for a description.
+
  # tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
  # This file contains a list of all directories exported to other computers.
+
  # chown -R apache:apache owncloud
  # It is used by rpc.nfsd and rpc.mountd.
+
  # cd /var/www/htdocs
+
  # ln -s /usr/local/owncloud owncloud
  /var/pub      192.168.0.1/24(ro,sync,insecure,all_squash,no_subtree_check)
+
# chown -R apache:apache owncloud
  
The NFS server is launched using '''/etc/rc.d/rc.nfsd'''. Make this script executable so as to use it on every boot. You can also '''start''' it to test it immediately. The NFS client is launched using '''/etc/rc.d/rc.rpc''' and affords using NFS mount points from other NFS servers. Make this script executable if you want to use it and have it started on every reboot. This can be handy to cross-test NFS machines. Otherwise it should not be necessary.
+
== Creating the occ helper script ==
  
# chmod u+x /etc/rc.d/rc.nfsd
+
occ is an OwnCloud administration command.
# chmod u+x /etc/rc.d/rc.rpc
 
  
== Configuring FTP ==
+
# 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
  
As SSH affords encrypted authentication and transfers, FTP will be used on our site only for anonymous public downloads. FTP uses fixed port numbers so it is easy to firewall, but it is much slower than NFS. Slackware includes two FTPs : ProFTPd and vsFTP. We will use the latter. Using vsFTP requires very little configuration : setting the home directory of the ftp user to where we want our files to be downloaded from, uncommenting the correct '''ftp''' line in '''/etc/inetd.conf''' and '''/etc/rc.d/rc.inetd restart''', updating the firewall rules. For more details '''man vsftpd.conf'''.
+
== Creating the OwnCloud database ==
 
# usermod --home /var/pub ftp
 
. . .
 
# Very Secure File Transfer Protocol (FTP) server.
 
ftp    stream  tcp    nowait  root    /usr/sbin/tcpd  vsftpd
 
. . .
 
# /etc/rc.d/rc.inetd restart
 
. . .
 
# services on local network FTP BOOTP HTTP NNTP IMAP HTTPS SUBMIT VNC VOIP
 
iptables -A INPUT -p tcp -j ACCEPT --dport 20 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 21 -m state --state NEW -s 192.168.0.0/24
 
  
== Configuring TFTPBOOT ==
+
OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :
  
TFTP is the trivial ftp protocol (for use on a local network). Let's create the '''tftp bootp''' file structure under the default '''/tftpboot''' directory. The directory where we store the bootloader files is '''/tftpboot/slackware64-15.0''' :
+
# 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;"
 +
#
  
# mkdir /tftpboot
+
It is also possible to create user owncloud@localhost and database from phpmyadmin.
# mkdir /tftpboot/slackware64-15.0
 
# mkdir /tftpboot/slackware64-15.0/pxelinux.cfg
 
# mount -o loop slackware64-15.0-install-dvd.iso /mnt/dvd
 
# cp /usr/share/syslinux/pxelinux.0 /tftpboot/slackware64-15.0/
 
# cp /mnt/dvd/isolinux/message.txt /tftpboot/slackware64-15.0/
 
# cp /mnt/dvd/isolinux/f2.txt /tftpboot/slackware64-15.0/
 
# cp -a /mnt/dvd/kernels /tftpboot/slackware64-15.0/
 
# cp /mnt/dvd/usb-and-pxe-installers/pxelinux.cfg_default /tftpboot/slackware64-15.0/pxelinux.cfg/default
 
# cp /mnt/dvd/isolinux/initrd.img /tftpboot/slackware64-15.0/
 
# umount /mnt/dvd
 
  
Tftpboot is handled by '''inetd'''. To activate it, uncomment the tftp line in '''/etc/inetd.conf''' then '''/etc/rc.d/rc.inetd restart''' or reboot.
+
== setting up the owncloud database ==
  
  tftp  dgram  udp    wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize
+
  # occ maintenance:install \
 
+
    --database "mysql" \
== Configuring DHCP ==
+
    --database-name "owncloud" \
 
+
    --database-user "owncloud" \
We configure '''/etc/dhcpd.conf''' as follows. Our subnet is '''192.168.0.0''', our network mask '''255.255.255.0''', our IP address is '''192.168.0.1''', our router address '''192.168.0.254'''. The IP DHCP range is '''192.168.0.3''' to '''192.168.0.253'''. For more details on other configuration possbilities, '''man dhcpd.conf'''.
+
    --database-pass "password" \
 
+
    --data-dir "/var/www/htdocs/owncloud/data" \
  # dhcpd.conf
+
    --admin-user "admin" \
 +
    --admin-pass "admin"
 +
  ownCloud was successfully installed
 
  #
 
  #
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
 
 
# If this DHCP server is the official DHCP server for the local
 
# network, the authoritative directive should be uncommented.
 
authoritative;
 
ddns-update-style none;
 
 
# Allow bootp requests
 
allow bootp;
 
 
# Point to the TFTP server:
 
next-server 192.168.0.1;
 
 
# Default lease is 1 week (604800 sec.)
 
default-lease-time 604800;
 
# Max lease is 4 weeks (2419200 sec.)
 
max-lease-time 2419200;
 
 
subnet 192.168.0.0 netmask 255.255.255.0 {
 
    option domain-name "studioware.com";
 
    option broadcast-address 192.168.0.255;
 
    option subnet-mask 255.255.255.0;
 
    option domain-name-servers 192.168.0.1;
 
    option routers 192.168.0.254;
 
    range dynamic-bootp 192.168.0.3 192.168.0.253;
 
    use-host-decl-names on;
 
    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
 
      filename "/slackware64-14.2/pxelinux.0";
 
    }
 
}
 
  
Next is to create a script '''/etc/rc.d/rc.dhcpd''' to launch dhcp. Our bridged interface is '''br0''' :
+
== Configure ownCloud’s Trusted Domains ==
  
  #!/bin/sh
+
  # 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
 
  #
 
  #
# /etc/rc.d/rc.dhcpd
 
#      This shell script takes care of starting and stopping
 
#      the ISC DHCPD service
 
#
 
 
# Put the command line options here that you want to pass to dhcpd:
 
DHCPD_OPTIONS="-q '''br0'''"
 
 
[ -x /usr/sbin/dhcpd ] || exit 0
 
 
[ -f /etc/dhcpd.conf ] || exit 0
 
 
start() {
 
      # Start daemons.
 
      echo -n "Starting dhcpd:  /usr/sbin/dhcpd $DHCPD_OPTIONS "
 
      /usr/sbin/dhcpd $DHCPD_OPTIONS
 
      echo
 
}
 
stop() {
 
      # Stop daemons.
 
      echo -n "Shutting down dhcpd: "
 
      killall -TERM dhcpd
 
      echo
 
}
 
status() {
 
  PIDS=$(pidof dhcpd)
 
  if [ "$PIDS" == "" ]; then
 
    echo "dhcpd is not running!"
 
  else
 
    echo "dhcpd is running at pid(s) ${PIDS}."
 
  fi
 
}
 
restart() {
 
      stop
 
      start
 
}
 
 
# See how we were called.
 
case "$1" in
 
  start)
 
        start
 
        ;;
 
  stop)
 
        stop
 
        ;;
 
  restart)
 
        stop
 
        start
 
        ;;
 
  status)
 
        status
 
        ;;
 
  *)
 
        echo "Usage: $0 {start|stop|status|restart}"
 
        ;;
 
esac
 
 
exit 0
 
  
Next is to make '''/etc/rc.d/rc.dhcpd''' executable, launch it from '''/etc/rc.d/rc.local''' and stop it from '''/etc/rc.d/rc.local_shutdown''' :
+
== Configure the cron jobs ==
  
# chmod u+x rc.dhcpd
+
Set your background job mode to cron:
. . .
 
# start dhcpd
 
if [ -x /etc/rc.d/rc.dhcpd ]; then
 
        /etc/rc.d/rc.dhcpd start
 
fi
 
. . .
 
# stop dhcpd
 
if [ -x /etc/rc.d/rc.dhcpd ]; then
 
    /etc/rc.d/rc.dhcpd stop
 
fi
 
  
== Firewalling NFS ==
+
# occ background:cron
 +
Set mode for background jobs to 'cron'
 +
#
  
Refer to [[IPTables]] for an introduction on packet filtering. NFS uses some random ports by defaults, that we need to fix if we want to be able to do proper packet filtering. To be precise, NFS uses sunrpc/111 and nfsd/2049, and random port numbers are used by other NFS daemons but it is possible to specify alternative port numbers on the command line or in the '''/etc/services''' file, to which we add :
+
== Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am: ==
  
rpc.nfs-cb      32764/tcp # RPC nfs callback
+
  # echo "MIN HOUR DAY MONTH DAYOFWEEK COMMAND" \
rpc.nfs-cb      32764/udp # RPC nfs callback
+
  >> /var/spool/cron/crontabs/apache
status          32765/udp # NFS status (listen)
+
  # echo "*/15 * * * * /var/www/htdocs/owncloud/occ system:cron" \
  status          32765/tcp # NFS status (listen)
+
  >> /var/spool/cron/crontabs/apache
  status          32766/udp  # NFS status (send)
+
  # echo "0  2 * * * /var/www/htdocs/owncloud/occ dav:cleanup-chunks" \
status          32766/tcp # NFS status (send)
+
  >> /var/spool/cron/crontabs/apache
  mountd          32767/udp # NFS mountd
+
  # chgrp apache /var/spool/cron/crontabs/apache
  mountd          32767/tcp  # NFS mountd
+
  #
lockd          32768/udp # NFS lock daemon/manager
 
lockd          32768/tcp  # NFS lock daemon/manager
 
rquotad        32769/udp  # NFS rquotad
 
rquotad        32769/tcp # NFS rquotad
 
  
The '''/etc/rc.d/rc.nfsd''' and '''/etc/rc.d/rc.rpc''' scripts are modified to specify port numbers on the command lines :
+
== Configure ldap synchronization ==
  
if [ -x /usr/sbin/rpc.rquotad ]; then
+
Note : instructions copied from OwnCloud documentation and not used at the time of this writing
  echo "  /usr/sbin/rpc.rquotad '''-p 32769'''"
 
  /usr/sbin/rpc.rquotad '''-p 32769'''
 
fi
 
 
if [ -x /usr/sbin/rpc.mountd ]; then
 
  echo "  /usr/sbin/rpc.mountd '''-p 32767'''"
 
  /usr/sbin/rpc.mountd '''-p 32767'''
 
fi
 
 
if ! ps axc | grep -q rpc.statd ; then
 
  echo "Starting RPC NSM (Network Status Monitor): /sbin/rpc.statd '''-p 32765 -o 32766'''"
 
  /sbin/rpc.statd '''-p 32765 -o 32766'''
 
fi
 
  
To make the lock daemon listen on port '''32768''' only and set the nfs callback port to '''32764''' we need to create file '''/etc/sysctl.d/nfs.conf''' :
+
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.
  
  fs.nfs.nlm_udpport=32768
+
  # echo "1 */6 * * * /var/www/owncloud/occ user:sync \
  fs.nfs.nlm_tcpport=32768
+
  'OCA\User_LDAP\User_Proxy' -m disable -vvv >> \
  fs.nfs.nfs_callback_tcpport=32764
+
  /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
  
Last BOOTP and the NFS ports must be added to '''/etc/rc.d/rc.firewall''' :
+
== Configure Caching and File Locking ==
  
# by default no local traffic is allowed for network 192.168.0.0/24 on br0 interface
+
If using these features the required modules must be installed.
# iptables -A INPUT -i br0 -s 192.168.0.0/24 -d 192.168.0.0/24 -j ACCEPT
 
# iptables -A OUTPUT -o br0 -s 192.168.0.0/24 -d 192.168.0.0/24 -j ACCEPT
 
 
# BOOTP
 
iptables -A INPUT -p udp -j ACCEPT --dport 69 -s 192.168.0.0/24
 
 
# NFS ports
 
iptables -A INPUT -p udp -j ACCEPT --dport 111 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 111 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 2049 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 2049 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32764 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32764 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32765 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32765 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32766 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32766 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32767 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32767 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32768 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32768 -m state --state NEW -s 192.168.0.0/24
 
iptables -A INPUT -p udp -j ACCEPT --dport 32769 -s 192.168.0.0/24
 
iptables -A INPUT -p tcp -j ACCEPT --dport 32769 -m state --state NEW -s 192.168.0.0/24
 
  
== Slackware setup ==
+
# 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"}
 +
#
  
A few pieces of advice to make your Slackware setup from network easier :
+
== Configure Log Rotation ==
  
* For some reason Slackare might use an interface other than eth0. Just move the cable to the right slot or update (or remove) /etc/udev/rules.d/70-persistent-net.rules.
+
# FILE="/etc/logrotate.d/owncloud"
 
+
# cat <<EOM >$FILE
* Slackware network setup uses NFS version 3 meaning that directory paths are absolute.
+
/var/www/htdocs/owncloud/data/owncloud.log {
 
+
size 10M
* The FTP directory paths are instead relative to the ftp user home directory.
+
rotate 12
 +
copytruncate
 +
missingok
 +
compress
 +
compresscmd /bin/gzip
 +
}
 +
EOM
 +
#
  
<br/>
+
<br clear=all>
  
{{pFoot|[[Managing partitions]]|[[Main Page]]|[[Installing Slackware]]}}
+
{{pFoot|[[Asterisk]]|[[Main Page]]|[[Desktop software]]}}

Revision as of 16:14, 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

# 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