# ownCloud Setup

In this chapter, we’ll walk through setting up **ownCloud** on your EC2 instance. ownCloud is an open-source file-sharing server that allows you to store and manage files through a browser or WebDAV.

By the end of this setup, ownCloud will be running on your EC2 instance and ready to connect with your backend Lambda APIs for deduplication.

<figure><img src="https://hostbillapp.com/appstore/hosting_owncloud/images/thumbnails/m_logo.png" alt="" width="375"><figcaption></figcaption></figure>

### Step 1: Download ownCloud

Once inside your EC2 terminal:

```
wget https://download.owncloud.com/server/stable/owncloud-complete-latest.zip
```

> This downloads the latest version of ownCloud as a ZIP archive.

***

### Step 2: Install unzip

If unzip isn’t installed:

```
sudo apt install unzip
```

Then extract ownCloud:

```
unzip owncloud-complete-latest.zip
sudo mv owncloud /var/www/html/
```

***

### Step 3: Set Permissions

Ensure Apache has access to the ownCloud directory:

```
sudo chown -R www-data:www-data /var/www/html/owncloud
sudo chmod -R 755 /var/www/html/owncloud
```

***

### Step 4: Set Up MySQL for ownCloud

1. Log into MySQL:

```
sudo mysql
```

2. Create a database and user:

```
CREATE DATABASE owncloud_db;
CREATE USER 'owncloud_user'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON owncloud_db.* TO 'owncloud_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```

{% hint style="info" %}
You’ll use these credentials in the web interface setup.
{% endhint %}

***

### Step 5: Launch ownCloud in Browser

Open your EC2 **public IP** in a browser:

```
http://<your-ec2-public-ip>
```

{% hint style="info" %}
You’ll see the ownCloud **installation screen**.
{% endhint %}

***

### Step 6: Complete Web Installer

Fill the following:

* **Username**: Choose your admin user
* **Password**: Set a secure one
* **Data Folder**: `/var/www/html/owncloud/data`

#### Database Configuration:

* **Database**: MySQL/MariaDB
* **Database user**: `owncloud_user`
* **Password**: `strongpassword`
* **Database name**: `owncloud_db`
* **Host**: `localhost`
* Click **Finish Setup**.

***

### Step 7: ownCloud is Ready

Once installation completes, you’ll be redirected to the **ownCloud dashboard.**

You can now:

* **Upload** test files manually
* Connect the **backend API** to intercept uploads
* Begin testing **deduplication** with Lambda and S3
