Owncloud notes

Start with system updates

yum update

Some prerequisites

yum install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
yum install php-zip install php-intl php-process httpd
dnf install dnf-utils
dnf module reset php
dnf module install php:remi-7.4
sudo dnf update

Apache HTTPd stuff

nano /etc/httpd/conf/httpd.conf

Typical httpd.conf:

ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin username@yourdomain.com
ServerName server.yourdomain.com:80
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
DocumentRoot "/var/www/www.yourdomain.com/html"
<Directory "/var/www">
  AllowOverride None
  Require all denied
  Options Indexes FollowSymLinks
</Directory>
<IfModule dir_module>
  DirectoryIndex index.php index.html
</IfModule>
<Files ".ht*">
  Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule mime_module>
  TypesConfig /etc/mime.types
  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
  AddType text/html .shtml
  AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
  MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
ErrorDocument 404 "404 - Uh oh! File not found."
################################################################################
# www.yourdomain.com
################################################################################
<VirtualHost *:80>
  ServerName www.yourdomain.com
  ServerAlias yourdomain.com
  Redirect permanent / https://www.yourdomain.com/
  DocumentRoot /var/www/www.yourdomain.com/html
  ServerAdmin username@yourdomain.com
  <Directory "/var/www/www.yourdomain.com/html">
    AllowOverride All
    Require all granted
  </Directory>
  ErrorLog /var/www/www.yourdomain.com/log/error_log
</VirtualHost>
<VirtualHost *:443>
  DocumentRoot /var/www/www.yourdomain.com/html
  ServerName www.yourdomain.com
  ServerAlias yourdomain.com
  ServerAdmin username@yourdomain.com
  <Directory "/var/www/www.yourdomain.com/html">
    AllowOverride All
    Require all granted
  </Directory>
  ErrorLog /var/www/www.yourdomain.com/log/error_log
  <IfModule mod_ssl.c>
    SSLEngine on
    SSLProtocol All -SSLv2 -SSLv3
    SSLCertificateFile    /var/www/www.yourdomain.com/ssl/www.yourdomain.com.cert.pem
    SSLCertificateKeyFile /var/www/www.yourdomain.com/ssl/www.yourdomain.com.key.pem
    SSLCACertificateFile  /var/www/www.yourdomain.com/ssl/www.yourdomain.com.bundle
  </IfModule>
</VirtualHost>

Start web server

systemctl enable httpd
systemctl start httpd
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https

Setup a database

yum install mariadb-server mariadb
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
mysql -uroot -p
create database dbname;
CREATE USER 'dbyser'@'localhost' IDENTIFIED BY 'somepassword';
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost';
flush privileges;
exit

get the owncloud files

wget https://download.owncloud.org/community/owncloud-complete-20210721.tar.bz2
tar xf owncloud-complete-20210721.tar.bz2
mv owncloud newdirname
chown -R apache.apache ../mojo
cd newdirname/

Run occ

sudo -u apache php ./occ maintenance:install --database mysql --database-name dbname --database-user dbuser --database-pass somepassword --admin-user owncloudusername --admin-pass owncloudpassword

Map data drive if current partition is not a sufficient size

I need to do this to deal with some space issues, but it’s probably not a typical step.

mkdir /owncloud-drive/data
cp -fr data/* /owncloud-drive/data/
cp -fr data/.* /owncloud-drive/data/
ln -s /owncloud-drive/data data
chown -R apache.apache /owncloud-drive data

Add domain to config.php

config.php:

array (
    0 => 'localhost',
    1 => 'www.yourdomain.com',
    2 => 'yourdomain.com',
  ),
...
'overwrite.cli.url' => 'https://www.yourdomain.com/newdirname',
...

At this point, you should be able to open https://www.yourdomain.com/newdirname in a web browser.

Leave a Comment