This guide shows you how to install different types of databases. We use Ubuntu 20.04 as the operating system example, but also provide the corresponding commands for other Linux distributions available on our website. These commands must be executed via SSH. If you don’t know how to connect to your server via SSH, please check here: Initial Access (SSH).
You can install databases directly via One-Click Apps in the dashboard of your dedicated server. After the initial setup of the apps, open the app catalog, search for databases, and start the installation with your preferred project, environment, and domain settings. This allows you to quickly and easily deploy and manage databases without manually working in the command line – while still benefiting from integrated web management, custom domain support, and SSL provisioning where available.
Before starting the installation of a database, make sure your system is up to date. Update your package manager’s packages with the following command depending on your operating system:
// Ubuntu & Debian
sudo apt update
// CentOS
sudo yum update
// OpenSUSE
sudo zypper up
// Fedora
sudo dnf upgrade --refresh
Depending on which database service you want to install, follow the appropriate instructions:
MariaDB is an open-source relational database management system, originally forked from MySQL. It offers improved performance, security, and continuous development. Notable features include enhanced storage engines and full compatibility with MySQL. We recommend MariaDB over MySQL.
First, ensure that the latest MariaDB version is installed. Some older operating systems like Debian 9 or Ubuntu 18.04 do not provide the latest MariaDB version by default in their package managers. Use the following command to ensure the latest version is used:
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
After installing the repo, update the package manager cache as described in the preparation step.
You can safely skip installing the MariaDB repo (above) on modern operating systems like Ubuntu 22.04 or Debian 11.
Once the repo is set up, install MariaDB by installing the mariadb-server package. Depending on your OS, run one of the following commands:
// Ubuntu & Debian
sudo apt install mariadb-server
// CentOS
sudo yum install mariadb-server
// OpenSUSE
sudo zypper install mariadb
// Fedora
sudo dnf install mariadb-server
After installation, start configuring the server with the following command:
mysql_secure_installation
Now you can configure your MariaDB (MySQL) server by following the instructions and setting a password for your server. You can skip the first prompt by pressing Enter.
The root user is the main user of your MariaDB (MySQL) server!
Next, you will be asked if you want to set a password for the root user. Confirm with y for yes. Then enter the new root password.
Nothing will be displayed while typing the password – this is normal and your password will still be saved. Use a strong password for root and keep it safe.
You will then be asked whether to remove anonymous users from the server. For security reasons, confirm this with y:
Next, decide whether the root user is allowed to connect remotely to the server. For security reasons, disable this option and confirm with y:
Then you can remove the test database that MariaDB ships with by confirming with y, as it is not needed:
At the end, you will be asked if the database privileges should be reloaded. Confirm with y to activate the previously set root password:
Your MariaDB (MySQL) server is now ready to use!
Redis is an in-memory data store that primarily stores data in key-value format but also supports other formats like lists, JSON, and more. It is known for its speed and delivers responses to requests within milliseconds.
First, you need to add a repository that enables Redis installation. This step is not necessary for all Linux distributions, only for those listed below. Run the command that matches your OS and version:
// Ubuntu (all versions) and Debian (only Debian 10)
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
// CentOS (only CentOS 7)
sudo yum install epel-release
// CentOS (only CentOS 8)
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
After adding the repo, update the package manager cache as described in the preparation step.
If your operating system is not listed above, you can skip this step.
After adding the repo, install the Redis server package. Run the command that matches your OS:
// Ubuntu and Debian
sudo apt install redis-server
// CentOS
sudo yum install redis
// OpenSUSE
sudo zypper install redis
// Fedora
sudo dnf install redis
After installation, your Redis server is ready! By default, it runs on 127.0.0.1:6379 without a password.
For Debian/Ubuntu users:
Remember to enable the redis-server service after installation so it starts automatically on server boot. Use the following command:
sudo systemctl enable --now redis-server
MongoDB is a document-oriented NoSQL database designed for scalability and developer agility. It stores data in a JSON-like BSON format, allowing storage of diverse data types. MongoDB supports indexes to reduce response times and stands out by not requiring a predefined schema like MySQL or SQLite, offering flexibility and speed.
Select your operating system from the tabs below to see the appropriate instructions.
First, import the public GPG key for MongoDB with the following command:
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
--dearmor
Then add the MongoDB source to your OS’s source list by running:
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/$(lsb_release -si | awk '{print tolower($0)}') $(lsb_release -sc)/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Now update the package sources with sudo apt update. Then install MongoDB with:
sudo apt install mongodb-org
Your MongoDB installation should now be working!
First, set up the MongoDB repo for Red Hat systems.
Create a file named /etc/yum.repos.d/mongodb-org-6.0.repo and add the following content:
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
Now install MongoDB. The install command differs slightly between CentOS and Fedora; use the appropriate one:
// CentOS
sudo yum install -y mongodb-org
// Fedora
sudo dnf install -y mongodb-org
Your MongoDB installation should now be running – much simpler than on other Linux distributions!
First, import the public key for the MongoDB repository with:
sudo rpm --import https://www.mongodb.org/static/pgp/server-6.0.asc
Then add the MongoDB repository with:
sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/15/mongodb-org/6.0/x86_64/" mongodb
Finally, install the latest MongoDB version with:
sudo zypper -n install mongodb-org
Your MongoDB installation should now be ready to use!