Linux Resources
- Home
- Linux Resources
This article covers how to secure Red Hat Enterprise Linux 8 with UFW. UFW may not be intended to provide complete firewall functionality, but it does provide an easy way to create and manage simple firewall rules.
A firewall is a way to protect machines from any unwanted traffic from outside.
It enables users to control incoming network traffic on host machines by defining a set of firewall rules.
These rules are used to sort the incoming traffic and either block it or allow through.
Note that firewalld with nftables backend does not support passing custom nftables rules to firewalld, using the --direct option.
How to start, stop, restart firewalld service on an RHEL 8?
By now you know about firewalld zones, services, and how to view the defaults. It is time to activate and configure our firewall.
1. Start and enable firewalld
$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld
2. Stop and disable firewalld
$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld
3. Check the firewalld status
$ sudo firewall-cmd --state
4. Command to reload a firewalld configuration when you make change to rules
$ sudo firewall-cmd --reload
5. Get the status of the firewalld service
$ sudo systemctl status firewalld
When to use firewalld, nftables, or iptables:
1. firewalld: Use the firewalld utility for simple firewall use cases. The utility is easy to use and covers the typical use cases for these scenarios.
2. nftables: Use the nftables utility to set up complex and performance critical firewalls, such as for a whole network.
3. iptables: The iptables utility on Red Hat Enterprise Linux 8 uses the nf_tables kernel API instead of the legacy back end.
The nf_tables API provides backward compatibility so that scripts that use iptables commands still work on Red Hat Enterprise Linux 8. For new firewall scripts, Red Hat recommends to use nftables.
This article covers how to take Backups and restore a MySQL database on Red Hat Enterprise Linux 8.
Advantage of logical backup:
The main advantage of logical backup over physical backup is portability and flexibility.
The data can be restored on other hardware configurations, MariaDB versions or Database Management System (DBMS), which is not possible with physical backups.
Note that physical backup must be performed when the mariadb.service is not running or all tables in the database are locked to prevent changes during the backup.
The mysqldump client is a backup utility, which can can be used to dump a database or a collection of databases for the purpose of a backup or transfer to another database server.
The output of mysqldump typically consists of SQL statements to re-create the server table structure, populate it with data, or both.
Alternatively, mysqldump can also generate files in other formats, including CSV or other delimited text formats, and XML.
Advantages of Physical backup:
1. Output is more compact.
2. Backup is smaller in size.
3. Backup and restore are faster.
4. Backup includes log and configuration files.
You can use one of the following MariaDB backup approaches to back up data from a MariaDB database:
1. Logical backup with mysqldump
2. Physical online backup using the Mariabackup tool
3. File system backup
4. Replication as a backup solution
To Backing up an entire database with mysqldump:
Execute the command:
# mysqldump [options] db_name > backup-file.sql
Using mysqldump to back up a set of tables from one database:
To back up a subset of tables from one database, add a list of the chosen tables at the end of the mysqldump command:
# mysqldump [options] db_name [tbl_name …]
To restore the data while keeping the original backup files, use the following procedure:
1. Run the mariabackup command with the --copy-back option:
$ mariabackup --copy-back --target-dir=/var/mariadb/backup/
2. Fix the file permissions.
When restoring a database, Mariabackup preserves the file and directory privileges of the backup. However, Mariabackup writes the files to disk as the user and group restoring the database.
For example, to recursively change ownership of the files to the mysql user and group:
# chown -R mysql:mysql /var/lib/mysql/
3. Start the mariadb service:
# systemctl start mariadb.service
This article covers methods to easily install Apache Maven on the Ubuntu system. You will also learn how to uninstall Apache Maven from Ubuntu if you ever need to do so.
Apache Maven is a free and open-source project management tool primarily for Java projects. It is based on POM and also used to build and manage projects written in C#, Ruby, Scala, and others.
To Install Apache Maven on Ubuntu:
1. Apache Maven is based on Java. So Java must be installed in your server. You can install the Java using the following command:
$ apt-get install default-jdk -y
2. By default, Apache Maven is available in the Ubuntu 20.04 default repository. You can install it with the following command:
$ apt-get install maven -y
3. Once the installation is completed, you can verify the Apache Maven version with the following command:
$ mvn -version
This article covers LibreOffice installation on CentOS 8 distribution. LibreOffice is a powerful and open-source office suite that can be used on Linux, Mac as well as on Windows.
It provides various features such as word documentation, spreadsheets, data processing, drawing, presentation design, Math calculation, and more.
How to uninstall Old LibreOffice or OpenOffice Versions ?
If any previously installed LibreOffice or OpenOffice versions you have, remove it using following command.
# yum remove openoffice* libreoffice* [on RedHat based Systems]
$ sudo apt-get remove openoffice* libreoffice* [On Debian based Systems]
This article covers the different commands for Flatpak installation on Ubuntu 20.04 system. Here, you will learn how you can install an application through Flatpak software. Also you will see the two different removal processes of Flatpak.
Flatpak is a universal package system for software deployments, application virtualization, and most importantly package management that works on all Linux distros.
With a Flatpak package, you don’t need to worry about any dependencies and libraries as everything is already bundled within the application itself.
To Install Flatpak through Ubuntu Official Repository:
1. Update your system's repository index through the following command:
$ sudo apt-get update
2. Now you are ready to install Flatpak; you can do so by running the following command as sudo:
$ sudo apt-get install flatpak
3. You can check the version number of the application, and also verify that it is indeed installed on your system, through the following command:
$ flatpak --version
To Install Flatpak on OpenSUSE.
To enable Flatpak on OpenSUSE invoke the command:
$ sudo zypper install flatpak
To Install Flatpak on ArchLinux / Manjaro.
Finally, to enable Flatpak on Arch Linux and its flavors, invoke the command:
$ sudo pacman -S flatpak
How to remove Flatpak from Ubuntu?
This was all you needed to know about Flatpak. If you want, you can remove it through the following commands:
$ sudo apt-get remove flatpak
If you have installed the package from the PPA, you can remove the PPA through the following command:
$ sudo rm /etc/apt/sources.list.d/alexlarsson-ubuntu-flatpak-bionic.list
This article covers how to install Atom text editor on the Debian system. Atom is a very powerful text editor.
The Atom user interface is very clean and it has support for many important features such as split view, Git integration and so on. Atom is cross platform. It runs on Linux, Windows and macOS.
To Enable snaps on Debian and install Atom:
Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.
1. Enable snapd
$ sudo apt update
$ sudo apt install snapd
$ sudo snap install core
2. To install Atom, simply use the following command:
$ sudo snap install atom --classic
To Update Atom Text Editor on Debian:
You can update the Atom when a new version is available. You can update it through your desktop standard Software Update tool.
Alternatively, you can update by running the following commands in your terminal:
$ sudo apt update
$ sudo apt upgrade