Not Deadpool and Wolverine

Installing a Secure Enterprise File Store

By Deadpool, narrated by Wolverine


Alright bub, listen up. We’re gonna set up a secure enterprise file store, and we’re not gonna mess around. Grab your claws, ’cause this is gonna get intense. Here’s how to get it done:

Step 1: Choose Your Software

First, you need the right tools. We’re going with Nextcloud, an open-source software that’s tougher than adamantium.

Install Nextcloud on Ubuntu:

sudo apt update
sudo apt install apache2 mariadb-server libapache2-mod-php7.4
sudo apt install php7.4-{cli,xml,zip,curl,gd,mbstring,mysql,intl,bcmath,gmp}

Deadpool: “Hey, just popping in here. Yes, you’re actually installing software. Don’t worry, it’s not as hard as Logan’s head.”

Step 2: Set Up Your Database

Next, we need a place to store our stuff. MariaDB’s our guy.

Secure and Set Up MariaDB:

sudo mysql_secure_installation

When it asks you for the root password, set it and keep it safe, bub. Answer ‘Y’ to all prompts to secure the installation.

Create a Database for Nextcloud:

sudo mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Deadpool: “Look at you, creating databases like a pro. If you mess up, don’t worry—Wolverine’s healing factor won’t fix this, but Google might.”

Step 3: Download and Configure Nextcloud

We’re getting close now. Time to download and set up Nextcloud.

Download Nextcloud:

cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/nextcloud-21.0.1.zip
sudo unzip nextcloud-21.0.1.zip
sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/

Deadpool: “Downloading stuff from the internet. Just make sure you’re not on dial-up. Does that even exist anymore? Probably in some alternate universe.”

Step 4: Configure Apache

Apache’s our web server. Time to teach it some respect.

Set Up Apache Configuration:

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

Add this inside the file:

<VirtualHost *:80>
    DocumentRoot /var/www/nextcloud/
    ServerName yourdomain.com

    <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All

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

        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud

    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined

</VirtualHost>

Enable the site and rewrite module:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Deadpool: “Configuration files, the unsung heroes of tech. Mess it up, and you might summon an apocalypse. No pressure.”

Step 5: Finalize the Installation

Almost there. Time to finish the job.

Complete Installation via Web Interface:

  • Open your web browser and go to http://yourdomain.com
  • Follow the setup instructions, entering the database details you set up earlier.
  • Create an admin account and log in.

Deadpool: “If you see a ‘404 Not Found’ error, don’t panic. It happens to the best of us. Just retrace your steps and maybe sacrifice a USB stick to the tech gods.”

Step 6: Secure Your Installation

We’re not leaving this vulnerable. Time to secure it.

Enable HTTPS:

sudo apt install certbot python3-certbot-apache
sudo certbot --apache

Follow the prompts to obtain and install your SSL certificate.

Set Strong Permissions:

sudo chown -R www-data:www-data /var/www/nextcloud/
sudo find /var/www/nextcloud/ -type f -print0 | sudo xargs -0 chmod 0640
sudo find /var/www/nextcloud/ -type d -print0 | sudo xargs -0 chmod 0750

Deadpool: “Security, because we don’t want your files to end up in the hands of some villain. Even Deadpool has standards. Sort of.”

Step 7: Set Up Remote Backup for Disaster Recovery

Ensuring your data is safe from disasters is crucial. Here’s how to set up a remote backup for your Nextcloud installation:

  1. Install rsync: sudo apt install rsync
  2. Create a Backup Script: nano ~/backup.sh Add the following to the script: #!/bin/bash rsync -avz /var/www/nextcloud/ user@remote_server:/path/to/backup/
  3. Make the Script Executable: chmod +x ~/backup.sh
  4. Automate the Backup with Cron:
    bash crontab -e
    Add this line to run the backup daily at 2 AM:
    bash 0 2 * * * /home/user/backup.sh

This setup will ensure that your data is regularly backed up to a remote server, providing disaster recovery protection.

Conclusion

There you have it, bub. A secure enterprise file store that’s as tough as me and almost as good-looking. Now get out there and keep those files safe.


This is Wolverine, signing off. And remember, with great power comes great responsibility. Nah, just kidding. Keep your claws sharp and your files secure.

Deadpool: “And if you enjoyed this guide, don’t forget to like, subscribe, and send me chimichangas. Just kidding. Sort of.”

Other Recent Posts