MediaDrop installation steps
The following sections will take you through the installation of Mediadrop.
BBB Debian – prerequisites
Now that your system is ready to accept all the applications you want to install, let's begin with the MySQL part:
Note
Actually, sudo apt-get install
works behind the scenes. From this point onwards, we'll rely on aliases to ease our life from the command line. Refer to the Appendix to get all the details.
During this you'll be asked for the database's root password, then the remaining system files:
Finally, the Python-related requirements that will help you in virtual environments can be installed using the following command:
With system requirements in place, you can set up MediaDrop in just six installation steps. Before doing that, you need to define a database for it.
Setting up a dedicated database
You need to create some credentials and assign a user to a new MediaDrop database. It requires you to type only a few commands. If this is something that you don't want to do, the script is available on the GitHub companion website at https://github.com/dlewin/BeagleboneBlack-Server-Book.
Just execute the following command:
Instead, if you are like me and want to control your entire system, then open a MySQL console, and pay attention to the syntax of the following command (with the ;
):
Then, fill in the password you have defined in the installation steps.
You will now have access to the MySQL console for all the database operations that MediaDrop requires. Now, perform the following steps:
- Create your user with a password:
- Create the
MediaDrop
database; pay attention to the use of capital letters: - Now, we tell that we want to work on this database:
- Set some rights on this database for the
debian
user:
Here's a screenshot that shows these operations along with the related MySQL feedback you should get:
Step 1 – set up a Python virtual environment
MediaDrop has been programmed in Python, a simple but powerful language that we'll also use in Chapter 6, Illuminate Your Imagination with Your Own Projects. As plugins are also in Python, you are free to extend the platform as you wish.
Let's see how to define a dedicated environment for this purpose.
Virtual environments introduce a functionality provided with Python that I like to use: actually, with this functionality, you can resolve the problems of software versions and incompatibility. The principle is to use as many virtual spaces with different packages or executables as you want without any confusion that might create a broken system. Thanks to the isolation provided by this tool, you are guaranteed that it is kept as you want it to be and thus you always have a safe system.
Currently, we are using the 0.10.3 version of MediaDrop, but nothing stops you from trying the next version in order to test any side effects on your architecture. Thus, instead of executing the current environment, you'll just have to start MediaDrop from the n+1 environment.
Virtual environment is presented just here, but you should create an environment each time you need different usages of an application or dependencies. It requires just less than a minute and can be done by performing the following steps:
- Create the environment with a specific name; in our case,
venv
: - Enter the dedicated virtual environment:
That's all! You are in now. Cool, eh?
The command prompt is preceded by the virtual environment's name, so you can guess which environment is currently activated, which is shown in the screenshot that follows the code:
You can now install any package you want; it will only be accessible in the currently activated environment.
Step 2 – installing MediaDrop
For installation, retrieve the last stable release from downloads:
Then, perform the following steps:
- Extract the archive:
- Enter the new directory to launch the installation script:
- This will take a few minutes, as it checks and downloads the required dependencies, and will end with the following lines:
- From here, the recommended installation is to enter the following:
This will generate the production.ini
file, which the server will use as a configuration file. So, we can adapt by editing it.
Step 3 – basic configuration file
What we want to do here is tell which database we created and the related credentials. So, edit the production.ini
file, with nano
(or vim
) in order to focus on the [app:main]
section, as we want to change the following line:
The settings are shown in the following screenshot:
At the same time, as port 8080 is already used, let's change this to an available port, something such as 8082. As you'll see later on, many servers use the 8080 port for their configuration settings, and obviously only one application will be able to use this port, which means that according to your configurations, you will have to decide which application will use the 8080 port.
Note
Additionally, you can eventually customize your configuration file with an e-mail that will let you receive notifications from the server. You will then need to install a local SMTP server and apply the settings in this production.ini
file at the [DEFAULT]
section.
Now, save and quit the editor. We are done with the configuration part.
Step 4 – copying content from the initial data
We have completed all the configuration steps, and we are now going to deploy all the website data content.
To do this, copy the data
directory from the sources to be at the same level as your production.ini
file:
Give it the write permissions for the debian
user; when some content is uploaded, it will be written here:
Step 5 – filling the server database and contents
It's now time to fill the MediaDrop
database we've created previously with some tables and required data. We just have to call a predefined command:
Step 6 (optional) – full-text searching
Create some triggers that will allow you to have better searches than exact matches, as follows:
Nothing else is remaining; we are in. Time to start our first server!