SqlBak Blog

Starting with SqlBak on Linux

The 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.

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 install the app.

Debian/Ubuntu

  1. Download package
    curl -o sqlbak.deb https://sqlbak.com/download/linux/latest/sqlbak.deb
  2. Install the app
    sudo apt-get install ./sqlbak.deb

RHEL/CentOS/OpenSUSE/Fedora/Oracle

  1. Install the app
    sudo rpm -Uvh https://sqlbak.com/download/linux/latest/sqlbak.rpm

Linux Mint

  1. Download package
    curl -o sqlbak.deb https://sqlbak.com/download/linux/latest/sqlbak.deb
  2. Install the app
    sudo apt-get install ./sqlbak.deb

Amazon Linux AMI

  1. Install the app
    sudo rpm -Uvh https://sqlbak.com/download/linux/latest/sqlbak.rpm

Kali Linux

  1. Download package
    curl -o sqlbak.deb https://sqlbak.com/download/linux/latest/sqlbak.deb
  2. Install the app
    sudo apt-get install ./sqlbak.deb

Photon OS

  1. Install the app
    sudo rpm -Uvh https://sqlbak.com/download/linux/latest/sqlbak.rpm

Testing

After the installation, it is good to check if the 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:

sudo 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 MS SQL
  • <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 is 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 establish all necessary DBMS connections, you can go to the dashboard and add backup jobs for regular database backup.

20 thoughts on “Starting with SqlBak on Linux”

  1. Hello
    Please confirm if this lines are updated (see baseurl)

    sudo sh -c ‘echo ” \
    [sqlbakrepo] \
    name=Sqlbak Repository \
    baseurl=https://sqlbak.com/rpm/ \
    enabled=1 \
    gpgcheck=0″ >> /etc/yum.repos.d/sqlbak.repo’

    we have problems installing on CentOS

    Reply
  2. Hi, trying to add a database can I get:

    Handling a console command has failed. Failed to add DBMS connection. “/usr/bin/mysql: /etc/sqlbak/libtinfo.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libedit.so.2)
    mysql: [Warning] Using a password on the command line interface can be insecure.
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

    Can you advise please?

    Reply
  3. this sounds like a big security risk 🙂
    do i understand it right you get the username and password from the mysql server?
    i skip this one :-))

    Reply
  4. Thanks for your smart backup tool! I´m using docker for my postgresql database. But the docker image uses Alpine Linux. How would to install inside Alpine linux version?

    Kind regards

    Reply
  5. Deb repository not available.

    https://sqlbak.com/deb stable Release
    404 Not Found [IP: 209.133.198.58 443]
    Reading package lists… Done
    E: The repository ‘https://sqlbak.com/deb stable Release’ no longer has a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

    Reply
  6. My Pi4 is running mariaDB, which I thought was a MySQL clone. PHPMyAdmin works on it without issue.

    When I put MySQL in as database type I get “MySQL no such file or directory” Does this stop me from using SqlBak?

    Reply
  7. Hello! I’m currently facing an error with the backup compressed file, which is throwing an error whenever I try to run the backup job more than once.
    I set the SFTP destination path, but it can only run one time (when the file does not exist).
    Am I doing something wrong?

    192.168.0.10
    D:\sqlbak

    Those are the host and the SFTP destination.

    Reply
  8. could You help me please
    i’m facing an error after installing sqlbak ver 1.9.79
    couldn’t start the sqlbak service and here is the log

    May 16 18:10:43 MYM systemd[1]: Starting SqlBak…
    May 16 18:10:44 MYM sqlbak[36818]: Traceback (most recent call last):
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/local_db.py”, line 94, in _executescript
    May 16 18:10:44 MYM sqlbak[36818]: sqlite3.OperationalError: attempt to write a readonly database
    May 16 18:10:44 MYM sqlbak[36818]: During handling of the above exception, another exception occurred:
    May 16 18:10:44 MYM sqlbak[36818]: Traceback (most recent call last):
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak_build.py”, line 5, in
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/run.py”, line 40, in main
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/app.py”, line 45, in start_app
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/app.py”, line 40, in start_app
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/local_db.py”, line 581, in create_db_tables_and_update_db_version
    May 16 18:10:44 MYM sqlbak[36818]: File “sqlbak/local_db.py”, line 100, in _executescript
    May 16 18:10:44 MYM sqlbak[36818]: sqlite3.OperationalError: attempt to write a readonly database
    May 16 18:10:44 MYM sqlbak[36818]: [36818] Failed to execute script ‘sqlbak_build’ due to unhandled exception!
    May 16 18:10:45 MYM systemd[1]: sqlbak.service: Control process exited, code=exited, status=1/FAILURE
    May 16 18:10:45 MYM systemd[1]: sqlbak.service: Failed with result ‘exit-code’.
    May 16 18:10:45 MYM systemd[1]: Failed to start SqlBak.
    May 16 18:10:45 MYM systemd[1]: sqlbak.service: Consumed 2.000s CPU time.

    Reply
    • Hello Muhammed,

      The key aspect is that the application must have read and write access to the following directories:

      /etc/sqlbak/
      /opt/sqlbak/
      /tmp/sqlbak/

      We will further investigate your case and release an article with setup instructions later.

      If you have any other questions, please let us know.

      Thank you, and sorry for the inconvenience.

      Reply

Leave a Comment