Data backup is essential for a sysadmin and any real user of a system. Doing so will bring many advantages to our company because, in case of failures, you will have your data well protected. Recently, I was talking about preventing the accidental deletion of certain files in Linux, but today I’ll show you how to install Bareos a tool to back up CentOS 7.
Bareos is a fairly reliable, robust and secure tool for backing up and protecting data on our operating system. In addition, it is a 100% open source fork of the backup project from Bacula. The code is released under the aGPL license which guarantees flexibility for working with the code. Code that is available in GitHub.
So, let us start.
1. Upgrade the system
First, you need to upgrade the whole system. Just run these commands on the terminal:
:~$ su :~# yum update
After that, you will have a more secure system thanks to the new security patches newly installed.
2. Install MariaDB
Bareos for its operation requires a database manager like MariaDB. So the next step is to install MariaDB.
:~# yum install mariadb-server
After that, enable and start the MariaDB service.
:~# systemctl enable mariadb :~# systemctl start mariadb
So, that’s it for now.
3. Install Bareos on CentOS 7
Now it is your turn to install Bareos. For this, we will use the dedicated Bareos repository for CentOS. This is the safest and easiest way to install Bareos. Since we can always count on the latest stable version of the program. It also simplifies installation times.
:~# yum install wget :~# wget -O /etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo
After that, install it. You also need to install the MariaDB / MySQL connector. On the other hand, you can choose between MariaDB or PostgreSQL.
:~# yum install bareos bareos-database-mysql
4. Prepare Bareos database
The next step is to set up the Bareos database. In the installation files, Bareos has a series of databases ready for use. Let’s go for it.
:~# /usr/lib/bareos/scripts/create_bareos_database :~# /usr/lib/bareos/scripts/make_bareos_tables :~# /usr/lib/bareos/scripts/grant_bareos_privileges
Bareos uses the ports 9101 and 9103. So, you have to open the ports.
:~# firewall-cmd --add-port=9101/tcp --permanent :~# firewall-cmd --add-port=9103/tcp --permanent :~# firewall-cmd --reload
Next, start Bareos services.
:~# systemctl start bareos-dir :~# systemctl start bareos-sd :~# systemctl start bareos-fd
Next, start it with bconsole:
:~# bconsole
5. Install Bareos WebUI
In order to make the use of Bareos simpler, you need to install your web interface. To do this you need to install apache web server and PHP. So, let’s do it.
:~# yum install httpd php php-cli php-common
Remember to create a rule for apache in the firewall.
:~# firewall-cmd --add-service=http --permanent :~# firewall-cmd --reload
Finally, enable the services:
:~# systemctl enable httpd :~# systemctl start httpd
After that, install bareos web ui.
:~# yum install bareos-webui
Then, create a new file to access web UI.
:~# nano /etc/bareos/bareos-dir.d/console/admin.conf
And add the following:
# Restricted console used by bareos-webui Console { Name = admin Password = “admin” Profile = “webui-admin” }
You can set the name and password you want.
Next, restart the service.
:~# systemctl restart bareos-dir :~# systemctl restart bareos-sd :~# systemctl restart bareos-fd
Finally, open the web browser and go to http://SERVER_IP/bareos-webui.
Log in and start to use it.
Conclusion
Bareos is a great application to backup data on a CentOS 7 server. For this, only a little time and some application commands are required.
Please share this article with your friends.
Thanks for posting these instructions. I’ve been following the official documentation plus a few others and just seemed to be seeing problem after problem with the webUI but your firewall entries saved the day!
Thanks again.
Just tried the installation, after install the bareos-webui and trying to access using the browser, I got the “Error: Permission denied, director seems to be down or blocking our request.”
After fiddling around, it is selinux.
1. Disable selinux, from enforcing to disabled.
file: /etc/selinux/config
or
2. setsebool -P httpd_can_network_connect on to allow for connection.
Tank you Alan for posting this information. It helped me very much.
hello, throw me the same error, try your solution and it’s the same
hello, I’ve been following the steps but i get (This site can’t be reached)