Starting with SqlBak on Linux

SqlBak application connects your Linux servers to sqlbak.com allowing you to manage MySQL, PostgreSQL and MS SQL Server database backups from the web. It should successfully work on different Linux distributions such as Ubuntu, Debian, Fedora, CentOS, and RHEL, but if you face any difficulty in using the app on your GNU/Linux distribution let us know.

Unattended SqlBak installation

To automatically install SqlBak, you can use a bash script that will add the SqlBak app package to the repository, install it, and connect the application to SqlBak.com. To download and run the script, execute the following command:

curl -sSL https://sqlbak.com/download/linux/latest| sudo bash -s <your_secret_key>

Where <your_secret_key> is a 36-character key you see on the download page when you are logged in.

After that, your server will appear on the dashboard page.

Installation through the package manager

To install SqlBak you need to do several common steps. You need to execute a few commands according to your Linux distribution. First, you need to add a link to the app’s package to a repository list. Then update the package manager and finally install the app.

Debian/Ubuntu

  1. Add a link to SqlBak app’s package to the repository list
    sudo wget -O - https://sqlbak.com/deb/key/deb.gpg.key | sudo apt-key add -

    sudo sh -c 'echo "deb [arch=amd64] https://sqlbak.com/deb stable main" >> /etc/apt/sources.list.d/sqlbak.list'
  2. Update the package list
    sudo apt-get update
  3. Install the app
    sudo apt-get install sqlbak

RHEL/CentOS

  1. Add a link to SqlBak app’s package to the repository list
    sudo sh -c 'echo " \
    [sqlbakrepo] \
    name=Sqlbak Repository \
    baseurl=https://sqlbak.com/rpm/ \
    enabled=1 \
    gpgcheck=0" >> /etc/yum.repos.d/sqlbak.repo'
  2. Install the app
    sudo yum install sqlbak

OpenSUSE

  1. Add a link to SqlBak app’s package to the repository list
    sudo sh -c 'echo " \
    [sqlbakrepo] \
    name=Sqlbak-Repository \
    baseurl=https://sqlbak.com/rpm/ \
    enabled=1 \
    gpgcheck=0" >> /etc/zypp/repos.d/sqlbak.repo'
  2. Update the package lists

    sudo zypper update
  3. Install the app

    sudo zypper install sqlbak

Fedora

  1. Add a link to SqlBak app’s package to the repository list
    sudo sh -c 'echo "
    [sqlbakrepo] \
    name=Sqlbak Repository \
    baseurl=https://sqlbak.com/rpm/ \
    enabled=1 \
    gpgcheck=0" >> /etc/yum.repos.d/sqlbak.repo'
  2. Update the package list
    sudo dnf update
  3. Install the app
    sudo dnf install sqlbak

Testing

After the installation, it is good to check if SqlBak service is successfully running:

sudo service sqlbak status 

If everything is fine you should see something like this (pay attention to the green “active (running) text”):sqlbak service status

 

Server Registration

In order to see your computer on sqlbak.com’s dashboard, you need to register it as a server there. This is done with the following command:

sqlbak -r -k <your_secret_key> [-n <desired_server_name>]

Where

  • <your_secret_key> is a 36-character key you see on the download page when you are logged in
  • <desired_server_name> is a name you would like this computer to be named on sqlbak.com, if you omit this parameter the current hostname will be used

Adding a DBMS connection

Now it’s time to connect SqlBak to your DBMS:

sqlbak -ac -dt <database_type> -u <user_name> [-p <password>]

Where

  • <database_type> can be mysql, postgresql or mssql
  • <user_name> is a DBMS user name
  • <password> is a password for the DBMS user.

This command supports some additional optional parameters:

  • -ct specifies a connection type (default is TCP/IP)
  • -h specifies the host of the DBMS (default is localhost)
  • -P specifies a port to connect to the DBMS
  • -ssh allows connecting the DBMS through an ssh tunnel

To get more details about using these parameters and other useful commands read the command reference

After the connection added you should see something like

The connection has been successfully added. Connection-Id: 1, DBMS-Type: mysql, Connection-Name: localhost:3306

Adding a backup job

When you established all necessary DBMS connections you can to the dashboard and add backup jobs for regular database backup.

Leave a Reply

Your email address will not be published. Required fields are marked *