Tag: CentOS

Use Crontab for automating recurring tasks on Fedora/CentOS

You can use a tool that is called “Crontab” for recurring tasks automation. It is available for all the Linux systems and still the most used solution.

Edit the crontab configuration file

crontab -e

This will open vi, the default linux editor, that will allow you to edit the recurring tasks for a specific date and time.

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  user command to be executed

In vi the main commands used are:
– The escape key (:x! to save OR :q! to quit)
– a to append text
– i to insert text
– dd to remove the line
– x to delete the current selected character

Verify the date and time zone

You can verify the date and the time zone (most of the cloud machines are using the UTC time zone). you can use the following command “date”:

# date
Wed Aug  4 01:10:10 UTC 2021

Install MariaDB on a Fedora/CentOS/RedHat server

If you have your own server, the first thing you may want to do with your backend shoud be to install a database server on it.

Here is step by step how to install a MySQL/MariaDB (almost the same) database on your server:
Install the MariaDB service:

yum install mariadb mariadb-server

Create your user access – change the username and password you want:

mysql
CREATE USER username@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' ;
flush privileges;

Verify the user has been created:

SELECT User FROM mysql.user;

You should be able to login on your database from you app and remotely.