Ticket 281 ‐ Deploy and Configure ownCloud Enterprise File Sharing Platform - SupaHotBall/OE2-Group-D GitHub Wiki

Task

Database Setup

  • Create dedicated ownCloud database/user with restricted remote access
  • Verify connection from app server

Application Server Setup

  • Install PHP 7.x with required extensions
  • Configure Apache with security headers
  • Install ownCloud complete package
  • Complete web-based setup wizard

Acceptance Criteria

  • ownCloud accessible via HTTPS at http://.op-bit.nz/owncloud
  • Successful connection to remote MySQL database
  • All security measures implemented (permissions, headers)
  • Admin account created with strong credentials

Steps Taken

Log in to MySQL and create the ownCloud database:

  • Code :
sudo mysql -u root -p

{2247B212-B3D6-4B70-9BBA-25F117A6CE26}

Create a dedicated database for ownCloud to use. We will name the database owncloud for clarity. Then, create a separate MySQL user account to manage the newly created database. Creating one-function databases and accounts is a good idea from a management and security standpoint. As with the naming of the database, choose a username owncloud. To achieve this step, execute the following MySQL commands (replace values as needed):

{CB5C5825-A169-4390-B25E-3DA4F24290A6}

On the Application Server Install MySQL client (required for ownCloud setup):

{38E008A1-688D-432B-9766-D46D8BBEAF5C}

{F3DBDAC6-FD76-4667-B45F-F98C78A75599}

Test remote database connection:

{DD11977F-D954-4C33-8D97-A09139606743}

Verify connection:

{2D7831A2-1615-435A-A434-6168E2EBB8F4}

Step 2: PHP 8.1 Installation

Add PHP repository and update packages:

{9F6DB073-050F-4A51-883D-039335C9B5D8}

Install PHP 7.4 and required extensions:

  • Code:
sudo apt install php7.4 libapache2-mod-php7.4 php7.4-common \
php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-apcu \
php7.4-smbclient php7.4-ldap php7.4-redis php7.4-gd \
php7.4-xml php7.4-intl php7.4-json php7.4-imagick \
php7.4-zip php7.4-mysql php7.4-curl php7.4-bz2 php7.4-gmp

{F0392401-742F-409A-B97A-07E9550AA41E}

{8FB6E91A-03C8-4FA5-8E25-D682FF46E92B}

Set memory limit to 512M:

{855C2C65-7906-4CCF-AA2B-E3E7D2FB9C3D}

Verify PHP version:

{EBD813BF-E378-431C-86CD-D5347A21178B}

Step 3: Apache Web Server Configuration

If you don’t already have this, install Apache:

  • Code:
sudo apt install apache2

Warning !!!

Run this first:

sudo ufw allow OpenSSH

If you don’t allow OpenSSH before you do the configure firewall, you risk locking yourself out of the server (i.e., PuTTY can't connect anymore).

Configure firewall:

{CE4C2B03-F046-4A32-BB1A-B17DB31F98C0}

Enable required modules

{90D44CC2-B0D4-4E45-A749-6A2B79C5B530}

Verify Apache2 is running

{BC5E94F9-AFD8-4AA4-905C-86E35A7917F4}

Step 4: ownCloud Installation

Add ownCloud repository for Ubuntu 22.04:

{60E4D8F3-601A-4129-8DE3-1C6BD6306EF7}

Add repository key:

{727EAA91-44E3-44A0-872C-3EEBB1F880D8}

Update and install ownCloud:

{AD1E5E6F-FE72-4BAB-9740-BC1526FEC7CD}

Step 5: Apache Configuration for ownCloud

Create configuration file:

sudo nano /etc/apache2/sites-available/owncloud.conf

Add this secure configuration

<VirtualHost *:80>
    ServerName group-f.op-bit.nz
    DocumentRoot /var/www/owncloud

    <Directory /var/www/owncloud>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php
        FallbackResource /index.php

        <IfModule mod_dav.c>
            Dav off
        </IfModule>

        SetEnv HOME /var/www/owncloud
        SetEnv HTTP_HOME /var/www/owncloud
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Install required Apache modules:

sudo a2enmod ssl headers env rewrite dir mime setenvif

{B0AAF97F-9122-47F3-AF4A-B3C8DA303421}

Enable site and restart Apache:

# Disable default site sudo a2dissite 000-default.conf

# Enable owncloud config sudo a2ensite owncloud.conf

# Restart Apache sudo systemctl restart apache2

Step 6: Final ownCloud Setup

Access ownCloud in browser:

Account username is Admin and password is our server password.

And the database configuration is the same as the lab 10.1

Complete the setup wizard:

{9E187FCD-485C-4B9D-A951-576B52F166B4}

Configure trusted domains:

{86DD8E2B-F894-46A4-A966-5561C2D4B279}


Challenges

N/A


External Resources

N/A


Ticket Reference

https://rt.dataraster.com/Ticket/Display.html?id=281


⚠️ **GitHub.com Fallback** ⚠️