Tuesday 3 August 2021

How to Install and Configure HTTPD Web Server on RedHat8.1 Linux


This tutorial will guide you on step by step installation and configuration of HTTPD WEB Server on RedHat 8.1 Linux server.

1. Install HTTPD

Open terminal and login through root user then execute yum command to install httpd.

[root@worldwidelinux ]# yum -y install httpd

The above command will install all the dependency packages related to httpd web server.

2. Configure HTTPD

Below are the changes need to be done on httpd configuration file for creating your own web server.

Step:1 Set email address for your web server

ServerAdmin - where problems with the server should be e-mailed

Open http configuration file using vim editor and change on line :39

Edit and change from ServerAdmin root@localhost to ServerAdmin root@worldwide.linux

Step:2 Set domain name or ip address for your web server

ServerName - Name and port that the server uses to identify itself.

You can assign your system ip address as a server name or if you have a own domain, can configure here. For example, we gonna configure our local IP address as server name.

Uncomment a line :98 and change from #ServerName www.example.com:80 to ServerName 192.168.107:80

Step:3 Remove Indexes

Edit on line :147 and change from Options Indexes FollowSymLinks to Options FollowSymLinks

Step:4 AllowOverride Controls

Edit on line :154 and change from AllowOverride None to AllowOverride All

Step:5 Add Directory index file name with php extension to serve if a directory is requested

Add index.php next to index.html on line :167

It should looks like given below:

DirectoryIndex index.html index.php

Step:6 Add server's response header

Add a below line at the end of httpd.conf file.

ServerTokens Prod

3. Enable HTTPD Service

Execute a below command to enable a httpd service:

[root@worldwidelinux ]# systemctl enable --now httpd

For more information on service start, stop, enable or disbale services, please check here.

4. If FireWall is running, allow HTTPD Service


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

success

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

success


5. Start HTTPD Service

[root@worldwidelinux ]# systemctl start httpd.service

6. Create a HTML test page

Create a file called index.html under /var/www/html/ directory.

[root@worldwidelinux ]# vim /var/www/html/index.html

7. Access html file from firefox browser

We configured 192.168.0.107 ip address as web server address, so open firefox browser and type https://192.168.0.107 then press Enter key.

That's it, you have own web server now. Enjoy creating websites and web applications through httpd web server. I hope this tutorial is very helpful to create a HTTPD Web Server on RedHat 8.1 Linux Server.

Monday 2 August 2021

How to provide Root Privileges to an user on RedHat 8.1 Linux Server


This tutorial will guide you on how to assign an user to perform particular tasks with root privillege and without entering root password on RedHat 8.1 Linux server.

1. Allow users to perform root actions

Open terminal and login as root user, then open sudoers file using vim editor.

[root@worldwidelinux ]# vim /etc/sudoers

Add below line into sudoers file on 101th line.


user_name ALL=(ALL) ALL=systemctl restart httpd.service


Replace user_name with your username. You can add multiple commands seperated by comma in the ALL= attribute.

2. Restart a httpd service as root user

For an example, we allow redhat user to perform httpd restart. Usually, root user only can do service start, stop and restart actions. So we have to configure redhat user to perform a systemctl restart command into sudoers file.


redhat ALL=(ALL) ALL=/usr/bin/systemctl restart httpd.service



[redhat@worldwidelinux ~]# sudo systemctl restart httpd.service

[sudo] password for redhat: {Type system user password}


How to Assign Full Root Privileges to an User on RedHat 8.1. Linux Server


This tutorial will guide you on how to assign a root privillege for users on RedHat 8.1 Linux server.

Sudo is installed by default on all environments. We can set a rules for an user to perform all the root actions or particular set of actions like service restart, specific command execution etc.,

1. To provide full root privileges to an user

Open terminal and login as root user, then open sudoers file using vim editor.

[root@worldwidelinux ]# vim /etc/sudoers

Add below line into sudoers file on 101th line.


redhat ALL=(ALL) ALL


For an example, let's add redhat user into sudoers file to provide root access.

Sudoers File

2. Login as root from normal user

Execute sudo su - command to login as root from normal user.


[redhat@worldwidelinux ~]# sudo su -

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.

#2) Think before you type.

#3) With great power comes great responsibility.

[sudo] password for redhat: {Type your user password}

[root@worldwidelinux ~]#


How to START/STOP Service on RedHat .8.1 Linux Server


This tutorial will guide you on how to perform a Start and Stop Service on RedHat 8.1 Linux server.

1. Start a service

Open terminal and login through root user and execute below command with your service name to start a service.

Syntax: systemctl start SERVICE_NAME

For Example, to start httpd service:

[root@worldwidelinux ]# systemctl start httpd.service

2. Stop a service

Open terminal and login through root user and execute below command with your service name to stop a service.

Syntax: systemctl stop SERVICE_NAME

For Example, to stop httpd service:

[root@worldwidelinux ]# systemctl stop httpd.service

Sunday 1 August 2021

How to ENABLE/DISABLE Service on RedHat 8.1 Linux Server


This tutorial will guide you on how to perform a Enable/Disable Service on RedHat 8.1 Linux server.

1. List all the active and running services

[root@worldwidelinux ]# systemctl -t service

UNIT LOAD ACTIVE SUB DESCRIPTION


accounts-daemon.service loaded active running Accounts Service

alsa-state.service loaded active running Manage Sound Card State (restore and store)

atd.service loaded active running Job spooling tools

auditd.service loaded active running Security Auditing Service

avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack

bluetooth.service loaded active running Bluetooth service

chronyd.service loaded active running NTP client/server

colord.service loaded active running Manage, Install and Generate Color Profiles

crond.service loaded active running Command Scheduler

cups.service loaded active running CUPS Scheduler

dbus.service loaded active running D-Bus System Message Bus

dracut-shutdown.service loaded active exited Restore /run/initramfs on shutdown

gdm.service loaded active running GNOME Display Manager

gssproxy.service loaded active running GSSAPI Proxy Daemon

import-state.service loaded active exited Import network configuration from initramfs

irqbalance.service loaded active running irqbalance daemon

iscsi-shutdown.service loaded active exited Logout off all iSCSI sessions on shutdown

kdump.service loaded active exited Crash recovery kernel arming

kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel

ksm.service loaded active exited Kernel Samepage Merging

ksmtuned.service loaded active running Kernel Samepage Merging (KSM) Tuning Daemon

ldconfig.service loaded active exited Rebuild Dynamic Linker Cache

libstoragemgmt.service loaded active running libstoragemgmt plug-in server daemon

lvm2-monitor.service loaded active exited Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling

lvm2-pvscan@8:2.service loaded active exited LVM event activation on device 8:2

mcelog.service loaded active running Machine Check Exception Logging Daemon

ModemManager.service loaded active running Modem Manager

NetworkManager-wait-online.service loaded active exited Network Manager Wait Online

NetworkManager.service loaded active running Network Manager

nis-domainname.service loaded active exited Read and set NIS domainname from /etc/sysconfig/network

packagekit.service loaded active running PackageKit Daemon

plymouth-quit-wait.service loaded active exited Hold until boot process finishes up

plymouth-read-write.service loaded active exited Tell Plymouth To Write Out Runtime Data

plymouth-start.service loaded active exited Show Plymouth Boot Screen

polkit.service loaded active running Authorization Manager

rhsmcertd.service loaded active running Enable periodic update of entitlement certificates.

rngd-wake-threshold.service loaded active exited Hardware RNG Entropy Gatherer Wake threshold service

rngd.service loaded active running Hardware RNG Entropy Gatherer Daemon

rpc-statd-notify.service loaded active exited Notify NFS peers of a restart

rpcbind.service loaded active running RPC Bind

rsyslog.service loaded active running System Logging Service

rtkit-daemon.service loaded active running RealtimeKit Scheduling Policy Service

smartd.service loaded active running Self Monitoring and Reporting Technology (SMART) Daemon

sshd.service loaded active running OpenSSH server daemon

sssd.service loaded active running System Security Services Daemon

systemd-backlight@backlight:intel_backlight.service loaded active exited Load/Save Screen Backlight Brightness of backlight:intel_backlight

systemd-fsck-root.service loaded active exited File System Check on Root Device

systemd-fsck@dev-disk-by\x2duuid-9801a9a8\x2d16df\x2d40a8\x2d9f7a\x2dc45cb00bfe49.service loaded active exited File System Check on /dev/disk/by-uuid/9801a9a8-16df-40a8-9f7a-c45cb00bfe49

systemd-fsck@dev-mapper-rhel\x2dhome.service loaded active exited File System Check on /dev/mapper/rhel-home

systemd-hwdb-update.service loaded active exited Rebuild Hardware Database

systemd-journal-catalog-update.service loaded active exited Rebuild Journal Catalog

systemd-journal-flush.service loaded active exited Flush Journal to Persistent Storage

systemd-journald.service loaded active running Journal Service

systemd-logind.service loaded active running Login Service

systemd-machined.service loaded active running Virtual Machine and Container Registration Service

systemd-modules-load.service loaded active exited Load Kernel Modules

systemd-random-seed.service loaded active exited Load/Save Random Seed

systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems

systemd-sysctl.service loaded active exited Apply Kernel Variables

systemd-sysusers.service loaded active exited Create System Users

systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev

systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories

systemd-udev-settle.service loaded active exited udev Wait for Complete Device Initialization

systemd-udev-trigger.service loaded active exited udev Coldplug all Devices

systemd-udevd.service loaded active running udev Kernel Device Manager

systemd-update-done.service loaded active exited Update is Completed

systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown

systemd-user-sessions.service loaded active exited Permit User Sessions

tuned.service loaded active running Dynamic System Tuning Daemon

udisks2.service loaded active running Disk Manager

upower.service loaded active running Daemon for power management

user-runtime-dir@0.service loaded active exited /run/user/0 mount wrapper

user-runtime-dir@42.service loaded active exited /run/user/42 mount wrapper

user@0.service loaded active running User Manager for UID 0

user@42.service loaded active running User Manager for UID 42

vdo.service loaded active exited VDO volume services

wpa_supplicant.service loaded active running WPA supplicant

LOAD = Reflects whether the unit definition was properly loaded.

ACTIVE = The high-level unit activation state, i.e. generalization of SUB.

SUB = The low-level unit activation state, values depend on unit type.

77 loaded units listed. Pass --all to see loaded but inactive units, too.

To show all installed unit files use 'systemctl list-unit-files'.

2. List all the services

Open terminal and login through root user then execute below command with your service name to enable a service.

[root@worldwidelinux ]# systemctl list-unit-files

Above command will give an output as 478 default service unit files and its STATE.

3. Enable services

Open terminal and login through root user then execute below command with your service name to enable a service.

Syntax: systemctl enable SERVICE_NAME

For Example, if you want to enable httpd service, please check the below command:

[root@worldwidelinux ]# systemctl enable httpd.service

4. Disable a service

Open terminal and login through root user then execute below command with your service name to disable a service.

Syntax: systemctl disable SERVICE_NAME

For Example, if you want to disable httpd service, please check the below command:

[root@worldwidelinux ]# systemctl disable httpd.service