How to Install FileShelter on Fedora Server Latest
Overview
FileShelter is an open-source web-based file transfer service that provides a secure and easy-to-use alternative to traditional FTP servers. In this tutorial, we will walk you through the step-by-step process of installing FileShelter on Fedora Server Latest.
Prerequisites
Before we begin, you will need:
- A Fedora Server Latest installation
- A root or sudo user
- A web server installed on your system: Apache, Nginx or a similar web server
Step 1: Install Dependencies
We need to install the required dependencies for FileShelter. Open your terminal and execute:
sudo dnf install python3 python3-pip python3-virtualenv rh-git29 httpd mod_ssl openssl
Confirm the installation by pressing 'y' when prompted.
Step 2: Get FileShelter
We will now clone the FileShelter GitHub repository. Run the following command:
git clone https://github.com/epoupon/fileshelter.git
Then, navigate to the cloned project directory:
cd fileshelter
Step 3: Create a Virtual Environment
Create a virtual environment for FileShelter to isolate its dependencies:
python3 -m venv fileshelter-venv
Activate the created environment by running:
source fileshelter-venv/bin/activate
Step 4: Install Dependencies
Now that we have activated the virtual environment, we can install the packages FileShelter needs using pip. Execute the following command to download the requirements:
pip3 install --no-cache-dir -r requirements.txt
Step 5: Configure FileShelter
Create a settings.py file in the 'fileshelter' directory by copying the sample configuration file:
cp fileshelter/settings-sample.py fileshelter/settings.py
Set up a database
FileShelter uses PostgreSQL as the default database engine. Install PostgreSQL and initialize the database:
sudo dnf install postgresql-server postgresql-contrib
sudo postgresql-setup --initdb
Set the PostgreSQL service to start on boot:
sudo systemctl enable postgresql
sudo systemctl start postgresql
Create a database for FileShelter:
sudo -u postgres psql -c "CREATE DATABASE fileshelter;"
Set a secure password for the user accessing the database:
sudo -u postgres psql -c "CREATE USER fileshelteruser WITH PASSWORD 'mypassword';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fileshelter TO fileshelteruser;"
Update the settings.py file with the following database settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'fileshelter',
'USER': 'fileshelteruser',
'PASSWORD': 'mypassword',
'HOST': 'localhost',
'PORT': '',
}
}
Instantiate Django settings
In the same fileshelter/settings.py file, set your SECRET_KEY, SITE_ID and optionally, ALLOWED_HOSTS variable.
Set up email notification
If you want to use email notifications when a transfer is completed or when the file expires, add these email-related settings to the settings.py file:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'yourpassword'
DEFAULT_FROM_EMAIL = '[email protected]'
Step 6: Initialize Database
Before we start the FileShelter server, we need to initialize the database:
python3 manage.py migrate
Step 7: Configure Web server
We need to configure a web server to serve FileShelter over HTTPS. We’ll use Apache in this tutorial.
Generate SSL Certificate
Use the following command to generate a self-signed SSL certificate:
sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/pki/tls/certs/localhost.crt -days 365
Enter the requested details when prompted (such as domain name). This will generate a self-signed SSL certificate in /etc/pki/tls/certs/localhost.crt and /etc/pki/tls/private/localhost.key.
Set up Apache
Start by creating a new configuration file:
sudo vim /etc/httpd/conf.d/fileshelter.conf
and add the following configuration:
<VirtualHost *:80>
ServerName fileshelter.localhost
Redirect 301 / https://fileshelter.localhost/
</VirtualHost>
<VirtualHost *:443>
ServerName fileshelter.localhost
DocumentRoot /your/path/to/fileshelter/staticfiles
# SSL Configuration
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
# Static files
Alias /static /your/path/to/fileshelter/staticfiles
<Directory /your/path/to/fileshelter/staticfiles>
Require all granted
</Directory>
<Directory /your/path/to/fileshelter/fileshelter>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# WSGI Configuration
WSGIDaemonProcess fileshelter python-path=/your/path/to/fileshelter python-home=/your/path/to/fileshelter/fileshelter-venv
WSGIProcessGroup fileshelter
WSGIScriptAlias / /your/path/to/fileshelter/fileshelter/wsgi.py
</VirtualHost>
Restart Apache
Restart Apache to apply the newly added configuration:
sudo systemctl restart httpd
Step 8: Run FileShelter
Activate the virtual environment again:
source fileshelter-venv/bin/activate
Then start the Django development server:
python3 manage.py runserver
Navigate to https://fileshelter.localhost (as defined in http configuration) in your web browser to access FileShelter.
Conclusion
That's it! You've successfully installed and configured FileShelter on Fedora Server Latest. Enjoy your new, secure file transfer service.