OS

Dragonfly BSD 4.2.x

Date

20.10.2015

ownCloud 8.x

Preface

Installation

PHP

pkg install php56-xmlwriter php56-xmlreader php56-wddx php56-xsl php56-pgsql php56-xmlrpc php56-tokenizer php56-soap php56-fileinfo php56-bz2 php56-ldap php56-sqlite3 php56-exif php56-pdo_sqlite mp3info php56-zip php56-mbstring php56-ctype php56-json php56-iconv php56-gd php56-simplexml php56-zlib php56-hash php56-openssl php56-curl php56-posix pecl-APCu php56-pdo_pgsql php56-filter sudo

/usr/local/etc/php.ini

Create php.ini an add the following lines.

cloud# cd /usr/local/etc/
cloud# cp php.ini-production  php.ini

an add the following lines.

post_max_size = 512M  
upload_max_filesize = 512M
default_charset = "utf-8"
always_populate_raw_post_data = -1
date.timezone = 'Europe/Berlin'
apc.enable_cli=1

PostgreSQL

Postgresql Client (9.3) is already installed, so wie install Postgresql 9.3 server.

cloud# pkg install postgresql93-server 

login.conf

Add the following lines to /etc/login.conf

postgres:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:

Reload config.

cloud# cap_mkdb /etc/login.conf

/etc/rc.conf

postgresql_class="postgres"
postgresql_enable="YES"

Now create initial Database and start Postrgresql.

cloud# /usr/local/etc/rc.d/postgresql initdb
cloud# /usr/local/etc/rc.d/postgresql start

Create owncloud - User & Database

Create a file

cloud# su - pgsql
$ ee oc.sql 

CREATE USER oc_user with password '12##Da-kommst-du-nie-535355663ddsscssvsv+++' ;
CREATE DATABASE owncloud TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE  owncloud OWNER TO oc_user;
GRANT ALL PRIVILEGES ON DATABASE owncloud to oc_user ;

$ psql -d template1 -f oc.sql 

Restricting Database Connection

We want Postgresql to accept connections only from localhost

/usr/local/pgsql/data/postgresql.conf

# Add settings for extensions here
listen_addresses = '127.0.0.13'
port = 5432
log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'

/usr/local/pgsql/data/pg_hba.conf

....
# IPv4 local connections:
host    all             all             127.0.0.13/32            md5
....

owncloud 8.1

cloud# mkdir /usr/local/www
cloud# chown www:www /usr/local/www/
cloud# cd /usr/local/www/
cloud# pkg install wget 
cloud# rehash 
cloud# wget https://download.owncloud.org/community/owncloud-8.1.0.tar.bz2
cloud# tar -xzf owncloud-8.1.0.tar.bz2 
cloud# chown -R root:www owncloud/
cloud# mkdir owncloud/data 
cloud# chown -R www:www owncloud/data/
cloud# chown -R www:www owncloud/apps/
cloud# chown -R www:www owncloud/config/
cloud# chown -R www:www owncloud/themes/
cloud# chown -R root:www owncloud/.htaccess 
cloud# chmod 0644 owncloud/.htaccess 

Webserver

cloud# pkg install apache24 mod_php56

/usr/local/etc/apache24/httpd.conf

ServerName localhost
# Listen to IPv6 only
Listen  [2a00:12f8:20a::affe:4]:80
Listen  [2a00:12f8:20a::affe:4]:443

# needed for  SSL
LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule rewrite_module libexec/apache24/mod_rewrite.so

<Directory "/usr/local/www/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
   Require all granted 
</Directory>


# include Virtual-Host 
Include etc/apache24/extra/httpd-vhosts.conf

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

# executing php-files (mod-php5)
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

/usr/local/etc/apache24/extra/httpd-vhosts.conf

<VirtualHost *:80>
  ServerName cloud.example.com
  ServerAdmin admin@example.com
  RedirectPermanent / https://cloud.example.com/
  TransferLog /dev/null
</VirtualHost>

<VirtualHost *:443>
    ServerName cloud.example.com
    ServerAdmin admin@example.com
    Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
    DocumentRoot /usr/local/www/owncloud/
    CustomLog /var/log/apache/oc02_ssl_access.log combined
    ErrorLog /var/log/apache/oc02_ssl_error.log
    SSLEngine On
    SSLCertificateChainFile /etc/ssl/certs/cacert_root.pem
    SSLCertificateFile /etc/ssl/certs/cloud_cert.pem 
    SSLCertificateKeyFile /etc/ssl/private/cloud_key.pem
    SSLCipherSuite EDH+AES256+AESGCM:EECDH+AES256+AESGCM:EDH+AES256+SHA256:EECDH+AES256+SHA384:EDH+AES256:EECDH+AES256:EDH+CAMELLIA256:EDH+AES128+AESGCM:EECDH+AES128+AESGCM:EDH+AES128+SHA256:EECDH+AES128+SHA256:EDH+AES128:EECDH+AES128:EDH+CAMELLIA128:!ECDSA:!aNULL:!aDSS:!eNULL:!3DES:!DES:!IDEA:!RC2:!RC4:!SEED:!MD5:!EXP:!LOW:!PSK:!SRP
    SSLCompression off
    SSLHonorCipherOrder on
    SSLProtocol All -SSLv2 -SSLv3
    <Directory /usr/local/www/owncloud/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

/etc/rc.conf

apache24_enable="YES"

start Apache

cloud# mkdir /var/log/apache
cloud# /usr/local/etc/rc.d/apache24 start

Configuration

Database Connection

user

oc_user

Pasword

12##Da-kommst-du-nie-535355663ddsscssvsv+++

Database

owncloud

Host

127.0.0.13

Activate PHP-Caching

/usr/local/www/owncloud/config/config.php

'memcache.local' => '\OC\Memcache\APCu'

Installing additional Apps

You can get additional Aps from https://apps.owncloud.com/.

Download them and copy them to /usr/local/www/owncloud/apps/

Here's an example:

cloud# cd /root/Download/ 
cloud# mv 171237-contactsplus.zip temp/
cloud# cd /root/Download/temp/
cloud# unzip 171237-contactsplus.zip
cloud# chown www:www contactsplus/
cloud# mv contactsplus /usr/local/www/owncloud/apps/
cloud# /usr/local/etc/rc.d/apache24 restart

Now log into the Webinterface as admin user an activate the contactplus App.

Upgrading

We can easily upgrade Owncloud to the latest Version by getting the latest tarball from the website. All wie have to do is.

Preparation

Get the Tarball

cloud# cd /root/temp
cloud# wget --no-check-certificate https://download.owncloud.org/community/owncloud-8.2.0.tar.bz2
cloud# tar -xzf owncloud-8.2.0.tar.bz2 
cloud# chown -R www:www owncloud

Set ownloud in Maintenance Mode

cloud# cd /usr/local/www/owncloud
cloud# sudo -u www php occ maintenance:mode --on 
cloud# /usr/local/etc/rc.d/apache24 stop 

Dump the Database

cloud# su - pgsql 
$  pg_dump owncloud > owncloud_Backup_20151020.out
$  exit

Update

Change Versions

cloud# cd /usr/local/www/
cloud# mv owncloud/ owncloud_alt 
cloud# mv /root/temp/owncloud/ /usr/local/www/owncloud 
cloud# cp owncloud_alt/config/config.php owncloud/config/config.php
cloud# chown www:www /usr/local/www/owncloud/config/config.php 
cloud# mv owncloud_alt/data/ owncloud/data

and copy existing Apps

Here we move the calender/calenderplus and contact/contactplus Apps

cloud#  cd /usr/local/www/
cloud# cp -a owncloud_alt/apps/contacts /usr/local/www/owncloud/apps/
cloud# cp -a owncloud_alt/apps/contactsplus /usr/local/www/owncloud/apps/
cloud# cp -a owncloud_alt/apps/calendar /usr/local/www/owncloud/apps/
cloud# cp -a owncloud_alt/apps/contactsplus /usr/local/www/owncloud/apps/

Initialize Upgrade

cloud#  cd /usr/local/www/owncloud
cloud# sudo -u www php occ upgrade

Now you should se something like

ownCloud or one of the apps require upgrade - only a limited number of commands are available
Turned on maintenance mode
Checked database schema update
Checked database schema update for apps
Updated database
Disabled 3rd-party app: bookmarks
Disabled 3rd-party app: calendar
Disabled 3rd-party app: calendarplus
Disabled 3rd-party app: contacts
Disabled 3rd-party app: contactsplus
Disabled 3rd-party app: tasks
Updating <files> ...
Updated <files> to 1.1.10
Updating <activity> ...
Updated <activity> to 2.0.2
Update 3rd-party app: bookmarks
Update 3rd-party app: calendarplus
Update 3rd-party app: contactsplus
Update 3rd-party app: tasks
Update successful

Create new Log-File

Create a new log-File so can see if onwcloud is still requiring additional packages.

cloud# cd /usr/local/www/owncloud/data/
cloud# mv owncloud.log owncloud.log.alt
cloud# touch owncloud.log
cloud# chown www:www owncloud.log

Last but not least

cloud# cd /usr/local/www/owncloud
cloud# sudo -u www php occ maintenance:mode --off
cloud# /usr/local/etc/rc.d/apache24 start

Configuration

Activate Apps

Log into the onwcloud Webinterface as user admin and activate all Apps.

Dragonfly BSD/Web application/ownCloud (last edited 2015-10-23 12:40:49 by jackhammer)