Search This Blog

Tuesday, November 28, 2023

Paths for Configure MySQL and MariaDB

Setting up and configuring your MySQL or MariaDB database on an Ubuntu server is a crucial step in ensuring optimal performance and security for your web applications. The configuration files hold the key to fine-tuning the behavior of your database server.

In this guide, we will walk you through the essential paths for accessing the configuration files on Ubuntu 16.04 LTS and below, as well as Ubuntu 18.04 LTS and above, for both MySQL and MariaDB.

Paths for Configuration Files:

1. MySQL with Ubuntu 16.04 LTS or Below Version:

sudo nano /etc/mysql/my.cnf

For users operating on Ubuntu 16.04 LTS or earlier versions, this path leads to the main configuration file for MySQL. Here, you can adjust various settings such as server parameters, buffer sizes, and logging options.

2. MySQL with Ubuntu 18.04 LTS or Above Version:

If you are working with Ubuntu 18.04 LTS or a later version, the MySQL configuration file is typically organized in the mysql.conf.d directory. The mysqld.cnf file within holds the specific configurations for the MySQL daemon.

3. MariaDB with Ubuntu 16.04 and Debian 9 or Above Version:

For those utilizing MariaDB on Ubuntu 16.04 and Debian 9 or later, the configuration file is located in the mariadb.conf.d directory. The 50-server.cnf file is where you can tailor the server settings according to your application's requirements.

Monday, October 2, 2023

Fixed anydesk display server not supported

This set of commands and instructions is meant to address an issue with AnyDesk on a remote server where the display configuration is not supported. AnyDesk is a remote desktop software that allows users to access and control remote computers. The issue mentioned here seems to be related to configuring the server's display settings and enabling automatic login for a specific user.


These are the steps to resolve the AnyDesk remote server display issue:

1. Login to the Terminal: You'll need to access your server's terminal as a superuser (root). Use the following command to become the superuser:

 sudo su

 You'll be prompted to enter your system password. Provide the password to gain superuser privileges.


2. Open custom.conf with an editor: This step involves editing the "custom.conf" file using the nano text editor. Use the following command to open the file:

  sudo nano /etc/gdm3/custom.conf

 Inside the "custom.conf" file, you need to uncomment (remove the "#" symbol) from the following lines:

   WaylandEnable=false

   AutomaticLoginEnable = true

   AutomaticLogin = $USERNAME


   After making these changes, your "custom.conf" file should look like the provided example.

# GDM configuration storage

#

# See /usr/share/gdm/gdm.schemas for a list of available options.

[daemon]

# Uncomment the line below to force the login screen to use Xorg

WaylandEnable=false

# Enabling automatic login

AutomaticLoginEnable = true

AutomaticLogin = $USERNAME

# Enabling timed login

#  TimedLoginEnable = true

#  TimedLogin = user1

#  TimedLoginDelay = 10

[security]

[xdmcp]

[chooser]

[debug]

# Uncomment the line below to turn on debugging

# More verbose logs

# Additionally lets the X server dump core if it crashes

#Enable=true


3. Configure login password: Set the AnyDesk login password to "G@^e$#" using the following command:

   echo "G@^e$#" | sudo anydesk --set-password

   This command will configure the AnyDesk password to the specified value.


4. Reboot your Server: To apply the changes and ensure that AnyDesk works with the updated configuration, you should reboot your server. Use the appropriate command for your server's operating system to do so.

After completing these steps and rebooting your server, the AnyDesk issue related to display support should be resolved, and you should be able to use AnyDesk for remote access without problems.


*** THE END ***

YOUTUBE LINK: @GTechInformations

INSTAGRAM LINK: @gtechinformations


For more information, please subscribe and continue to support us on all our platforms.


Automatic Restart Apache2 When It Goes Down

Managing the availability of your Apache2 web server is crucial to ensure uninterrupted web services. In the event that Apache2 unexpectedly stops, whether due to system issues or other reasons, it's essential to have a mechanism in place to automatically restart it. This guide will walk you through the process of creating a shell script and setting up a Systemd service that monitors Apache2's status and automatically restarts it if it's not running. These instructions are applicable to Ubuntu, Debian, and CentOS Linux distributions.

Follow the step-by-step instructions below to create an automated Apache2 restart system on your Ubuntu, Debian, or CentOS server:

Step 1: Login to the Terminal

Access your server's terminal by logging in as a superuser (root) with the following commands:

sudo su

You'll be prompted for your system password (Enter with your System password).


Step 2: Create a Shell Script to Restart Apache2

Create a shell script named `restart_apache.sh` and open it for editing:

nano /usr/local/bin/restart_apache.sh

Add the following content to the file:

#!/bin/bash

while true; do

    if ! systemctl is-active --quiet apache2; then

        echo "Apache2 is not running. Restarting..."

        systemctl restart apache2

    fi

    sleep 5

done

Save the file and exit the text editor.


Step 3: Make the Script Executable

Make the script executable with the following command:

chmod +x /usr/local/bin/restart_apache.sh


Step 4: Create a Systemd Service

Create a Systemd service file named `apache_restart.service` and open it for editing:

nano /etc/systemd/system/apache_restart.service

Add the following content to the file:

[Unit]

Description=Apache2 Restart Service

After=network.target

[Service]

ExecStart=/usr/local/bin/restart_apache.sh

Restart=always

User=root

Group=root

[Install]

WantedBy=multi-user.target

Save the file and exit the text editor.


Step 5: Enable and Start the Service

Enable the newly created service and start it:

sudo systemctl enable apache_restart.service

sudo systemctl start apache_restart.service

With these instructions, you will have established an automatic Apache2 restart mechanism on your Ubuntu, Debian, or CentOS server. This ensures that Apache2 automatically restarts if it unexpectedly stops, maintaining uninterrupted web server operations.


YOUTUBE LINK: @GTechInformations

INSTAGRAM LINK: @gtechinformations


For more information, please subscribe and continue to support us on all our platforms.

Sunday, October 1, 2023

Automatic Restart MySQL When It Goes Down

Managing the availability of your MySQL database is critical for uninterrupted service. In the event that your MySQL server unexpectedly stops, whether due to system issues or any other reason, it's essential to have a mechanism in place to automatically restart it. This blog post will guide you through the process of creating a shell script and setting up a Systemd service that monitors MySQL's status and automatically restarts it if it's not running. These instructions are applicable to Ubuntu, Debian, and CentOS Linux distributions.


Follow the step-by-step instructions below to create an automated MySQL restart system on your Ubuntu, Debian, or CentOS server:


[Step 1: Login to the Terminal]

Access your server's terminal by logging in as a superuser (root) with the following commands:

sudo su

You'll be prompted for your system password (Enter with your System password).


[Step 2: Create a Shell Script to Restart MySQL]

Create a shell script named `restart_mysql.sh` and open it for editing:

nano /usr/local/bin/restart_mysql.sh

Add the following content to the file:

#!/bin/bash

while true; do

    if ! systemctl is-active --quiet mysql; then

        echo "MySQL is not running. Restarting..."

        /etc/init.d/mysql start

    fi

    sleep 5

done


Save the file. its looks like below image



[Step 3: Make the Script Executable]

Make the script executable with the following command:

chmod +x /usr/local/bin/restart_mysql.sh


[Step 4: Create a Systemd Service]

Create a Systemd service file named `mysql_restart.service` and open it for editing:

nano /etc/systemd/system/mysql_restart.service

Add the following content to the file:

[Unit]

Description=MySQL Restart Service

After=network.target

[Service]

ExecStart=/usr/local/bin/restart_mysql.sh

Restart=always

User=root

Group=root

[Install]

WantedBy=multi-user.target


Save the file. its looks like below image



[Step 5: Enable and Start the Service]

Enable the newly created service and start it:

sudo systemctl enable mysql_restart.service

sudo systemctl start mysql_restart.service


[Step 6: Check the Status of the Service]

You can check the status of the MySQL restart service using the following command:

sudo systemctl status mysql_restart.service

This command will display information about the service, including whether it's active and running.

*** THE END ***

By following these steps, you will have set up an automatic MySQL restart mechanism on your Ubuntu, Debian, or CentOS server, ensuring that your MySQL database restarts seamlessly whenever it unexpectedly stops, thereby maintaining uninterrupted database operations.