01 June 2023

How To Install WordPress in Ubuntu Cli

You must follow a set of steps in order to install WordPress on Ubuntu using the command line interface (CLI). Here is a detailed instruction:

1 System package updates:
Update the system packages to the most recent versions first. Run the following commands in a terminal after opening it:

sudo apt update
sudo apt upgrade

2 Set up the LAMP stack:

A web server, database, and PHP are necessary for WordPress. Using the command line, you may install the LAMP stack (Linux, Apache, MySQL, and PHP):

( 1 ) Install Apache

sudo apt-get install apache2 -y

( 2 ) Activate Apache and start it:
Start the service and make Apache boot up automatically after installation.

sudo systemctl start apache2
sudo systemctl enable apache2

( 3 ) Install MariaDB

sudo apt-get install mariadb -y

( 4 ) Activate Mariadb and start it:
Start the service and make Mariadb boot up automatically after installation.

sudo systemctl start mariadb
sudo systemctl enable mariadb

( 5 ) MySQL configuration

You’ll be asked to choose a root password when installing the MySQL server. Establish a strong password and abide by the directions. Run the subsequent command to protect the MySQL installation after that:

sudo mysql_secure_installation

follow a pick 

 

 

Your root password 

 

And then create the database

( 7 ) The creation of a MySQL database and user

Run the following command to enter the MySQL shell:

sudo mysql -u root -p

Enter the root password you created before. A new database and user can be created for highsky_db after you are logged in:

create database highsky_db

Check the Database

SHOW DATABASES;

And Exit 

( 6 ) Install PHP

sudo apt-get install php

( 7 ) Install PHP-MySQL

sudo apt-get install php-mysql php-cgi php-cli php-gd

( 8 ) Restart the Apache service

sudo systemctl enable apache2

( 9 ) Installing and setting up WordPress:

Move to the Apache web server root directory:

sudo cd /var/www/html/

( 10 ) Install WordPress using the most recent version:

sudo wget https://wordpress.org/latest.zip

( 11 ) Unzip Tar File

sudo unzip latest.zip

( 12 ) Check the unzip file

sudo ls

( 13 ) Copy this  file /var/www/html/

sudo cp -r wordpress/* /var/www/html/

( 14 ) Allow the Apache service in ufw

sudo ufw allow http

( 15 ) your IP address copy

sudo ip a

( 16 ) Access WordPress:

Open a web browser and type your server’s IP address or domain name. The WordPress installation page ought to appear. To finish the installation, adhere to the on-screen directions.

And click the Let ‘s go’

Scroll and click  Submit  

( 17 ) And go to Terminal to create a file /var/www/html/wp-config.php

sudo vim wp-config.php

Copy the full path And paste /var/www/html/wp-config.php

Click the Run the installation

your Email id file then Click install WordPress

Click Log in

Successful WordPress installation

 

31 May 2023

How to install WordPress in Redhat

1 what is WordPress

Popular content management systems (CMS) like WordPress are used to build and maintain websites. It is a free and open-source platform that enables people to publish content and develop websites without having to have a deep understanding of coding.

WordPress is very flexible and adaptable for all sorts of websites since it offers a user-friendly interface and a variety of configurable themes and plugins. Originally designed as a blogging platform, it has now matured into a feature-rich CMS that can power everything from straightforward personal blogs to intricate e-commerce websites and corporate portals.

WordPress has a few important features, such as:

1 Simple Content Management: WordPress makes it simple for users to write blog posts, create pages,  add images and videos, and more.

2 Themes & Personalization: Users can alter the look of their website by selecting from a wide range of free and commercial themes. Furthermore, WordPress offers a wide range of customization options via plugins and widgets, allowing users to expand the functionality and features of their websites.

3 WordPress was created with search engine optimization (SEO) in mind, and it offers a number of tools and plugins to help with content optimization and raise search engine ranks.

4 WordPress has an extensive ecosystem of plugins that users may install to increase the functionality of their websites. Contact forms, e-commerce options, social network integration, security improvements, and other features are all covered by these plugins.

5 Support and Community The WordPress platform has a sizable and vibrant community of users, developers, and contributors who help one another out, share information, and create fresh themes and plugins. This community feature guarantees users access to information, support, and updates for their WordPress websites.

WordPress is a popular and adaptable platform that enables people, companies, and organizations to construct and maintain websites easily.

2 You can adhere to these general procedures to install WordPress on CentOS, Red Hat, or Fedora:

( 1 ) System package updates:
For a start, make sure your system packages are updated so you have the most recent dependencies and updates:

[root@server ~]# yum update

( 2 )  Apache Web Server install
WordPress needs a web server to run, and Apache is a common option. Use the command line interface to install Apache:

[root@server ~]# yum install httpd -y

( 3 ) Activate Apache and start it:
Start the service and make Apache boot up automatically after installation.

[root@server ~]# systemctl start httpd
[root@server ~]# systemctl enable httpd

( 4 ) MariaDB (or MySQL) install :
MariaDB is a good option for WordPress’ requirement for a database server. Use the subsequent command to install MariaDB:

yum install mariadb-server mariadb

( 5 ) Start MariaDB and make it active:
Start the service and make it such that MariaDB starts automatically when the system boots after installing it.

systemctl start mariadb
systemctl enable mariadb

3 MariaDB Secure installation on RHE

( How to install MariaDB and use MariaDB redhat )

To configure the MariaDB root password and increase security, run the security script:

mysql_secure_installation

( 1 ) MariaDB, just like MySQL is the default. secure Therefore, you must take another step and run the mysql_secure_installation script.

You are guided through a series of prompts by the Running command. You will need to create a root password first. The default root user unix socket authentication in MariaDB is insufficiently secure.

So, decline from using the Unix socket authentication by pressing  ” n ” and hitting

mysql_secure_installation

Enter current password for root (enter for none):  [Press Enter] 

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

Your root account is protected, so you can safely answer ‘n’.

Switch to unix_socket authentication [Y/n]   [Press ” n ” Enter ] 

Change the root password? [Y/n]    [ Press ” y ” Enter ]

New password:                                   [ highsky@123 ]

Re-enter new password: Re-enter password  [ highsky@123 ]

Password updated successfully!
Reloading privilege tables.
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]        [ Press ” y ” Enter ] 
.. Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]   [ Press ” y ” Enter ]
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]  [ Press ” y ” Enter ]
– Dropping test database…

… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]   [ press ” y ” Enter ] 
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure

Successful Secure installation

4 Create MariaDB Database 

( 1 )  Log in now back to the MariaDB server and authenticate with the password you configured.

[root@server ~]# mysql -u root -p

Enter password:  Enter your root password

( 2 ) Create a test database. Here, we are going to name it highsky_db

MariaDB [(none)]> CREATE DATABASE redhat_db;

Query OK, 1 row affected (0.001 sec)

( 3 ) Check the database

MariaDB [(none)]> SHOW DATABASES;

 

( 4 )  Exit the MariaDB shell:

exit

( 5 ) Start MariaDB and make it active:
Start the service and make it such that MariaDB starts automatically when the system boots after installing it.

[root@server ~]# systemctl restart mariadb.service

5  Run the below command to complete installing PHP on your system.

( 1 ) Install PHP

[root@server ~]# yum install php
[root@server ~]# yum install php-mysqlnd.x86_64

6 Installing and downloading WordPress:

( 1 ) Access the Apache web root directory by changing:

[root@server ~]# cd /var/www/html/

( 2 ) Installing WordPress’ most recent version:

[root@server html]# wget https://wordpress.org/latest.zip

( 3 ) Check the  file

[root@server html]# ls

( 4 ) unzip the WordPress files:

[root@server html]# unzip latest.zip

( 5 ) Check the  file

[root@server html]# ls

 

( 6 ) Copy this  file /var/www/html/

[root@server html]# cp -r wordpress/* /var/www/html/

( 7 ) Restart the Apache service and Boot time lode

[root@server html]# systemctl restart httpd
[root@server html]# systemctl enable httpd

( 8 ) Firewall add Apache service

root@server html]# firewall-cmd --permanent --add-service=http

( 9 ) Firewall Reload

[root@server html]# firewall-cmd –reload

( 10 ) your IP address copy

[root@server html]# ifconfig

ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.66.128 netmask 255.255.255.0 broadcast 192.168.66.255
inet6 fe80::3325:3f19:e2c4:6a01 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:1f:38:1c txqueuelen 1000 (Ethernet)
RX packets 19211 bytes 26321860 (25.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4360 bytes 312961 (305.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

my IP 192.168.66.128

7 Access WordPress:

Open a web browser and type the IP address or domain name of your server. The WordPress installation page ought to appear. To finish the installation, adhere to the on-screen directions.

And click the Let ‘s go’

 

Click Submit 

And go to Terminal to create a file /var/www/html/wp-config.php

[root@server html]# vim wp-config.php

Copy the full path And paste /var/www/html/wp-config.php

 

Click the Run the installation

your Email id file then Click install WordPress

Click Log in

Successful WordPress installation

26 May 2023

What is the Linux And basic commands

WHAT IS  LINUX?

“Linux” refers to the operating system kernel on which Red Hat Enterprise Linux (RHEL) is built. The open-source Linux kernel provides the fundamental features and services required for an operating system to run on hardware, modeled after the Unix operating system.

In addition to the Linux kernel, system utilities, libraries, and software packages, RHEL is a Linux distribution. It offers a dependable, supported, and enterprise-level deployment-ready platform for companies and organizations.

As an operating system kernel, Linux takes care of crucial tasks like process management, memory management, device drivers, file systems, networking, and security. It serves as a bridge between the hardware and software layers, enabling system services and applications to communicate with the underlying hardware resources.

Built on the Linux kernel, RHEL enhances the Linux operating system’s capabilities by incorporating business-class features, security improvements, management tools, and ongoing support. It is frequently utilized in server environments, cloud infrastructure, and other business applications.

Additionally, RHEL supports a broad variety of open-source software packages and tools, giving administrators and developers access to a robust ecosystem for the creation and deployment of applications

It’s crucial to remember that while Linux is the operating system’s foundation, RHEL is the distribution that combines the Linux kernel with other software elements to produce an entire operating system that is appropriate for use in business settings.

The kernel of an operating system is Linux. You may be familiar with UNIX. Linux is, in fact, a copy of UNIX. But Linus Torvalds essentially started from scratch to construct it. Since Linux is free and open-source, you can easily modify it and re-distribute it under your own name! Numerous Linux distributions exist; they are referred to as “distros”.

Linux flavours Name 

Ubuntu Linux
Red Hat Enterprise Linux
Linux Mint
Debian
Fedora
Manjaro
Elementary OS
Zorin
MX Linux
Pop_OS! (from System76)
And ( ETC ) 

Servers primarily utilize Linux. Linux servers are used to power almost 90% of the internet. This is due to Linux’s speed, security, and affordability! The expense of using Windows servers is the biggest issue. Linux servers can be used to resolve this. The Linux kernel also serves as the foundation for Android, the operating system that powers about 80% of smartphones worldwide. The majority of viruses operate on Windows, but not on Linux!

The Linux shell, sometimes known as “Terminal” 

So, in essence, a shell is a program that takes user commands, passes them through to the OS for processing, and then displays the results. Its key component is the Linux shell. Although some of its distributions have a GI (graphical user interface), Linux primarily uses a CLI. We’ll go over the fundamental commands used in the Linux shell in this tutorial.

Linux basic commands 

1. ls Red Hat Enterprise Linux (RHEL) uses the ls command to list the files and directories that are present in a directory. If no directory is supplied, the names of the files and directories in the current working directory are displayed.

The basic syntax of the ls command is:

ls [options] [directory]

The following are a few frequently used ls command options in RHEL:

( 1 ) Ls – l  Detailed information about files and directories is displayed in a long format.
( 2 ) ls -a reveals hidden files (those with a dot in the name).
( 3 ) ls -h Human-readable file sizes.
( 4 ) ls -t Sorts files and folders based on the most recent modification date
( 5 ) ls -r Reverse the listing’s order.
( 6 ) ls -R List the files and directories in every subdirectory.
( 7 ) ls -I Identify each file’s and directory’s inode number.

2. cd: Change the current working directory in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) by using the cd command. You can use it to move about the file system’s various directories

cd [directory]

The following are some crucial details concerning the cd command:

( 1 ) The cd will take you to your home directory if you run it without specifying a directory.
( 2 ) You can specify either an absolute path (beginning with /) or a relative path to get to a specific directory.
( 3 ) An absolute path identifies the full directory path starting at the file system’s root.
( 4 ) The directory path relative to the active working directory is specified via a relative path.

The cd command supports the following special symbols:

. The symbol denotes the current directory.
.. stands for the parent directory (the previous level).
~ The user’s home directory is represented by.

Following are a few instances of how to use the cd command in RHEL:

1 Make a home directory change:

cd

2 Using an absolute path, navigate to a particular directory:

cd /path/to/directory

3 Making use of a relative path, change to a certain directory:

cd relative/directory/path

4 to reach the parent directory, move up one level:

cd ..

5 Navigate to the current directory (helpful if you unintentionally execute cd without any arguments):

cd .

6 The user’s home directory is changed:

cd ~

3. pwd: The pwd command can be used in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) to print the current working directory. It shows you the directory’s absolute path at the moment.

The pwd command’s syntax is straightforward:

Pwd

The full path to the current working directory is output when you use the pwd command.

1. Here is an illustration of how to use the pwd command in RHEL:

pwd

/home/user/Documents

( 1 ) The result in this case shows the working directory’s absolute path as /home/user/Documents. It displays the user’s current location as being in the “Documents” directory.

( 2 ) The pwd command comes in handy when you need to reference the entire path for other commands or scripts or when you want to confirm the current directory.

( 3 ) The pwd command does not accept any parameters, which is a crucial distinction. It only shows the working directory at the moment.4

4. date: The date command in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) is used to display or set the system date and time. It offers details on the time, date, and other relevant parameters as of right now.

( 1 ) The date command provides a number of parameters that let you alter the system date and time or customize the output. Here are a few frequently chosen choices:

( 2 ) -u or –utc: Use Coordinated Universal Time (UTC) rather than the local time zone to display or set the date and time.

( 3 ) -R or –rfc-2822: Show the time and date in RFC 2822 format.

( 4 ) +%format:  Display the time and date in a particular format. For instance, %Y stands for the year, %m for the month, %d for the day, %H for the hour in 24-hour format, %M for the minute, and %S for the second.

Here are a few instances of how to use RHEL’s date command:

1. Show the time and date as of right now:

date

2. The time and date will be shown in UTC:

date -u

3. show the time and date in a particular format:

date "+%Y-%m-%d %H:%M:%S"

5. mkdir: The mkdir command is used in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) to create new directories (folders). With certain names and settings, it enables you to establish one or more directories.

The mkdir command’s fundamental syntax is as follows

mkdir [options] directory_name

( 1 ) The following are some critical details regarding the mkdir command:

( 2 ) Multiple directory names can be specified, separated by spaces, and mkdir will create each one at once.

( 3 ) The mkdir command typically creates folders in the location of the active working directory.

( 4 ) To create folders in a specified area within the file system, you can specify an absolute path.

( 5 ) Use the -p option to create the target directory and any parent directories in the path if they don’t already exist.

Here are a few instances of how to use RHEL’s mkdir command

1. In the directory where you are working, make a single directory:

mkdir directory_name

2. In the current working directory, make a number of directories:

mkdir dir1 dir2 dir3

3 A directory with the given path should be created:

mkdir /path/to/directory

4 If parent directories don’t already exist, create them.

mkdir -p /path/to/new/directory

Remember to substitute the desired name or path for the directory you want to create for directory_name or /path/to/directory.

The ls command can be used to confirm that the directories have been correctly created after running the mkdir command.

6. rmdir:  The rmdir command in Red Hat Enterprise Linux (RHEL)’s command-line interface (CLI) is used to delete empty directories (folders). You can eliminate folders that are empty of files or subdirectories

The rmdir command has the following basic syntax:

rmdir [options] directory_name

( 1 ) The following are key information regarding the rmdir command:

( 2 ) Only empty directories can be deleted with the rmdir command. A directory won’t be erased if it has any files or subdirectories.

( 3 ) The current working directory is where the rmdir command works by default.

( 4 ) To define the location of the directory you want to remove, you can offer an absolute path.

 Here is an illustration of how to use the rmdir command in RHEL:

1. In the current working directory, delete the empty directory:

rmdir directory_name

2. A given path should be used to remove an empty directory:

rmdir /path/to/directory

Always use the correct name or path when replacing directory_name or /path/to/directory with an empty directory that you wish to remove.

An error message stating that the directory is not empty will be displayed if you try to use the rmdir command on a non-empty directory. To remove the directory and its contents recursively in that situation, you might need to run the rm command with the right arguments.

To prevent mistakenly deleting significant files or directories, it is always a good idea to double-check the contents of a directory before executing the rmdir command.

7. mv: The mv command can be used in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) to move or rename files and directories. You can use it to modify the name or placement of a file or directory within the file system.

The mv command’s fundamental syntax is:

mv [options] source destination

The following are some critical details of the mv command:

( 1 ) The file or directory that you want to transfer or rename is represented by source.

( 2 ) destination denotes the new name or intended location for the file or directory.

( 3 ) The source will be relocated into the destination directory if it already exists. The source will be moved and/or renamed appropriately if the destination is a directory that doesn’t exist or has a different name.

( 4 ) To transfer or rename files and directories across various locations in the file system, you can specify absolute paths for both the source and destination.

Following are a few instances of how to use the mv command in RHEL:

1 Change the directory where a file is located:

mv file.txt /path/to/directory/

2 Change a directory’s location and all of its contents:

mv directory /path/to/new/location/

3 rename a directory or file:

mv old_name.txt new_name.txt

4 Moving and renaming a file or directory at the same time:

mv source.txt /path/to/new/location/new_name.txt

Keep in mind to substitute the proper file or directory names and paths according to your requirements for file.txt, directory, old_name.txt, or /path/to.

Additional parameters that can be used with the mv command include preserving file characteristics, forcing overwrites, and showing verbose output. To view all of the options available, use the man mv command in the terminal to access the mv command’s documentation page.

8. cp: The cp command can be used in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) to copy files and directories. You can use it to duplicate files and directories to a different position in the file system or to the same area inside the file system.

The cp command’s standard syntax is

cp [options] source destination

( 1 ) The following are some crucial details of the cp command:

( 2 ) The file or location you want to copy is represented by the source.

( 3 ) The target location where the duplicate will be generated is represented by the destination.

( 4 ) The source will be copied into the destination directory if it already exists. The source will be copied and/or renamed appropriately if the destination is a directory that doesn’t exist or has a different name.

( 5 ) If you want to move files and directories between various places in the file system, you can do so by giving absolute paths for both the source and destination.

Following are a few instances of how to use the cp command in RHEL:

1 A file should be copied to a different directory:

cp file.txt /path/to/directory/

2 Copy the contents of a directory to another directory:

cp -r directory /path/to/new/location/

Note: To copy folders and their contents recursively, use the -r option.

3 Renaming a file after a copy has been made:

cp old_name.txt new_name.txt

4 Copying a file or directory while keeping its permissions and timestamps intact:

cp -a source destination

Note: To maintain file attributes, use the -a option.

Keep in mind to substitute the proper file or directory names and paths according to your requirements for file.txt, directory, old_name.txt, or /path/to.

Additional parameters for the cp command include maintaining links, forcing overwrites, and displaying verbose output, among other things. Man cp can be used in the terminal to investigate all of the options available by referring to the cp command’s documentation page.

9. touch:  The touch command in the command-line interface (CLI) of Red Hat Enterprise Linux (RHEL) is used to create new files or change the timestamp of existing files. Empty files can be created or the access and modification times of existing files changed often.

The touch command’s basic syntax is as follows:

touch [options] file_name

The following are some significant details concerning the touch command:

( 1 ) The touch command creates a brand-new, empty file with the supplied file_name if it doesn’t already exist.

( 2 ) The touch command adjusts the access and modification timestamps of the file to the current time by default if the file_name already exists.

( 3 ) The touch command by default adds or modifies a single file’s timestamp.

( 4 )To simultaneously create or update the timestamps of several files, you can use multiple file_name parameters.

Listed below are a few instances of how to use the touch command in RHEL:

1 Make a fresh, blank file:

touch file.txt

2 Put the most recent time in an existing file’s timestamp:

touch existing_file.txt

3 Make a number of blank files:

touch file1.txt file2.txt file3.txt

4 Add the current time to the timestamps of numerous existing files:

touch file1.txt file2.txt file3.txt

Keep in mind to substitute file.txt, existing_file.txt, or file1.txt, file2.txt, and file3.txt with the appropriate file names to meet your needs.

A precise timestamp can be specified, file characteristics can be adjusted, and verbose output can be displayed using additional options that are included with the touch command. The command man touch in the terminal can be used to investigate all of the options available by referring to the manual page for the touch command.

10. find Using a variety of criteria, the find command in Red Hat Enterprise Linux (RHEL) can be used to search for files and directories inside a directory hierarchy. With the use of criteria like name patterns, file kinds, sizes, timestamps, and more, you may find files and folders that meet your requirements.

The find command’s fundamental syntax is as follows:

find [path] [options] [expression]

( 1 ) What you should know about the search command includes the following:

( 2 ) The search’s initial directory is represented by [path]. The current directory is used as the starting point if none is provided.

( 3 ) [Options] offer other search settings, including restricting the depth, omitting specific directories, or regulating the output format.

( 4 ) [expression] gives the search parameters or the operations to be carried out on the files and directories that are found.

The search command in RHEL can be used in the following situations:

1. In the current directory and its subdirectories, look for files with a certain name:

find . -name "filename.txt"

2. Search for directories bearing a particular name and remove them (use with caution):

find . -type d -name "directory_name" -exec rm -r {} \;

3. Get files that are bigger than a certain size:

find /path/to/search -type f -size +1M

4 Search for files edited within a certain time frame:

find /path/to/search -type f -newermt "2022-01-01" ! -newermt "2022-12-31"

Keep in mind to substitute the appropriate numbers or patterns for filename.txt, directory_name, /path/to/search, or the date range to meet your needs.

With the find command, you may narrow down your search using a variety of arguments and phrases. The logical operators (-a, -o, and!) allow you to combine several expressions and carry out sophisticated searches. For more information on all of the available options and phrases, use the man find command in the terminal.

11 .tar: When using the command-line interface (CLI) in Red Hat Enterprise Linux (RHEL), the tar command is used to generate and modify archive files. It is frequently used to extract or list the contents of preexisting archive files as well as combine numerous files and folders into a single archive file.

In addition to archive operations, the tar command supports a number of compression techniques, including gzip (*.tar.gz), bzip2 (*.tar.bz2), and xz (*.tar.xz).
The tar command’s fundamental syntax is as follows:

tar [options] archive_file files/directories

( 1 ) The tar command has the following key information that you should be aware of:

( 2 ) The name of the archive file that is going to be generated or modified is represented by the archive_file argument. It can have extensions that match the compression scheme being used (such as.tar.gz,.tar.bz2, or.tar.xz), or it can only have the extension.tar for an uncompressed archive.

( 3 ) The parameter files/directories represent the directories or files that should be included in the archive. By separating them with spaces, you can specify the number of files and directories.

( 4 ) The tar command can generate, extract, or update archive files depending on the operation and arguments chosen.

Here are some instances of how to use the tar command in RHEL:

1 Compress data into an archive:

tar -czvf archive.tar.gz file1.txt file2.txt directory/

File1.txt, File2.txt, and the directory/ directory are all created in a compressed archive file called archive.tar.gz by this command.

2 Take files out of an archive:

tar -xzvf archive.tar.gz

The archive.tar.gz file’s contents are extracted with this command and placed in the current directory.

3 An archive’s contents are listed below:

tar -tvf archive.tar.gz

A thorough list of the files and folders found in the archive.tar.gz file is displayed by this command.

Keep in mind to change directory/, file1.txt, file2.txt, and archive.tar.gz to the actual names of the files and directories you wish to generate, extract, or modify.

The tar function offers a variety of options for working with archives, choosing compression ratios, maintaining file permissions, and more. Use the man tar command in the terminal to view the tar command’s manual page and explore all of your choices.

12. When using Linux, the “unzip” tool is used to extract files from ZIP archives. It enables you to unzip a ZIP file and extract its contents into a chosen location.

The “unzip” command’s fundamental syntax is as follows:

unzip [options] zipfile.zip [-d destination_directory]

The ZIP archive you want to extract is called “zipfile.zip” in this case. “-d destination_directory” is an optional flag that defines the directory where you want the files to be extracted. The “options” are additional flags you can use to change the behavior of the command. The files will be extracted into the currently active working directory if the destination directory is not specified.

Following are a few often-used options for the “unzip” command:

( 1 ) List the ZIP archive’s contents without extracting them with the -l option.

( 2 ) -o: Replace existing files automatically without asking.

( 3 ) Quiet mode, or -q. Suppress the extraction’s output.

( 4 ) -d: Indicate the location of the files that will be extracted.

Example of use

1 Get every file out of a ZIP archive:

unzip myfile.zip

2 A ZIP archive’s contents should be extracted into a specific directory:

unzip myfile.zip -d /path/to/destination/

3 Give a list of a ZIP archive’s contents:

unzip -l myfile.zip

These are but a handful of instances of how to employ the “unzip” command. Using the “man unzip” command, you can see the command’s documentation page to learn more about your options.

13. alias  A custom shortcut or shorthand for a lengthier or more complex command can be created in Linux using an alias. You can create your own command names or change the names of already existing commands to make them simpler to recall or type. In essence, an alias is a mapping between a unique name and the command or group of instructions it stands for.

Use the “alias” command, followed by the desired alias name and the command or commands it should represent, to define an alias. Here is the fundamental syntax:

alias alias_name='command'

Here, “alias_name” is the name you wish to give the alias, and “command” is the command itself or a group of commands you want to link to the alias. The command(s) may contain any legal shell syntax, including arguments, pipes, and options.

For instance, suppose you wish to make a shorter alias for the “ls -l” command, which displays a full list of files. An alias can be defined as follows:

alias ll='ls -l'

Now, the “ls -l” command will be run anytime you type “ll” in the terminal and press Enter. This can help you save time and use the command line more effectively.

In order to maintain them between sessions, aliases are often defined in the shell’s configuration files, such as “/.bashrc” or “/.bash_profile”. As soon as an alias is created, you can use it in the current terminal session. Make sure to include the alias definition in the relevant configuration file, though, if you want the alias to be accessible in each new terminal session.

You can use the “alias” command without any arguments to obtain a list of the aliases that are currently defined:

alias

A list of aliases and their definitions will then be shown.

It’s crucial to remember that aliases are unique to the shell you’re currently using. You might need to modify your aliases in the configuration file of the new shell if you transition from one shell to another (for example, from Bash to Zsh).

14 cat: The “cat” command, which stands for “concatenate,” is used largely in Linux to display a file’s contents or to concatenate multiple files and display their contents simultaneously. It is a straightforward command that can be used in a variety of situations.

The “cat” command’s fundamental syntax is as follows:

cat [options] [filename]

The name of the file you want to show or concatenate is referred to as the “filename” in this case. To concatenate and show multiple filenames with their contents combined, separate the filenames by spaces. Without a filename, “cat” will read data from standard input, which is often the keyboard.

The cat command is frequently used for things like:

1 presenting a file’s content:

cat filename

2 combining many files together and showing their contents:

cat file1 file2

3 Use input from the terminal to create a new file or replace an existing one:

cat > filename

By doing so, you can type the contents of the file, and hit Ctrl + D ends the input.

4 Adding terminal input to a file that already exists:

cat >> filename

By doing this, you can add content to an existing file.

These are but a handful of applications for the cat command. It can be used with other commands to carry out more complicated actions and supports a number of options. If you’d like more information on the usage and options of the cat command, you may look them up in the manual by typing man cat in the terminal.

15. tail In Linux, the tail command is a command-line tool that is used to show the last few lines of a file or to continually check a file for newly added lines. When looking through recent additions to a file, such as log files, it is especially helpful.

The tail command is generally used as follows:

tail [options] [file(s)]

In this case, [file(s)] stands for the name(s) of the file(s) you want to display, and [options] refers to the numerous command arguments that change the behavior of the tail command.

The tail command is frequently used for things like:

1 displaying a file’s latest 10 lines (the default setting):

tail filename

2 displaying a set amount of lines from a file’s end:

tail -n <number-of-lines> filename

The last 20 lines of the file will be shown, for instance, when the tail -n 20 filename is used.

3 checking a file for new lines continuously (like the tail -f command):

tail -f filename

This will run the command continually, updating the output when new lines are added to the file, and display the most recent 10 lines of the file. Real-time log file monitoring is frequently done using it.

These are only a few uses of the tail command. It offers a lot of options, including the ability to display lines in reverse order, a specific number of bytes, and more. If you want full information on the usage and options of the tail command, type man tail in the terminal.

16. grep Linux has a robust command-line tool called grep that can be used to look for particular regular expressions or patterns in files or the output of other programs. The acronym GRE Print means “global regular expression print.”

The grep command is generally used as follows:

grep [options] pattern [file(s)]

Here, pattern denotes the text or regular expression you want to search for, [options] denotes the numerous command options that change the behavior of the grep command, and [file(s)] denotes the name(s) of the file(s) you wish to search within. Grep will search the standard input (such as the output of another command) if no files are given.

The grep command is frequently used for things like:

1 Finding a certain pattern in a file:

grep "pattern" filename

The given file will be searched for the specified pattern, and all matching lines will be displayed.

2 Finding a trend across several files:

grep "pattern" file1 file2

In both file 1 and file 2, the pattern will be looked for, and the matching lines and accompanying file names will be displayed.

3 Recursively searching directories

grep -r "pattern" directory

All files in the specified directory and its subdirectories will be searched for the pattern.

4 Without regard to the case:

grep -i "pattern" filename

A case-insensitive search will be conducted using this, disregarding the difference between capital and lowercase letters.

5 Regular expressions usage

grep -E "regex-pattern" filename

By enabling extended regular expressions, more intricate pattern matching is made possible.

These are only a few applications of the grep command. To execute more complex searches and manipulations, it provides a number of arguments and can be used in conjunction with other commands. By running man grep in the terminal, you may see the grep command’s manual page for further information on its usage and its options.

17 echo: Linux comes with a command-line tool called echo that can be used to show a line of text or the value of a variable on the terminal. It can be used interactively at the terminal, although it is typically used for printing messages or showing data within shell scripts.

The echo command can be used in the following ways.

echo [options] [text or variables]

In this case, [options] refers to the numerous command parameters that change how the echo command behaves, and [text or variables] stands for the text or variables whose values you want to display.

The echo command is frequently used for things like:

1 showing one line of text

echo "Hello, world!"

This causes the terminal to print the text that is supplied.

2 Putting a variable’s value on display:

my_var="Hello, world!"
echo $my_var</pre>

This will display “Hello, world!” as the value of the variable my_var.

3 Multiple lines of text displayed:

echo "Line 1"
echo "Line 2"

By doing this, the terminal will print each line of text separately.

4 removing the final newline after a line break:

echo -n "Hello"

The newline character is not displayed at the conclusion when the -n option is used, allowing you to continue on the same line.

These are only a few applications of the echo command. It provides a number of options, like enabling backslash escape interpretation, managing output formatting, and more. If you want full information on the usage and options of the echo command, type man echo into the terminal.

18 .chown  Change the ownership of files and directories in RHEL (Red Hat Enterprise Linux) by using the chown command. “Chown” is an acronym for “change owner.” It enables you to change a file or directory’s user and group ownership.

The chown command has the following basic syntax:

chown [OPTIONS] USER[:GROUP] FILE...

The following are the command’s essential elements:

( 1 ) The new owner of the file or directory is specified by USER. A username or a numerical user ID are both acceptable.

( 2 ) Names the new group that will be the owner of the file or directory in GROUP (optional). It might be a group name or a group ID, just like the user.

( 3 ) FILE: Indicates which file or directory the ownership change will affect. Multiple files or folders can be specified, with spaces separating them.

The following are some frequently used chown command options:

( 1 ) Changes ownership recursively, affecting all files and directories inside the specified directory, using the option -R or –recursive.

( 2 ) -v or –verbose: Shows descriptive output that details the modifications the command made.

( 3 ) Similar to the -v option, the -c or –changes option only shows the output for files whose ownership has changed.

Several uses for the chown command are shown below:

1 Changing a file’s owner:

chown john myfile.txt

2 Recursively modify a directory’s owner and group:

chown -R john:users mydir/

3 Multiple files can have their owners and groups changed:

chown user1:group1 file1.txt file2.txt

Keep in mind that administrative privileges are often needed to use the chown command.

19. chmod:  The permissions (access rights) of files and directories can be changed in RHEL (Red Hat Enterprise Linux) by using the chmod command. “Chmod” is an acronym meaning “change mode.” You may manage who has access to a file or directory and who can read, write, and execute code.

The chmod command’s basic syntax is as follows:

chmod [OPTIONS] MODE FILE...

( 1 ) The permissions to be set are specified by MODE. It might be formulated numerically or symbolically

( 2 ) The file or directory whose permissions are being altered is specified by the FILE keyword. Multiple files or folders can be specified, separated by spaces.

There are two ways to display the permissions:

1. Symbolic Mode: In the symbolic mode, permissions are represented by letters that both identify the type of permission and the user or group they apply to. The used letters are

( 1 ) g: Group
( 2 ) u: User (owner)
( 3 ) a: All (equivalent to u+g+o)
( 4 ) o: Other (everyone else)

( 1 )  The following letters stand in for the different types of permissions:

(1 ) r: Read
( 2 ) w: Write
( 3 ) x: Execute

( 2 ) The following symbols can be used in symbolic mode to give or revoke permissions:

( 1 ) +: Adds the specified permission
( 2 ) -: Removes the specified permission
( 3 ) =: Sets the specified permission and removes all others

code is written in bash

chmod ug=rw,o=r myfile

2. Numeric Mode: The numeric mode uses a three-digit octal number to denote the permissions. The permissions for the owner, group, and others are each represented by a different numeral. By adding the values for the desired permissions, the digits can be calculated:

( 1 ) Read (r): 4
( 2 ) Write (w): 2
( 3 ) Execute (x): 1

For instance, you may use the following to grant the owner read and write access while granting others only read permission:

code is written in bash

chmod 644 myfile.txt

The following are some frequently used chmod command options:

( 1 ) R or –recursive: Recursively modifies permissions for all files and folders inside the specified directory

( 2 ) -v or –verbose: the command’s modifications are displayed in detail in the output.

( 3 ) -c or –changes: Similar to the -v option, but only shows the output for files with modified permissions.

It’s important to keep in mind that the chmod command often needs administrative rights.

20 umask: For freshly created files and directories in RHEL (Red Hat Enterprise Linux), the umask command is used to specify the default file permissions. The word “umask” is an acronym for “user file creation mask.” It is a four-digit octal number that represents the rights that should be removed from newly created files’ default permissions.

The umask command often has the following syntax:

umask [options] [mask]

Here, [mask] provides the file permission mask you want to configure, and [options] depicts several command arguments that can be used with the umask command. The current umask value is shown if the [mask] option is left out.
An octal four-digit number serves as the representative for the file permission mask. The authorization bits for the owner, group, and others are assigned to each digit, correspondingly. Each digit can have a value between 0 and 7, with 0 denoting full permission (read, write, and execute) and 7 denoting no authorization.

The significance of each digit is broken down below:

( 1 ) The file owner’s (user’s) permissions are represented by the first digit.

( 2 ) The file’s group owner’s permissions are represented by the second digit.

( 3 ) Users who are neither the owner nor a member of the group have their permissions represented by the third digit.

Subtract the chosen digit from 7 to determine the total permit. The default permissions for newly generated files are 644 (666 – 022) and for directories are 755 (777 – 022), for instance, if the umask value is 022.

Note: The default permissions for new files and directories are the only ones that the umask command changes. Existing files and folders’ permissions are not changed by it.

For further information and thorough usage examples unique to your version of RHEL, consult the umask man page (man umask).

 

24 May 2023

How to managing Process Management OS

What is the Process of Management

A process is an action that takes place when a program is run. Any procedure needs computer resources to be performed.

The operating system must effectively manage all of these processes and resources since the computer system can run multiple processes at once, each of which uses the same resource.

In order to preserve consistency in the system, some resources must be used by a process all at once. If this does not occur, the system may experience deadlock and inconsistent behavior

Through actions like resource allocation and process scheduling, the operating system is able to carry out these processes. The CPU (Central Processing Unit) is utilized by a process when it runs on a computer device’s memory. The operating system is responsible for coordinating the computer’s many processes…

A process has a collection of executable instructions that we refer to as process code. The resources needed for the execution of this data are referred to as Process Components since certain data is also related to the process that is being used.

Process management execution

In process management, the following duties are carried out:-

( 1 ) Scheduling CPU threads and processes.:-
( 2 ) It functions to add and remove user- and system-level processes.
( 3 ) The system’s running processes are paused and then resumed.
( 4 ) It offers a system for synchronizing processes.
( 5 ) Additionally, this method offers a communication mechanism.

When a program is loaded into memory, it becomes a process and may be broken down into the following four components:-

 

Process:- A process is a running instance of a launched, executable program.
A process consists of:-
➢ An address space of allocated memory.
➢ Security properties including ownership credentials and privileges.
➢ One or more execution threads of program code.
➢ Process state

The environment process includes:-

➢ Local and Global variables.
➢ A current scheduling context.
➢ Allocated system resources, such as file descriptors and network ports.

How to Find the Process State

Using the top command is the simplest technique to determine the condition of the process. This command displays the top processes that are currently active along with a few columns by default. In the “S” column, the state is typically represented by one character. Additionally, the ps command is available. Based on the criteria you pass it using flags, this will show processes. Depending on the data you wish to view, it accepts a few different flags. “ps aux” is the typical one.
Although you should always consult the man pages for your distribution and specific commands, the following are the most typical mappings of character to state.

Linux process States:-

 

( 1 ) R (running):- TASK_RUNNING
( 2 ) S (sleeping):- TASK_INTERRUPTIBLE
( 3 ) D (sleeping):- TASK_UNINTERRUPTIBLE
( 4 ) K (sleeping):- TASK_KILLABLE
( 5 ) I (sleeping):- TASK_REPORT_IDLE
( 6 ) T (stopped):- TASK_STOPPED
( 7 ) T (stopped):- TASK_TRACED
( 8 ) Z (zombie):- EXIT_ZOMBIE
( 9 ) X (zombie):- EXIT_DEAD

( 1 ) R (running):- TASK_RUNNING
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

( 2 ) S (sleeping):- TASK_INTERRUPTIBLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

A well-coded program enters the INTERRUPTABLE_SLEEP state as it waits for this. A process can be quickly and trouble-free terminated in this state. When a process enters this state while awaiting input, it might step aside and allow other processes to receive CPU time. Circulating through CPU time would be a waste of resources.

( 3 ) D (sleeping):- TASK_UNINTERRUPTIBLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state.

( 4 ) K (sleeping):- TASK_KILLABLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

( 5 ) I (sleeping):- TASK_REPORT_IDLE
TASK_REPORT_IDLE: A subset of state D. The kernel does not count
these processes when calculating load average. Used for kernel threads.
Flags TASK_UNINTERRUPTABLE and TASK_NOLOAD are set. Similar to
TASK_KILLABLE, also a subset of state D. It accepts fatal signals.

( 6 ) T (stopped):TASK_STOPPED
TASK_REPORT_IDLE: A subset of state D. The kernel does not count
these processes when calculating load average. Used for kernel threads.
Flags TASK_UNINTERRUPTABLE and TASK_NOLOAD are set. Similar to
TASK_KILLABLE, also a subset of state D. It accepts fatal signals.

( 7 ) T (stopped):- TASK_TRACED
ASK_TRACED: A process that is being debugged is also temporarily
Stopped and shares the same T-state flag.

( 8 ) Z (zombie):- EXIT_ZOMBIE
EXIT_ZOMBIE: A child’s process signals to its parent as it exits. All resources
except for the process identity (PID) released.

( 9 ) X (zombie):- EXIT_DEAD
EXIT_DEAD: When the parent cleans up (reaps) the remaining child process
structure, the process is now released completely. This state will never be
observed in process-listing utilities.

Basic Command

1. /proc/cpuinfo:-  This file basically serves as a repository for the machine’s current resources.

[root@server ~]# vim /proc/cpuinfo

2. ps:- Typically, the ps command is used to display the OS on the machine’s active processes.

[root@server ~]# ps

3. ps aux:- Different display formats are used for processes

[root@server ~]# ps aux

4. ps lax:- Processes are displayed in different formats.

[root@server ~]# ps lax

5. ps -ef:- Processes are displayed in different formats.

[root@server ~]# ps ef

6. pstree:- Is employed to present a process as a tree.

[root@server ~]# pstree

 

7. pstree -p | grep firefox:- To find the Firefox processes in the process tree structure

[root@server ~]# pstree -p | grep firefox

Running Firefox 

8. Sleep:- In order to establish a fake job, use the sleep command. The execution can be delayed by using a dummy task. By default, it measures time in seconds, but you can change the format by including a tiny suffix (s, m, h, or d) at the end. This command pauses the process for the duration specified by NUMBER.

sleep NUMBER[SUFFIX]...

Note: The sleep command will delay the sum of the values if you declare more than one NUMBER with it.
the options offered by the sleep command

➢  Sleep –help:- It provides assistance information.

[root@server ~]# sleep --help
Usage: sleep NUMBER[SUFFIX]...
or: sleep OPTION
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days. NUMBER need not be an
integer. Given two or more arguments, pause for the amount of time
specified by the sum of their values.

--help display this help and exit
--version output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/sleep>
or available locally via: info '(coreutils) sleep invocation

➢ -version:– Version information is shown.

[root@server ~]# sleep --version

 

9.top:- In Linux operating systems, the top command is a frequently used tool that offers real-time resource monitoring. It presents a live, interactive view of system processes and how much resource each one is using. The top is frequently used to examine system performance, spot resource-hungry programs, and keep tabs on a Linux system’s general health.
The top command in a terminal displays a table-like interface with numerous columns that include data on various system components when you run it. You might see a few of the important columns, such as:

( 1 ) PID (Process ID): A special identification number is given to each active process.
( 2 ) USER: The user account that the process is currently operating as.
( 3 ) PR (Priority): The process’s priority.
( 4 ) The “niceness” of the process, which affects its priority, is referred to as NI (Nice value).
( 5 ) Virt (Virtual Memory): The total amount of virtual memory a process is using.
( 6 ) The process’s non-swapped physical memory is known as RES (Resident Memory).
( 7 ) SHR (Shared Memory): The process’s shared memory.
( 8 ) CPU%: The process’s share of total CPU utilization.
( 9 ) MEM%: The process’s percentage of memory (RAM) consumption.
( 10 ) TIME+: The total amount of CPU time that the process has used.

In addition to these columns, the top of the display includes data on system-wide CPU consumption, memory usage, uptime, and other pertinent metrics.
By pressing different keys, you can interact with the top in real time and do numerous tasks. For instance, hitting ‘k’ will allow you to signal processes, ‘f’ will let you select which columns to display, and ‘q’ will stop the top command.
Remember that the top needs root or superuser access to display details about all running processes.

Press->h (Help):- Pressing the h key displays all top command-related choices

Renice the processes:- Using the top command

 

10. kill:- When a process is running on the system, the “kill” command in Linux can be used to signal its termination or take other actions. Although its main usage is to terminate processes, it can also be used to deliver additional signals to processes for a variety of purposes.
The “kill” command’s basic syntax is as follows:

kill [options] <PID>

The process ID of the process you want to target is shown below as PID>. The “ps” command or other process monitoring tools can be used to locate the process ID.
By default, the termination signal (SIGTERM) is sent to the specified process when you execute the “kill” command without providing a signal. This enables the process to carry out any necessary cleanup procedures prior to ceasing.
With the “-” option, you can, however, optionally specify different signals. For instance, the “-9” option is frequently used to SIGKILL (forcefully terminate) a process. The SIGKILL signal kills the process immediately and cannot be caught or disregarded by the process.

[root@server ~]# top

An illustration of how to end a process with process ID 909 is as follows:

[root@server ~]# kill 909

Renice the processes:- Using the top command

Set signal on processes:- Using the top command

 

 

 

11 May 2023

How to install MariaDB and use MariaDB redhat

History of MariaDB Foundation

The foundation that will direct MariaDB’s development was announced in December 2012 by Michael Widenius, David Axmark, and Allan Larsson.

The Foundation wanted to develop a governance structure that was akin to the Eclipse Foundation’s when it was founded in 2013. Mike Milinkovich, executive director of the Eclipse Foundation, was chosen by the board to serve as an advisor throughout the changeover.

After initial agreements on the allocation of ownership and functions between the MariaDB Foundation and MariaDB Corporation, MariaDB Corporation Ab became the first sponsor member of the MariaDB Foundation in 2014. For instance, MariaDB is a registered trademark of MariaDB Corporation Ab and is used by MariaDB under license.

Foundation. Originally established in 2010 as SkySQL Corporation Ab, MariaDB Corporation Ab changed its name in 2014 to better reflect its position as the primary force behind the development of the MariaDB server and the largest support provider for it. Simon Phipps, the CEO of the Foundation at the time, resigned in 2014 when SkySQL purchased the MariaDB trademark. Later, he claimed: “I left as soon as it became clear that the company would not permit an independent foundation.”

The Foundation’s CEO from April 2013 to 2014 was Simon Phipps. The CEO from January 2015 to September 2018 was Otto Kekäläinen. Arjen Lentz served as the Foundation’s CEO from October 2018 until his resignation in December of that same year. On February 1st, 2019, Kaj Arnö began serving as CEO. The board’s current chairman is Eric Herman.

This guide will demonstrate how to install MariaDB on RHEL 8. 9.  version

A fork of MySQL, MariaDB is a free and open-source Relational Database Management System (RDBMS). It is a well-known database server in the developer community and is in heavy use. MariaDB has established itself as one of the top SQL databases in the market, with users ranging from novices to intermediate and advanced database administrators.

This tutorial will show you how to set up MariaDB on RHEL 9. The community version, which is available for free download and usage, will be installed.

Install MariaDB 


Step 1: AppStream’s official repositories offer MariaDB Server. This may be verified by performing the following repository search for the package:

[root@server ~]# yum install mariadb-serverc

Step 2: check the version of MariaDB

[root@server ~]# mariadb --version

Step 3:  Start the MariyaDB service

[root@server ~]# systemctl start mariadb.service

Step 4:  of this command  ” enable”  automatically boot time. start  MariyaDB service

[root@server ~]# systemctl enable mariadb.service

Step 5: Check service running

[root@server ~]# systemctl status mariadb.service

MariaDB Secure installation on RHEL 9

Step 1: MariaDB, just like MySQL is the default. secure Therefore, you must take another step and run the mysql_secure_installation script.

You are guided through a series of prompts by the Running command. You will need to create a root password first. The default root user unix socket authentication in MariaDB is insufficiently secure.

So, decline from using the Unix socket authentication by pressing  ” n ” and hitting

[root@server ~]# mysql_secure_installation

Enter current password for root (enter for none):  [Press Enter] 

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

Your root account is protected, so you can safely answer ‘n’.

Switch to unix_socket authentication [Y/n]   [Press ” n ” Enter ] 

Change the root password? [Y/n]    [ Press ” y ” Enter ]

New password:                                   [ highsky@123 ]
                                         

Re-enter new password: Re-enter password  [ highsky@123 ]

Password updated successfully!
Reloading privilege tables.
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]        [ Press ” y ” Enter ] 
.. Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]   [ Press ” y ” Enter ]
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]  [ Press ” y ” Enter ]
– Dropping test database…

… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]   [ press ” y ” Enter ] 
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Successful Secure installation

Create MariaDB Database 

Step 1: Log in now back to the MariaDB server and authenticate with the password you configured.

[root@server ~]# mysql -u root -p

Enter password:  Enter your root password

Step 2: Create a test database. Here, we are going to name it highsky_db

MariaDB [(none)]> CREATE DATABASE highsky_db;

Query OK, 1 row affected (0.001 sec) 

Step 3: Create a local host user name ” Harry ” used. password ” password “with your own strong password.

MariaDB [(none)]> CREATE USER Harry@localhost IDENTIFIED BY "password";

Query OK, 0 rows affected (0.009 sec)

Step 4: Grant privileges to the database user on the database.

MariaDB [(none)]> GRANT ALL ON highsky_db.* TO harry@localhost;

Query OK, 0 rows affected (0.003 sec)

Step 5: Flush privileges and exit the MariaDB console.

MariaDB [(none)]> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.001 sec)

Step 6: Exit

MariaDB [(none)]> exit

Step 7: to list the databases, run the command

MariaDB [(none)]> SHOW DATABASES;

Step 8:  list all the users created

 

MariaDB has been installed successfully.

04 May 2023

How To Install phpMyAdmin on RHEL 8 .9

Do you need all this service

httpd  web Serve ( Apache )
PHP
MARIYADB
phpMyAdmin

Install and Configure phpMyAdmin on RHEL 8.9

Install Apache Web Server make sure that you have a web server installed on your system. Apache is the most commonly used web server on Linux systems. You can install it using the following

Step 1: httpd service

[root@server ~]# yum install httpd -y

Step 2: Use of this command  ” enable ”  automatically boot time. start httpd service

[root@server ~]# systemctl enable httpd.service

Step 3: Stop the running httpd service and immediately start it again –

[root@server ~]# systemctl restart httpd.service

Step 4: Check service running

[root@server ~]# systemctl status httpd.service

Install PHP service

 

Step 1: phpMyAdmin is written in PHP and you’ll need it installed on your RHEL server. yum install

 

[root@server ~]#  yum install php -y
[root@server ~]# yum install php-zip php-json php-fpm -y

Step 2: Ensure the PHP-MySQL extension is installed.

[root@server ~]# yum install php-mysqlnd -y

Step3: Start and enable FPM service

[root@server ~]# systemctl enable --now php-fpm -y

Install MariaDB/MySQL Database Server

The next step is to install the MariaDB/MySQL database server. Follow the guides below to install MariaDB or MySQL on RHEL 8.

Installing MariaDB on RHEL 8 using the yum command

Step 1: Installing the MariaDB on RHEL 8, type:

[root@server ~]# yum install mariadb-server

Step 2: Securing the MariaDB server in  run

[root@server ~]# mysql_secure_installation

Step 3: Finally test your installation by running

[root@server ~]# mysql -u root -p

Step 4:  How to enable mariadb. service at  boot time

[root@server ~]# systemctl enable mariadb.service

Step 5:   Start/stop/restart mariadb. service on

[root@server ~]# systemctl start mariadb.service
[root@server ~]# systemctl restart mariadb.service
[root@server ~]# systemctl status mariadb.service

Install phpMyAdmin on RHEL 8.9

Step 1: Download the file to your local system

[root@server ~]# wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz

Step 2: Extract downloaded
class=”wp-block-code”>

[root@server ~]# tar xvf phpMyAdmin-latest-all-languages.tar.gz

Step 3: mv (Move) the folder

[root@server ~]# mv phpMyAdmin-*/ /usr/share/phpmyadmin

Step 4: Create the directory for phpMyAdmin temp files.

[root@server ~]# mkdir -p /var/lib/phpmyadmin/tmp
[root@server ~]# chown -R apache:apache /var/lib/phpmyadmin

Step 5: Create the directory for phpMyAdmin configuration files such as pass file.

[root@server ~]# mkdir /etc/phpmyadmin/

Step 6: Create a phpMyAdmin configuration file

[root@server ~]# cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

Step7: Edit files

[root@server ~]#vim /usr/share/phpmyadmin/config.inc.php

Step 8: Needs to be 32 chars long

$cfg['blowfish_secret'] = 'H2OxcGXxflSd8JwrwVlh6KW6s2rER63i';

Step 9: Add Configure the Temp directory

$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

Step 10: Create the phpMyAdmin Apache configuration file.

[root@server ~]# vim /etc/httpd/conf.d/phpmyadmin.conf
# Apache configuration for phpMyAdmin
Alias /phpMyAdmin /usr/share/phpmyadmin/
Alias /phpmyadmin /usr/share/phpmyadmin/

<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all granted
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 192.168.65.128
     Allow from ::1
    </IfModule>
 </Directory>

Then can restrict access from specific IPs by adding lines like the below  ( your IP )

Step 11: Validate httpd configuration

[root@server ~]# apachectl configtest

Syntax OK

Step 12: Then httpd service restart

[root@server ~]# systemctl restart httpd

 SELinux and Firewall Configure

Step 1: access the phpMyAdmin page. Allow httpd to serve content in the phpmyadmin directory.

[root@server ~]# semanage fcontext -a -t httpd_sys_content_t "/usr/share/phpmyadmin(/.*)?"

Step 2: This command Apply the policy by running

[root@server ~]# restorecon -Rv /usr/share/phpmyadmin

Step 3: Allow http service in the firewall.

[root@server ~]# firewall-cmd --permanent--add-service=http

Step 4: Firewall reload

[root@server ~]# firewall-cmd --reload

Access  Web interface phpMyAdmin on RHEL 8.9
Open the URL and Check
http://192.168.65.128/phpmyadmin/
http://server.example.com/phpmyadmin/

 

WhatsApp chat