ArchLinux 安裝 ownCloud 7.x

關於 ownCloud 可以參考:頭城國小資訊組 | 在 CentOS 6.x 上安裝 ownCloud
參考網頁:
ownCloud – ArchWiki
How To Install and Setup ownCloud on Arch Linux | DigitalOcean
EFSTATHIOS IOSIFIDIS: Install ownCloud on Raspberry Pi (Arch Linux) using Lighttpd
EFSTATHIOS IOSIFIDIS: Install ownCloud 7 on Raspberry Pi (Arch Linux) using Lighttpd

查詢套件庫中有無 ownCloud 套件
# pacman -Ss owncloud
community/owncloud 7.0.2-1
    A cloud server to store your files centrally on a hardware controlled by you
安裝 ownCloud 套件
# pacman -S owncloud
Optional dependencies for owncloud
    php-apache: to use the Apache web server
    php-sqlite: to use the SQLite database backend
    php-pgsql: to use the PostgreSQL database backend
    php-ldap: LDAP authentication
    php-intl [installed]
    php-apcu
    php-xcache
    mariadb: to use the MySQL database backend [installed]
    smbclient: to mount SAMBA shares [installed]
    php-mcrypt [installed]
    ffmpeg: file preview
    libreoffice-common: file preview[@more@]
安裝 php-ldap / php-apcu / php-xcache 套件
# pacman -S php-ldap php-apcu php-xcache

安裝 uwsgi-plugin-php 套件
# pacman -S uwsgi-plugin-php

修改 /etc/php/php.ini 設定檔
# sed -i ‘s/;extension=zip.so/extension=zip.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=gd.so/extension=gd.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=iconv.so/extension=iconv.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=openssl.so/extension=openssl.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=xmlrpc.so/extension=xmlrpc.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=bz2.so/extension=bz2.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=curl.so/extension=curl.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=intl.so/extension=intl.so/’ /etc/php/php.ini
# sed -i ‘s/;extension=mcrypt.so/extension=mcrypt.so/’ /etc/php/php.ini

修改 nginx 設定檔
# vim /etc/nginx/ngix.conf
#this is to avoid Request Entity Too Large error
        client_max_body_size 1000M;
        # deny access to some special files
        location ~ ^/(data|config|.ht|db_structure.xml|README) {
              deny all;
        }
        # pass all .php or .php/path urls to uWSGI
        location ~ ^(.+.php)(.*)$ {
              include uwsgi_params;
              uwsgi_modifier1 14;
              uwsgi_pass 127.0.0.1:3001;
        }
        # everything else goes to the filesystem,
        # but / will be mapped to index.php and run through uwsgi
        location /owncloud {
              root /usr/share/webapps;
              index index.php;
              rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
              rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
        }

重新啟動 Nginx Web Server
# systemctl restart nginx

安裝 uwsgi
# pacman -S uwsgi

建立設定檔
# vim /etc/uwsgi/owncloud.ini

[uwsgi]
master = true
socket = 127.0.0.1:3001

# Change this to where you want ownlcoud data to be stored (maybe /home/owncloud)
owncloud_data_dir = /usr/share/webapps/owncloud/data/
chdir             = %(owncloud_data_dir)

plugins = php
php-docroot     = /usr/share/webapps/owncloud
php-index       = index.php

# only allow these php files, I don't want to inadvertently run something else
php-allowed-ext = /index.php
php-allowed-ext = /public.php
php-allowed-ext = /remote.php
php-allowed-ext = /cron.php
php-allowed-ext = /status.php
php-allowed-ext = /settings/apps.php
php-allowed-ext = /core/ajax/update.php
php-allowed-ext = /core/ajax/share.php
php-allowed-ext = /core/ajax/requesttoken.php
php-allowed-ext = /core/ajax/translations.php
php-allowed-ext = /search/ajax/search.php
php-allowed-ext = /search/templates/part.results.php
php-allowed-ext = /settings/admin.php
php-allowed-ext = /settings/users.php
php-allowed-ext = /settings/personal.php
php-allowed-ext = /settings/help.php
php-allowed-ext = /settings/ajax/getlog.php
php-allowed-ext = /settings/ajax/setlanguage.php
php-allowed-ext = /settings/ajax/setquota.php
php-allowed-ext = /settings/ajax/userlist.php
php-allowed-ext = /settings/ajax/createuser.php
php-allowed-ext = /settings/ajax/removeuser.php
php-allowed-ext = /settings/ajax/enableapp.php
php-allowed-ext = /core/ajax/appconfig.php
php-allowed-ext = /settings/ajax/setloglevel.php
php-allowed-ext = /ocs/v1.php
# set php configuration for this instance of php, no need to edit global php.ini
php-set = date.timezone=Etc/UTC
php-set = open_basedir=%(owncloud_data_dir):/tmp/:/usr/share/pear/:/usr/share/webapps/owncloud:/etc/webapps/owncloud
php-set = session.save_path=/tmp
php-set = post_max_size=1000M
php-set = upload_max_filesize=1000M

# load all extensions only in this instance of php, no need to edit global php.ini
php-set = extension=bz2.so
php-set = extension=curl.so
php-set = extension=intl.so
php-set = extension=openssl.so
php-set = extension=pdo_sqlite.so
php-set = extension=exif.so
php-set = extension=gd.so
php-set = extension=imagick.so
php-set = extension=gmp.so
php-set = extension=iconv.so
php-set = extension=mcrypt.so
php-set = extension=sockets.so
php-set = extension=sqlite3.so
php-set = extension=xmlrpc.so
php-set = extension=xsl.so
php-set = extension=zip.so

processes = 10
cheaper = 2
cron = -3 -1 -1 -1 -1 /usr/bin/php -f /usr/share/webapps/owncloud/cron.php 1>/dev/null

建立目錄
# mkdir /usr/share/webapps/owncloud/data

# uwsgi_php –ini /etc/uwsgi/owncloud.ini
[uwsgi] implicit plugin requested php
[uWSGI] getting INI configuration from /etc/uwsgi/owncloud.ini
*** Starting uWSGI 2.0.7 (32bit) on [Wed Nov  5 09:22:02 2014] ***
compiled with version: 4.8.2 20131219 (prerelease) on 02 October 2014 06:16:59
os: Linux-3.4.90 #2 SMP PREEMPT Wed Aug 27 10:31:52 CST 2014
nodename: lemaker
machine: armv7l
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /root
detected binary path: /sbin/uwsgi
uWSGI running as root, you can use –uid/–gid/–chroot options
*** WARNING: you are running uWSGI as root !!! (use the –uid flag) ***
chdir(): No such file or directory [core/uwsgi.c line 2537]