Raspberry Pi

How to Install Adminer on Raspberry Pi

Adminer is a web-based data management tool that supports multiple databases like Oracle, SQLite, MySQL, PostgreSQL, and others. Adminer allows users to create tables, add columns, export data and perform other database management tasks.

In this article, we will discuss in detail how to install Adminer on Raspberry Pi.

How to Install Adminer on Raspberry Pi?

To successfully install Adminer on Raspberry Pi, follow the below-mentioned steps:

Step 1: Updating Packages

It is always recommended to update packages before any new installation. So, use the below-mentioned command to update the packages on the Raspberry Pi system:

$ sudo apt update && sudo apt upgrade

Step 2: Installing Apache Server

Before installing Adminer, it is important to have Apache installed on your Raspberry Pi system. You can follow the below-mentioned command to install it:

$ sudo apt install apache2

Step 3: Installing PHP

You should also install PHP on your Raspberry Pi system from the following command as this will help us in server-related tasks:

$ sudo apt install php -y

Step 4: Installing MariaDB

Since, Adminer is a data management tool, you must install MariaDB (database management tool) as too from the following command:

$ sudo apt install mariadb-server

Step 5: Installing SQL

To secure the MariaDB database management system, you should configure it first from the following command:

$ sudo mysql_secure_installation

Note: Enter the password for root when asked

Add “Y” or “N” on the options that come during this phase as you have to do this step by yourself.

Step 6: Creating Database

To access the Adminer, it is important to have a database. So, to create a database, use the following command:

$ sudo mysql -u root -p

You have to enter the system password to enter the MariaDB monitor.

Then type the following syntax to create the database for Adminer:

create database < database name>;

Remember that you can keep any name for your database in place of <database_name>. I have used “linuxdb” in my case.

Press “Enter” to create the database and then type the following command to set the username and password for the database:

GRANT ALL PRIVILEGES ON <database name>.* TO ‘<username>@’localhost’ IDENTIFIED BY ‘<password>’;

Note: Remember to replace <database name>, <username>, and <password> according to your choice. .

Now to apply all the changes that we made, enter the following command as written below:

FLUSH PRIVILEGES;

Now it is time to exit from database using the following command:

exit

Step 7: Installing Adminer

After creating the database, we can move towards the Adminer installation process. For this purpose, first, create a directory for Adminer at location “/usr/share” through the following command:

$ sudo mkdir /usr/share/adminer

Then follow the below-mentioned wget command to download Adminer .php file from the official website at location “/usr/share”:

$ sudo wget -O /usr/share/adminer/index.php http://www.adminer.org/latest-en.php

Step 8: Create Apache Conf File

Now it is time to create an Apache Conf file from the following command to perform Adminer related configuration:

$ sudo nano /etc/apache2/conf-available/adminer.conf

Paste the following content inside the file:

Alias /adminer /usr/share/adminer

<Directory /usr/share/adminer>

Options Indexes FollowSymLinks

AllowOverride None

Require all granted

</Directory>

Then press “Ctrl + X”, and “Y” and finally press the “Enter” button to exit the file and go back to the terminal.

You have to tell Apache to read this file and for that purpose, you must execute the following command:

$ sudo a2enconf adminer.conf

Afterwards, you must restart the Apache server to apply the above changes you made:

$ sudo service apache2 restart

Step 9: Accessing Adminer through Browser

To access Adminer interface on the browser, you must know the IP address of your system, which you can find through the following command:

$ hostname -I

Now go to your browser and type the host_IP along with /adminer to access the Adminer login screen.

http://host_IP/adminer/

Enter the Username, Password, and Database name that you have created from Step 6 and onwards.

Then click on the “Login” button to log in to the database.

At this moment, you have accessed the Adminer interface and you are now good to add columns, export data, and perform other database management tasks right from your browser.

That’s it for the guide!

Conclusion

Adminer is a web-based tool used for performing different database management tasks. You can set up this tool on your browser by first installing prerequisites like Apache, PHP, and MariaDB servers on your system. Afterward, you must create a database that you can use later at the Adminer dashboard for login purposes. Once the database is created, you must download the Adminer PHP file and perform some configuration within the Apache conf. file to complete the process. Later, you have to use the Raspberry Pi IP address in the browser with the “/adminer” and enter the login details to open the Adminer dashboard.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.