RHEL 8 – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 20 Apr 2022 12:38:31 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Install PostgreSQL Server on CentOS 8 https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/ https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/#respond Sun, 10 Nov 2019 17:14:01 +0000 https://tecadmin.net/?p=19513 PostgreSQL is an object-relational database management system that stores data in the form of tables. It is highly secure and reliable and allows for easy storage, access, and retrieval of data. The pgAdmin is a feature-rich web-based interface for the administration, development, and management of PostgreSQL. It is also an open-source, free software just like [...]

The post How To Install PostgreSQL Server on CentOS 8 appeared first on TecAdmin.

]]>
PostgreSQL is an object-relational database management system that stores data in the form of tables. It is highly secure and reliable and allows for easy storage, access, and retrieval of data.

The pgAdmin is a feature-rich web-based interface for the administration, development, and management of PostgreSQL. It is also an open-source, free software just like PostgreSQL.

In this how-to guide we will learn to install PostgreSQL and pgAdmin4 on CentOS 8:

How to Install PostgreSQL on CentOS 8

01. Multiple versions of PostgreSQL are available in a default repository of CentOS 8. They can be listed on the terminal by using the below-given command:

dnf module list postgresql 
CentOS 8 Check Postgres Repository
List available Postgres DNF modules

There are four different versions available in the AppStream repository on my system. The [d] after the PostgreSQL version 10 indicates that version 10 is the default version of PostgreSQL.

02. By default it will install PostgreSQL 10 on your system. We can install any other version on our CentOS 8 system as well. To install any other version we will first need to reset the already installed module stream:

sudo dnf module reset postgresql -y 

03. Now we will enable the module stream of the latest PostgreSQL version:

sudo dnf module enable postgresql:13 -y 

04. Now run the installation command again. The terminal will now install the latest version i.e. version 13:

sudo dnf install postgresql-server -y 

Installing PostgreSQL on CentOS 8

05. You can verify the installed version by using the below-given command:

 postgres --version 
Output:
postgres (PostgreSQL) 13.3

06. Now that the latest version of PostgreSQL has been installed, initialize it by using the below-given command:

sudo postgresql-setup initdb 

PostgreSQL Initdb on CentOS 8

07. You can start the database by running the command:

sudo systemctl start postgresql 

08. The PostgreSQL can also be enabled to automatically start at the boot:

sudo systemctl enable postgresql 

09. You can check the status of the service by using this command:

sudo systemctl status postgresql 

how to install PostgreSQL on CentOS 8

10. You can also check whether the service has been successfully enabled to start at the boot:

sudo systemctl is-enabled postgresql 

How to Install PostgreSQL on CentOS 8

How to Install pgAdmin4 in CentOS 8

01. Now we will install pgAdmin4, the web-based PostgreSQL database management tool. To install pgAdmin4 we first need to install the EPEL repository:

sudo dnf install epel-release 

02. Next, we will install a pgAdmin repository to resolve the dependencies:

sudo dnf install -y https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-1-1.noarch.rpm 

03. In order to install the pgAdmin4 on our system we will also need to remove some PostgreSQL repositories:

sudo dnf remove -y pgdg-redhat-repo 

This repository has already been uninstalled from my system.

04. Now we will make a cache for pgAdmin4 by executing the below-given command:

sudo dnf makecache 

05. We can finally install pgAdmin4 on our system as all the dependencies have been resolved:

sudo dnf install pgadmin4 

How to Install pgAdmin4 on CentOS 8

Press y and hit Enter whenever prompted to do so:

The pgAdmin4 has been successfully installed on the system.

06. The next step is to set up pgAdmin4. This can be done by opening the configuration file that comes with the pgAdmin4 package:

sudo /usr/pgadmin4/bin/setup-web.sh 

How to Install pgAdmin4 on CentOS 8

07. The configuration script will ask you for an email and a password to create a new user account for the web interface.

You can now access pgAdmin4 by navigating to the following address on your browser:

http://localhost/pgadmin4

For the remote systems, change “localhost” with the remote server IP address or domain name.

Installing pgAdmin4 on CentOS 8

Conclusion

The latest versions of PostgreSQL and pgAdmin4 have been successfully installed on your system. Now you can configure them according to your requirements.

PostgreSQL is a powerful RDBMS; It is open-source and runs across platforms and is known for its reliability and robust features. RDBMS helps store, organize, and access data in a structured manner. pgAdmin4 is a GUI-based web application that is used for the management of the PostgreSQL databases.

In this installation guide, we have learned to install PostgreSQL and pgAdmin4 on our CentOS 8 system.

The post How To Install PostgreSQL Server on CentOS 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/feed/ 0
How to Install and Configure Apache on CentOS/RHEL 8 https://tecadmin.net/install-apache-centos8/ https://tecadmin.net/install-apache-centos8/#comments Fri, 08 Nov 2019 19:23:36 +0000 https://tecadmin.net/?p=19816 CentOS 8 is the latest release of CentOS Linux operating system, which is based on Red Hat Enterprise Linux 8. In this tutorial, we will help you to install the Apache web server on CentOS 8 or RHEL 8 system with additional configuration and security. Prerequsities SSH access to CentOS/RHEL 8 system Sudo privileges to [...]

The post How to Install and Configure Apache on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
CentOS 8 is the latest release of CentOS Linux operating system, which is based on Red Hat Enterprise Linux 8. In this tutorial, we will help you to install the Apache web server on CentOS 8 or RHEL 8 system with additional configuration and security.

Prerequsities

  • SSH access to CentOS/RHEL 8 system
  • Sudo privileges to user to install packages

Step 1 – Install Apache on CentOS 8

First of all, Login to your CentOS 8 or RHEL 8 system via SSH. Then install Apache2 HTTP server packages using the following command. This will also install additional required packages on your system.

sudo dnf install httpd

Wait for the installation complete

Step 2 – Manage Apache Service

Apache service is managed with systemctl command line on CentOS/RHEL 8. After installation, use the following command to enable the Apache service and then start it.

sudo systemctl enable httpd.service
sudo systemctl start httpd.service

Here are the other commands to stop and restart Apache service via command line.

sudo systemctl stop apache2.service
sudo systemctl restart apache2.service

Step 3 – Test Apache Setup

You can view the installed Apache version details using the following command.

httpd -v

Server version: Apache/2.4.37 (centos)
Server built:   Oct  7 2019 21:42:02

Create a test html page under default document root directory (/var/www/html).

sudo echo "Hello TecAdmin.net" > /var/www/html/index.html

Now access your Apache server using the server’s IP address or a domain pointed to the server IP.

Apache on CentOS 8

Step 4 – Creating VirtualHost

Let’s create the first virtual host on your Apache server. For the tutorial, we are using the sample domain “example.com”. Here we will create a virtual host for example.com on port 80.

Create a sample index file in a directory:

sudo mkdir -p /var/www/example.com
echo "hello example.com" | sudo tee /var/www/example.com/index.html

Then create Virtualhost configuration file and edit in editor:

sudo vim /etc/httpd/conf.d/example.com.conf

Add the following content at the end of the configuration file. You may change the domain name as per your domain.

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/example.com
    ServerName example.com
    ServerAlias www.example.com

    <Directory /var/www/example.com>
           #Allowoverride all    ###Uncomment if required
    </Directory>

    ErrorLog logs/example.com_error.log
    CustomLog logs/example.com_access.log combined
</VirtualHost>

Save the Virtualhost configuration file and reload the Apache service using the following commands:

sudo systemctl reload httpd.service

Step 5 – Configure SSL VirtualHost

You can skip this step if you don’t need SSL. But the security is always the primary concern for any website. To use SSL with Apache, install the mod_ssl package on your system.

sudo dnf install mod_ssl

For the tutorial, I have followed these instructions to generate a self signed SSL certificate for our domain.

You can either use /etc/httpd/conf/ssl.conf for SSL virtual host or You can use a separate Virtual host configuration file for your domain. For example:

sudo vim /etc/httpd/conf.d/example.com_ssl.conf

with the following content:

<VirtualHost *:443>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/example.com
	
    ServerName example.com
    ServerAlias www.example.com
	
    <Directory /var/www/example.com>
           #Allowoverride all    ###Uncomment if required
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/example.com.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/example.com.key
	
    ErrorLog logs/example.com_ssl-error.log
    CustomLog logs/example.com_ssl-access.log combined
</VirtualHost>

Here is three terms used to configure SSL virtualhost:

  • SSLEngine – Set this to “on”
  • SSLCertificateFile – Set the path of your SSL certificate
  • SSLCertificateKeyFile – This is the private key files used to generate SSL certificate

After that enable the Virtualhost and reload the Apache service using the following commands:

sudo systemctl reload apache2.service

Step 6 – Secure Apache Server

Security is the most important part of hosting. Hackers are ready to exploit your web server. Edit Apache main configuration file

sudo vim /etc/httpd/conf/httpd.conf

Add the following values at the end of the file:

ServerTokens Prod
 ServerSignature Off
 TraceEnable Off

After that edit the Apache default SSL configuration file:

sudo vim /etc/httpd/conf.d/ssl.conf

Here are the multiple security-related settings. Add or Update the following settings. We are not going in detailed descriptions about it but these settings are very useful for the production servers.

#Rules taken from https://cipherli.st/

SSLCipherSuite EECDH+AESGCM:EDH+AESGCM
# Requires Apache 2.4.36 & OpenSSL 1.1.1
SSLProtocol -all +TLSv1.3 +TLSv1.2
SSLOpenSSLConfCmd Curves X25519:secp521r1:secp384r1:prime256v1
# Older versions
# SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
# Requires Apache >= 2.4
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11
SSLSessionTickets Off

After making changes restart the Apache service to apply the new configuration.

sudo systemctl reload apache2.service

Conclusion

All done, You are running a secured Apache server on your CentOS 8 or RHEL 8 Linux system.

The post How to Install and Configure Apache on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-apache-centos8/feed/ 2
How to Install MariaDB 10.4 on CentOS 8 & RHEL 8 https://tecadmin.net/install-mariadb-centos8/ https://tecadmin.net/install-mariadb-centos8/#respond Sun, 20 Oct 2019 10:38:30 +0000 https://tecadmin.net/?p=19655 MariaDB 10.4 stable version has been released. It is an enhanced, drop-in replacement for MySQL. MariaDB can be an better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server. MariaDB has a number of updated features over MySQL. Use below links to read features comparison between MariaDB and MySQL. [...]

The post How to Install MariaDB 10.4 on CentOS 8 & RHEL 8 appeared first on TecAdmin.

]]>
MariaDB 10.4 stable version has been released. It is an enhanced, drop-in replacement for MySQL. MariaDB can be an better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server. MariaDB has a number of updated features over MySQL. Use below links to read features comparison between MariaDB and MySQL. This article will help you to install MariaDB 10.4 in CentOS 8 and RHEL 8 systems.

Step 1 – Add MariaDB Yum Repository

First add MariaDB yum repository in our system. Create a new repo file /etc/yum.repos.d/mariadb.repo in your system and add below code as per your operating system and architecture.

sudo vi /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Step 2 – Install MariaDB on CentOS 8

Let’s use the following command to install MariaDB 10.4 in your system. This will also install other dependencies automatically.

sudo dnf makecache
sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream

After installing MariaDB in your system start it’s service using the following command.

sudo systemctl start mysql.service

Step 3 – Secure MariaDB Install

You also need to secure your MariaDB installation using passwords and do some other changes. To do this run secure installation script from command line.

sudo /usr/bin/mysql_secure_installation

The secure installation script will ask for user input as some points, follow the installation as per below output showing, All user inputs are highlighted with red color.

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

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

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...
Thanks for using MariaDB!

Step 4 – Working with MariaDB

After installing and completing the configuration, connect to a MariaDB server using the following command.

sudo mysql -u root -p

Also try to create a new database, user and assign privileges to a database.

## CREATE DATABASE
MariaDB [(none)]> CREATE DATABASE mydb;
 
## CREATE USER ACCOUNT
MariaDB [(none)]> CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'secret';
 
## GRANT PERMISSIONS ON DATABASE
MariaDB [(none)]> GRANT ALL ON mydb.* TO 'dbuser'@'localhost';
 
##  RELOAD PRIVILEGES
MariaDB [(none)]> FLUSH PRIVILEGES;

You may also required install phpMyAdmin to manage MariaDB using web interface, which provides easy way to work.

The post How to Install MariaDB 10.4 on CentOS 8 & RHEL 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-mariadb-centos8/feed/ 0