Update 03/10/16

Instructions added to the Arch Wiki.

Disclaimer

I have not found a specific guide to install NextCloud 10 on Arch Linux, so here is my own howto.

This howto was created by combining some information found on the:

  • NextCloud Website
  • ArchLinux Wiki

I will post the links at the bottom of the page.

Please feel free to comment and to help me improve this howto. Thanks!

Required Packages

  • Install: apache php php-apache mariadb nextcloud
  • Install the required PHP modules: php-gd php-intl php-mcrypt
  • Install the APCU PHP module for memory caching: php-apcu
  • Install the optional packages for file preview generation: php-imagick ffmepg libreoffice

PHP Configuration

  • edit /etc/php/php.ini and uncomment the following required modules:
gd.so
iconv.so
xmlrpc.so
zip.so
  • also uncomment the following required modules for mariadb:
extension=pdo_mysql.so
uncomment the recommended php modules:
bz2.so
curl.so
intl.so
mcrypt.so
  • Add the following to open_basedir:

/usr/share/webapps/nextcloud:/dev/urandom

Setup mariadb and nextcloud DB:

  • Configure mariadb:
    #mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

  • Enable and start mariadb service:
    #systemctl enable mariadb.service && systemctl start mariadb.service

  • Secure mariadb:
    #mysql_secure_installation

  • Create nextcloud DB:
    $mysql -u root -p

At the prompt, insert the following lines (make sure to enter them separately).

N.B.: Change 'username' and 'password' to your specific ones and note them down as you will need them later

>CREATE DATABASE IF NOT EXISTS nextcloud;
>CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
>GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';
>quit

Setup Apache

  • Copy Nextcloud's Apache configuration file to Apache configuration directory:

#cp /etc/webapps/nextcloud/apache.example.conf /etc/httpd/conf/extra/nextcloud.conf

  • edit /etc/httpd/conf/httpd.conf and:

comment the line:#LoadModule mpm_event_module modules/mod_mpm_event.so

  • uncomment the line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

  • After LoadModule dir_module modules/mod_dir.so, place the following module:

LoadModule php7_module modules/libphp7.so

  • At the end of the Include list place the following line:

Include conf/extra/php7_module.conf

  • At the end of the LoadModule list add the following line:

AddHandler php7-script php

  • At the bottom of /etc/httpd/conf/httpd.conf add the following line:

Include conf/extra/nextcloud.conf

  • Enable the following modules:
mod_rewrite
headers
env
dir
mime
  • Enable and restart apache:

#systemctl enable httpd && systemctl start httpd

Enable memcaching

  • Enable memcaching by uncommenting the following line in /etc/php/conf.d/apcu.ini:

extension=apcu.so

  • Log onto Nextcloud and set it upIn your browser go to: http://localhost/nextcloud and follow the on screen instructions to setup nextcloud (remember to use the DB username/password you set up above)

  • After nextcloud is set up (see above), add the following line to /usr/share/webapps/nextcloud/config/config.php:

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

Enable SSL with a self signed certificate plus hardening (Optional)

  • Edit /etc/httpd/conf/httpd.conf and uncomment the following lines:
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf
  • Still while in /etc/httpd/conf/httpd.conf add port 443 to your Listen ports

  • Create the certificate

# cd /etc/httpd/conf
# openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 1095
# chmod 400 server.key
  • Edit /etc/httpd/conf/extra/httpd-ssl.conf and under the VirtualHost:443 section add the following section:
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
</IfModule>
  • Restart apache:

#systemctl restart httpd

Enjoy Nextcloud!