Difference between pages "Creating VMs" and "OwnCloud"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Creating a PV VM)
 
(Configure Caching and File Locking)
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== the xl tool ==
+
== What is OwnCloud ? ==
  
There is a variety of tools and commands to handle virtual machines. Here we will use the Xen '''xl''' command.
+
[http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.
  
* '''xl create ''file''''' affords creating a virtual machine based on the configuration in file ''file''. A one-starting sequential domain id is created.
+
The [https://doc.owncloud.com/server/10.15/admin_manual/installation/quick_guides/ubuntu_20_04.html/ Owncloud install doc] provided is for Ubuntu.
  
* '''xl destroy ''domid''''' affords destroying a virtual machine with domain id ''domid''. Of course using the system in the VM will be a preferred method to terminate.
+
It is adapted below for Slackware 15.0.
  
* '''xl help''' affords getting more information on other xm commands.
+
== Installing OwnCloud ==
  
Xen supports paravirtualisation and hardware virtualization. Both can be used at the same time on a single Xen system.
+
OwnCloud is a PHP application. [https://owncloud.com/download-server download] tarball then untar and install.
  
== Creating a PV VM ==
+
# 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
  
* in paravirtualization (PV) guest operating systems are modified so they are able to interlock with Xen without emulation or virtual emulated hardware. Xen PV guest kernels exist for Linux, NetBSD, FreeBSD, OpenSolaris and Novell Netware. Upstream kernel.org Linux kernels since Linux 2.6.24 include Xen PV guest (domU) support based on the Linux pvops framework, so every upstream Linux kernel can be automatically used as Xen PV guest kernel without any additional patches or modifications.
+
== Creating the occ helper script ==
  
Paravirtualization requires storing the kernel to boot in the dom0 filesystem, and populating the system in a virtual partition. The kernel generated must be able to manage [http://wiki.qemu.org/download/qemu-doc.html#QEMU-PC-System-emulator the QEMU devices] and include the .config file [http://wiki.xen.org/wiki/Mainline_Linux_Kernel_Configs#Configuring_the_kernel domU options]. Here is a minimal example of such a [{{SERVER}}/wikislax/download/config-domU .config domU] file. The swap partition and VM filesystem can be created as below. Don't forget to update the root device in fstab :
+
occ is an OwnCloud administration command.
  
  # dd if=/dev/zero of=sl12.swp bs=1024k count=1024
+
  # FILE="/usr/local/bin/occ"
  # mkswap sl12.swp
+
  # cat <<EOM >$FILE
  # dd if=/dev/zero of=sl12.img bs=1024k count=8192
+
  > #! /bin/bash
  # mkfs -t ext3 sl12.img
+
  > cd /usr/local/owncloud
  # mkdir loop
+
  > sudo -E -u apache /usr/bin/php /usr/local/owncloud/occ "\$@"
# mount -o loop sl12.img loop
+
  > EOM
# cp -ax /mnt/sl12/{0,bin,boot,etc,home,initrd*,lib,lib32,lib64,media,mnt,opt,root,run,sbin,srv,sys,usr,var,vmlinuz*} loop
+
  # chmod u+x $FILE
# mkdir loop/{dev,proc,tmp}
 
# chmod 777 loop/tmp
 
# vi loop/etc/fstab
 
  # umount loop
 
# dd if=/dev/zero bs=1G count=8 >> sl12.img
 
  # fsck -f sl12.img
 
# resize2fs sl12.img
 
  
Then a PV config file needs to be created. Samples are available from the /etc/xen directory. Here is an [{{SERVER}}/wikislax/download/sl12 example] running in a X window for slackware 12.1 (32 bits). The main config options to modify are :
+
== Creating the OwnCloud database ==
  
# Kernel image file in dom0 filesystem
+
OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :
kernel = "/boot/vmlinuz-3.4.2-domU"
 
# Not using any optional ramdisk
 
#ramdisk = "/boot/initrd.gz"
 
# Initial memory allocation (in megabytes) for the new domain.
 
memory = 2048
 
# A name for the new domain. All domains have to have different names,
 
name = "sl12"
 
# Number of virtual CPUs
 
vcpus = 2
 
# Define network interfaces
 
vif = [ ' ' ]
 
# Define disk devices. Note the device names xvda and xvdb
 
disk = [ 'file:/mnt/xen/sl12.img,xvda1,w', 'file:/mnt/xen/sl12.swap,xvdb,w' ]
 
# Define frame buffer device. Use sdl to view virtual machine in a window
 
vfb = [ 'sdl=1' ]
 
# Set root device.
 
root = "/dev/xvda1 ro"
 
# Window resolution additional parameters
 
extra = "xen-fbfront.video=16,1680,1024"
 
  
The VM can then be launched with '''xl create ''file''''' :
+
# 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;"
 +
#
  
root@inner:/etc/xen# xl create sl12
+
It is also possible to create user owncloud@localhost and database from phpmyadmin.
Parsing config from sl12
 
root@inner:/etc/xen#
 
  
== Creating a HVM ==
+
== setting up the owncloud database ==
  
* in full hardware virtualization (HVM) guests require CPU virtualization extensions from the host CPU (Intel VT-x, AMD-V). Xen uses a modified version of Qemu to emulate full PC hardware, including BIOS, IDE disk controller, VGA graphic adapter, USB controller, network adapter etc for HVM guests. CPU virtualization extensions are used to boost performance of the emulation. Fully virtualized guests do not require kernel support, so for example Windows operating systems can be used as Xen HVM guest. Fully virtualized guests are usually slower than paravirtualized guests, because of the required emulation.
+
The admin user is the one who will manage the other users and OwnCloud from the OwnCloud web page.
  
Full hardware virtualization requires only a disk image to execute in. Then a HV config file needs to be created. Samples are available from the /etc/xen directory. Here is an [{{SERVER}}/wikislax/download/win7 example] running in a X window for Windows 7. The main config options to modify are :
+
# 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
 +
#
  
# Initial memory allocation (in megabytes) for the new domain.
+
== Configure ownCloud’s Trusted Domains ==
memory = 2048
 
# A name for the new domain. All domains have to have different names,
 
name = "win7"
 
# Number of virtual CPUs
 
vcpus = 4
 
# Define network interfaces
 
vif = [ 'type=ioemu, bridge=br0' ]
 
# Define disk devices. Note the device names xvda and xvdb
 
disk = [ 'file:/mnt/xen/win7.img,hda,w', 'file:/mnt/xen/win7.iso,hdc:cdrom,r' ]
 
# enable SDL library for graphics, default = 0
 
sdl=1
 
# enable VNC library for graphics, default = 1
 
vnc=0
 
# set VNC display number, default = domid
 
vncdisplay=7
 
  
The VM can then be launched with '''xl create ''file''''' :
+
# 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
 +
#
  
root@inner:/etc/xen# xl create win7
+
== Configure the cron jobs ==
Parsing config from win7
 
root@inner:/etc/xen#
 
  
== A little screen shot ==
+
Set your background job mode to cron:
  
The 3 VMs displayed on this slackware 13.37 dom0 are slackware 12.1, windows 7 and windows 8.
+
# occ background:cron
 +
Set mode for background jobs to 'cron'
 +
#
  
[[file:Screenshot.png]]
+
== Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am: ==
  
<br/>
+
# 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
 +
#
  
{{pFoot|[[Using Grub2]]|[[Main Page]]|[[OpenSSL]]}}
+
== 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.
 +
 
 +
As their installation seems a bit complex, we decided not to use them for now.
 +
 
 +
# 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
 +
#
 +
 
 +
<br clear=all>
 +
 
 +
{{pFoot|[[Asterisk]]|[[Main Page]]|[[Desktop software]]}}

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

As their installation seems a bit complex, we decided not to use them for now.

# 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