Rhcsa Linux
Rhcsa Linux
Rhcsa Linux
[root@TechTutorial ~]# ls
[root@TechTutorial ~]# ls -l
total 24
[root@TechTutorial ~]# ls -m
without color, here all the files and directories will display in block color
/etc/
total 24
-rw-r--r--. 1 root root 0 2016-01-11 15:47:47.042849437 +0530 a
total 24
-rw-r--r--. 1 root root 0 2016-01-11 15:47 a
total 24
total 24
total 24
total 24
total 24K
[root@TechTutorial ~]# ls -i
dir1/ dir2/
[root@TechTutorial ~]# ls -p
total 24
[root@TechTutorial ~]# ls -Q
total 24
-rw-r--r--. 1 root root 0 Jan 11 15:47 b
total 24
[root@TechTutorial ~]# ls -R
.:
./dir1:
Ravi Test1
./dir1/Ravi:
Kumar
./dir1/Ravi/Kumar:
Tech
./dir1/Ravi/Kumar/Tech:
TUtorial
./dir1/Ravi/Kumar/Tech/TUtorial:
./dir2:
total 24
total 24
-rw-r--r--. 1 root root 0 Jan 11 15:47 a
[root@TechTutorial ~]# ls
[root@TechTutorial ~]# ls -1
anaconda-ks.cfg
arkitsample.txt
ARKIT.txt
dir1
dir2
initial-setup-ks.cfg
techtutorial
25. Lets know the ls command version
details and author details
[root@TechTutorial ~]# ls --version
This is free software: you are free to change and redistribute it.
Installation Source
Installation Source Can be DVD ISO or Net Installation. Net Installation means
directly add web URL so that it will download from provide web URL and Installs
Software Selection
Disk Partitioning
Disk Partitioning can be done in Two Ways One is Standard Partitioning and LVM
(Logical Volume Manager) is preferable way to do, because it has an flexibility to
increase / decrease disk size
IMPORTANT
The FAT32 file system does not support files larger than 4 GiB (4.29 GB). Some
Red Hat Enterprise Linux 7 installation media may be larger than that, which
means you cannot copy them to a drive with this file system.
When using a hard drive or a USB flash drive as an installation source, make sure
it is connected to the system when the installation begins. The installation program
is not able to detect media inserted after the installation begins.
Conclusion
Redhat Enterprise Linux 7 is a server version which has more features than RHEL
5&6
success
success
#setsebool -P ftpd_full_access on
create new yum configuration file and add the entries as mentioned below.
[root@arkit-server ~]# cat /etc/yum.repos.d/ftp.repo
[ARKIT-YUM]
name=yumserver
baseurl=ftp://192.168.4.13/pub/
enabled=1
gpgcheck=0
success
success
success
success
success
success
since we already enabled the fire ports we no need to enable now. setup Linux Lab
yet home – installing and configuring IPA server
Now verify the kerberos and ldap user is able to login or not
# Generated by NetworkManager
search lab.local
nameserver 192.168.4.10
[root@ravikumar ~]#
-bash-4.2$ id
-bash-4.2$ exit
logout
when you login from client you will not get home directory
to get home directory add below line to mentioned file setup Linux Lab yet home –
installing and configuring IPA server
# vi /etc/pam.d/password-auth
That’s about setting up an Linux Lab yet home using virtualization softwares such
as vmware & virtualbox setup Linux Lab yet home – installing and configuring
IPA server
Thanks for the read. setup Linux Lab yet home – installing and configuring IPA
server
# mkdir -p /dir2/ravi/test
Copy Directories
# mv dir1/ /dir2/
mv: overwrite ‘/dir2/dir1’? y
# ls /dir2/
anaconda-ks.cfg dir1 ravi wel
# rm ravi
# rm -f wel
# rm -f touch/
# rm -rf touch/
As mentioned in above ‘>’ redirect symbol we have to use along with cat
command to create file with content. Whenever you type cat > FILENAME hit
enter, than it will just show blank screen below the command now type some data
and press CTRL+d first will save and exit.
To read file content below is the command example
To append the file content ‘>>’ double grater than we have to use. Type data and
press CTRL+d to save.
[root@ArkIT ~]# ls
long list with detailed information show. ls -l command will show detailed list
of files and directories.
[root@ArkIT ~]# ls -l
total 24
total 24
/root
4. more – file perusal filter for crt
viewing
more command is used to filter for paging through text one screen full at a time.
cp: omitting directory ‘Music/’ <<< --- if you didn't use -r option this error
will come
total 4
whenever copying the files & directories we required to preserve time stamps to
preserving the time stamps of files & directories use option ‘-p’ along with cp
command
[root@ArkIT ~]# ls -l
-rw-------. 1 root root 1968 Mar 18 02:26 anaconda-ks.cfg << -- Original file
-rw-------. 1 root root 1968 Mar 18 02:26 /opt/anaconda-ks.cfg <<--- copied file
[root@ArkIT ~]# rm -rf Public/ <<-- Delete Directory without asking for
confirmation
To delete normal file use rm command it will ask you for the conformation when
deleting. If do not want to prompt any confirmation use -f option. To delete
directories use rm -rf .
Note: Be careful whenever your running rm -rf, avoid wildcard * while running rm
command, Go to the same directory and run rm -rf using wildcard *.
9. Changing directories
To go from one directory to another directory we have to use cd command
as you see in above screenshot . (dot) represents current directory. ..(dot dot)
represents its parent directory, what is the use of them..?
whenever we use cd command cd ../../../ which means we are going two
directories back from current.
[root@ArkIT /]# cd -
/root
[root@ArkIT ~]# rmdir /test <<-- Directory having few files in it not deleted
[root@ArkIT ~]# lpr rhce <<-- Print rhce file to default printer
[root@ArkIT ~]# lpr rhce -P PRINTERNAME <<-- Print rhce file to specified printer
[root@ArkIT ~]# lpr -#5 rhce <<--- Print only 5 pages out of all pages
[root@ArkIT ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/rhel-root 18317312 109332 18207980 1% /
[root@ArkIT ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.0G 15G 18% /
[root@ArkIT ~]# df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 17878 3041 14838 18% /
df -t <FileSystem> – it will list only the partition which are formated with
specified file system type
df -i – it will show with inode utilization
df -h – human redable format
df -m – all partition in MB size
above example will exclude the specified string (it means which lines does not
contain string will be displayed)
For more and more examples see this
Grep practical examples
16. Check CPU and Memory
utilization
top command is used to check CPU utilization, memory utilization and more.
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
[root@ArkIT ~]# ps
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[root@ArkIT ~]# ps -U root -u root u <<-- list all processes running by ROOT user
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[root@ArkIT ~]# ls -l
-rwxrw---x. 1 root root 1968 Mar 18 02:26 anaconda-ks.cfg
Above comand will not support GUI to connect remote host using GUI support, we
have to use below command
NAME
ls - list directory contents
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
Conclusion
Getting help from 5 command line tools is very handy to do our regular daily to
daily activities.
Viewing Text file and Adding Data to Text file I am just opening ‘arkit’ file using
nano.
Jump Curser from Line beginning to Ling Ending keys. By Pressing CTRL + A
key go to Current Begining of the Line and CTRL + E to End of Current Line.
Ctrl+A Go to beginning of current line
## Nanorc files
# include "/usr/share/nano/nanorc.nanorc"
## C/C++
# include "/usr/share/nano/c.nanorc"
## HTML
# include "/usr/share/nano/html.nanorc"
## TeX
# include "/usr/share/nano/tex.nanorc"
# include "/usr/share/nano/mutt.nanorc"
## Patch files
# include "/usr/share/nano/patch.nanorc"
## Manpages
# include "/usr/share/nano/man.nanorc"
## Groff
# include "/usr/share/nano/groff.nanorc"
## Perl
include "/usr/share/nano/perl.nanorc"
## Python
# include "/usr/share/nano/python.nanorc"
## Ruby
# include "/usr/share/nano/ruby.nanorc"
## Java
# include "/usr/share/nano/java.nanorc"
## Assembler
# include "/usr/share/nano/asm.nanorc"
## POV-Ray
# include "/usr/share/nano/pov.nanorc"
That’s it about Nano Text Editor.
/sbin directory
This /sbin directory contains essential system binaries. Utilities used by systemd
administrators will be stored under this directory. /sbin also contains binaries
which are used for booting, restoring, recovering and repairing the system.
Example: fsck, reboot etc..
/srv directory stores data for services provided by this system. It contains site
specific data which is served by system.
/tmp stores temporary files. /tmp is very special directory which is accessible to
every user in the system. Assigned an permissions called sticky bit and few more
special permissions.
/usr secondary major hierarchy. When /bin directory is not flexible to keep more
binaries / scripts we can keep in /usr/bin directory. /usr is an shareable and read-
only data, FHS complaint hosts and must not be writable.
/var holds variable data, which is not static data variable data is an dynamic data.
Var directory contains log files as well.
/home is an default users home directory
/root is an default root user home directory.
Conclusion: Directory structure is created in Linux based on FH complaint.
File system hierarchy standard. FHS gives basic security and separate shareable
and UN-shareable files.
ravikumar:x:1000:1000::/home/ravikumar:/bin/bash
ravik:x:3333:2005:Ind Administrator:/opt/ravik:/bin/bash
ravik:x:3333:2005:Ind Administrator:/opt/ravik:/bin/csh
ravik:!!:17110:0:99999:7::17166:
ravik:!:17110:0:99999:7::17166:
Deleting User
Deleting exiting user is very simple just we have to run userdel command along
with required options, User administration creating, modifying and deleting users.
[root@ArkIT-Serv ~]# userdel ravik
[root@ArkIT-Serv opt]# ls
ravik rh
[root@ArkIT-Serv home]# ls
ravi1
if you delete user without using -r option user home directory will not delete, you
have to delete user home path manually. If you use -r option home directory also
will delete automatically.
Conclusion
User Administration is very simple and very effective, I hope you understand about
user types, Creating, Modifying and Deleting Users from Linux Machine.
Related Articles
Access Control List Explained
What is LVM and How to create LVM
11 rsync commands
4. Listing dependencies, jobs, sockets, uni
t-files and Units
Listing dependencies means what are the services we have to start before starting this
required service this before version this feature was not there.
Shows required and wanted units of the specified unit. If no unit is specified,
default.target is implied. Target units are recursively expanded. When –all is passed,
all other units are recursively expanded as well
16 sockets listed.
Pass --all to see loaded but inactive sockets, too.
Note: because the addresses might contains spaces, this output is not suitable for
programmatic consumption.
16 sockets listed.
Pass --all to see loaded but inactive sockets, too.
As shown in above command examples we have stopped the service, disabled the
service and masked the service. Now try to start the service.
Service reload is used whenever we changed something to the service and we would
like to push the changes to the service without interrupting the connected users.
Reloading the service will never change existing PID (Process Identity)
Service restart is used to restart the service which means stop and start the service,
whenever we run restart existing users will disconnect and new PID will be created. It
required little downtime to the service changes.
You may wish to take a look at the dependencies of the target you are isolating before
performing this procedure to ensure that you are not stopping vital services:
When you are satisfied with the units that will be kept alive, you can isolate the target
by typing:
Snapshots are only useful for saving and restoring which units are running or are
stopped, they do not save/restore any other state. Snapshots are dynamic and lost on
reboot.
lo loopback unmanaged --
GENERAL.DEVICE: eno16777736
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:3D:FA:DD
GENERAL.MTU: 1500
GENERAL.CONNECTION: eth0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.4.20/24
IP4.GATEWAY: 192.168.4.2
IP4.DNS[1]: 8.8.8.8
IP6.ADDRESS[1]: fe80::20c:29ff:fe3d:fadd/64
IP6.GATEWAY:
above command will make sure that connection should connect automatically after
server reboot
Know the status of NetworkManager
running
connected
======================================================
======================================================
NAME: eth0
UUID: a80360f3-0972-4843-8d86-a27ae37d8751
TYPE: 802-3-ethernet
TIMESTAMP: 1471705850
AUTOCONNECT: yes
AUTOCONNECT-PRIORITY: 0
READONLY: no
DBUS-PATH: /org/freedesktop/NetworkManager/Settings/2
ACTIVE: yes
DEVICE: eno16777736
STATE: activated
ACTIVE-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0
---------------------------------------------------------
Using below command to list only active connections, As we can see eth0 is in
active state.
NAME AUTOCONNECT
eth0 yes
192series yes
10series yes
172series yes
===============================================================================
===============================================================================
connection.id: eth0
connection.uuid: a80360f3-0972-4843-8d86-a27ae37d8751
connection.interface-name: eno16777736
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.timestamp: 1471706450
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.secondaries:
connection.gateway-ping-timeout: 0
OUTPUT TRUNCATED...
GENERAL.NAME: eth0
GENERAL.UUID: a80360f3-0972-4843-8d86-a27ae37d8751
GENERAL.DEVICES: eno16777736
GENERAL.STATE: activated
GENERAL.DEFAULT: yes
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/2
GENERAL.SPEC-OBJECT: /
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: 192.168.4.20/24
IP4.GATEWAY: 192.168.4.2
IP4.DNS[1]: 8.8.8.8
IP6.ADDRESS[1]: fe80::20c:29ff:fe3d:fadd/64
IP6.GATEWAY:
shows details for “eth0” active connection, like IP, DHCP information, etc.
Thanks for the read.
Related Articles
Generating Linux Audit Reports
Screen Recording Software RHEL
How to install adobe flash player in Ubuntu Linux
Root user password reset in RHEL 7
This system is not registered to Red Hat Subscription Management. You can use
subscription-manager to register.
Nothing to do
Enable and Start Services
#ListenAddress 0.0.0.0
#ListenAddress ::
Change SSH default port to something else (instead of 22). After defining the port
number in config file we have to apply SELinux policy
Port 1028
Log authentication related logs to log file, If you hash out the SyslogFacility
authentication related messages will not be logged
# Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO
#PermitRootLogin yes
Enabling Key Based authentication, remote host keys would be added to required
file. Customization can be done by specifying below parameter in config file
AuthorizedKeysFile .ssh/authorized_keys
GUI windows access using SSH, Enable X11forwarding so that you can run GUI
window on remote host from SSH
X11Forwarding yes
Banner Message when user logged in to server using SSH, user will see an banner
message. To specify Banner message enable below config line
Banner /filepath
AllowGroups groupname
Likewise there are so many options to configure SSH Server (Secure Shell) and
optimize
Conclusion: SSH is used to connect remote servers securely and manage them easily.
Mostly used protocol in the world is SSH.
How to Setup Passwordless Authentication to run scripts
SELinux Context
How You Know You’re Doing ps
Command Linux The Right Way –
Video
BY ARK · PUBLISHED DECEMBER 22, 2016 · UPDATED JANUARY 26, 2017
In this article we are going to see ps command Linux as video session. ps
command displays report a snapshot of the current processes. ps displays
information about a selection of the active processes. If you want a repetitive
update of the selection and the displayed information, use top instead.
ps command Linux
To see every process on the system using standard syntax
[root@ArkITShell ~]# ps -e
[root@ArkITShell ~]# ps ax
Security info
To see every process running as root (real & effective ID) in user format:
Related Articles
analyze Linux system performance
20 ssh interview questions and answers
Linux directory structure changed in RHEL7 – FHS file hierarchy standard
ps <Options> arguments
For example:
List -x processes that are associated with a terminal (TTY) -U Lists the processes
associated with one or several users
-o it Used to determine which characteristics of the process will be listed
The most interesting -o parameters are:
% Cpu% CPU cpu utilization of the process in “##. #” Format.
% Mem% MEM ratio of the process’s resident set size to the physical
memory on the machine, Expressed as a percentage
args COMMAND command With all its arguments as a string.
Modifications to the arguments May be shown.
cgroup cgroup Control display groups to Which the process belongs.
or NI nice value. This ranges from 19 (nicest) to -20 (not nice to others)
pid PID to the process ID number Representing
ppid PPID parent process ID
We can then combine these parameters in the following output:
Which would give us the pid, the percentage of CPU used, the percentage of
memory used and the arguments with which the program is run. Another
interesting parameter is cgroup, because since we have systemd, all processes
running under the control of a group (control group).
You can find these settings and many more doing ‘man ps’ in section STANDARD
FORMAT Specifiers
The last tip is: to sort the output, use -sort, and specify on the basis that we want to
sort the output parameter.
For example we ordain by percentage of CPU processing:
Killall and pkill allow us to do the same, but looking for the process name:
Related Articles
htop command in Linux
Linux File System Usage Monitoring Script
Server Profile
Packages: rsyslog*
Service / Daemon Name: rsyslog.service
Port number: 514
Config File: /etc/rsyslog.conf
In this article we are using Server IP: 192.168.4.20 Client IP: 192.168.4.21 for
demonstrate
server.arkit.co.in
Dependency Installed:
Complete!
#$ModLoad imudp
#$UDPServerRun 514
#$ModLoad imtcp
#$InputTCPServerRun 514
$ModLoad imudp
$UDPServerRun 514
success
success
success
Client Side
ping to server and verify server is reachable from client
*.* @@192.168.4.20:514
As shown above we have to point the client to send logs. . means all the logs. if
would like to specify only particular logs then do not specify . in client config.
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
Test logs
open log file in server and switch the users in client machine
Apr 23 16:16:02 desktop su: pam_unix(su-l:session): session closed for user atkit
Related Articles
HowTo Install GNOME Desktop in Centos 7
Configuring MAC Binding in DHCP Server
DHCP Server installation and configuration Centos 7
[root@TechTutorial tar]# tar -cvf ravi.tar *.txt << to Create an Archive file
command
380K ravi.tar
Techtutorials.txt
Techtutorials.txt
test1.txt
Techtutorials.txt
Note: As we deleting the previous files only for demonstration only, DO NOT
DELETE FILES in your environment.
you can mention multiple file names and also we can use wildcard option to restore
multiple files as shown above example
4.0K tech.tar.gz
As shown in above example, after compression of text files using ‘-z’ we got an
compression file size is 4KB actual file size 380KB
4.0K 1tech.tar.bz2
In this comparison of ‘.gz’ and ‘.bz2’ compression methods practical examples are
below
8.6M tarr.tar.gz
7.2M tarr.tar.bz2
d.txt
d.txt
deleting: ravi/tech.txt
[root@TechTutorial tar]#
# less compress.zip
# zmore compress.zip
# zless comress.zip
Archive: compress1.zip
Conclusion
We can group all files and directories in a single file by archiving, We can also
compress the files and directories in order to save the disk space. Archiving files and
directories will not save a disk space.
scp commands
preserving attributes
root@192.168.4.200's password:
root@192.168.4.200's password:
AddressFamily
BatchMode
BindAddress
CanonicalDomains
CanonicalizeFallbackLocal
CanonicalizeHostname
CanonicalizeMaxDots
CanonicalizePermittedCNAMEs
ChallengeResponseAuthentication
CheckHostIP
Cipher
Ciphers
Compression
CompressionLevel
ConnectionAttempts
ConnectTimeout
ControlMaster
ControlPath
ControlPersist
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
Host
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
HostName
IdentityFile
IdentitiesOnly
IPQoS
KbdInteractiveAuthentication
KbdInteractiveDevices
KexAlgorithms
LogLevel
MACs
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
PKCS11Provider
Port
PreferredAuthentications
Protocol
ProxyCommand
PubkeyAuthentication
RekeyLimit
RhostsRSAAuthentication
RSAAuthentication
SendEnv
ServerAliveInterval
ServerAliveCountMax
StrictHostKeyChecking
TCPKeepAlive
UsePrivilegedPort
User
UserKnownHostsFile
VerifyHostKeyDNS
# vi /tmp/destfile.txt
192.168.4.200
192.168.4.2
192.168.4.90
Now Create a file anywhere where to keep script file. In this example i want to
keep my script in /scripts/ directory
# vi /scripts/multiscp.sh
#!/bin/bash
## Author: Ankam Ravi Kumar
## Purpose: Copy files to multiple Server using single script
## Date: 21st July 2016
echo -e "Please Enter the file path which you want to copy:\c"
read file
# sh /scripts/mutiple.sh
Output of the script
Conclusion
15 scp commands which makes our life easy to copy files/directories instantly to
remote servers. scp command examples are most useful for transferring files and
directory content from one server to another server.
Thanks for the read please write your feedback on the same.
Related Articles
SSH to remote server without password
File System Usage Monitoring using Shell Script
How to Monitor CPU utilization using Shell Script
Take Remote Desktop of Linux Machine
Note: Permanent Local YUM server copy entire Dvd content to server path.
[RHEL7]
name=DVD media
baseurl=file:///rpms/
enabled=1
gpgcheck=1
gpgkey=file:///rpms/RPM-GPG-KEY-redhat-release
This system is not registered to Red Hat Subscription Management. You can use
subscription-manager to register.
repolist: 4,371
[root@ArkIT ~]#yum repolist enabled
This system is not registered to Red Hat Subscription Management. You can use
subscription-manager to register.
repolist: 4,371
This system is not registered to Red Hat Subscription Management. You can use
subscription-manager to register.
Resolving Dependencies
Dependencies Resolved
================================================================
================================================================
Installing:
Transaction Summary
=================================================================
Install 1 Package
Is this ok [y/d/N]: y
Downloading packages:
Running transaction
Installed:
tigervnc.x86_64 0:1.2.80-0.30.20130314svn5065.el7
Complete!
Conclusion
Local YUM server is more useful to install and upgrade packages with automatic
dependencies resolving. yellowdog updater module
Related Articles
Setup Linux Lab at Home complete Guide
Getting help from Command Line Interface RHEL7
25 Basic Linux Commands
One Linux Tutorial Illiterate Become An
Expert
setup Linux Lab yet home – installing
and configuring IPA server
BY ARK · PUBLISHED MARCH 6, 2016 · UPDATED JUNE 19, 2018
After completion of part-4 setup You can follow this steps to setup your own
Linux lab at Home, using either vmware workstation or Oracle Virtual box Or
KVM virtualization Or RHEV. In this method i have used Vmware work stations
and Virtual box o setup Linux Lab at home. IPA is the best option to practice
LDAP, Kerberos authentication for RHCE Lab.
run # yum update once and take the snapshot of that VM
right click on VM –> Snapshot –> Take Snapshot
success
success
#setsebool -P ftpd_full_access on
Step 4: Copy the packages to /var/ftp/pub/
and create repository
We have to share the YUM repository to our client machines via FTP.
create repository using installation DVD repomod.xml file.
create new yum configuration file and add the entries as mentioned below.
[ARKIT-YUM]
name=yumserver
baseurl=ftp://192.168.4.13/pub/
enabled=1
gpgcheck=0
success
success
success
success
success
success
since we already enabled the fire ports we no need to enable now. setup Linux Lab
yet home – installing and configuring IPA server
Now verify the kerberos and ldap user is able to login or not
# Generated by NetworkManager
search lab.local
nameserver 192.168.4.10
# yum install nss-pam-ldapd pam_krb5 ipa-client
rkumar:*:823800001:823800001:Ravi Kumar:/home/rkumar:/bin/sh
[root@ravikumar ~]#
-bash-4.2$ id
-bash-4.2$ exit
logout
when you login from client you will not get home directory
to get home directory add below line to mentioned file setup Linux Lab yet home –
installing and configuring IPA server
# vi /etc/pam.d/password-auth
That’s about setting up an Linux Lab yet home using virtualization softwares such
as vmware & virtualbox setup Linux Lab yet home – installing and configuring
IPA server
Thanks for the read. setup Linux Lab yet home – installing and configuring IPA
server
Please write your valuable feedback.
Related Articles
How to Install GNOME desktop in RHEL 7
rsyslog server installation and configuration RHEL 7
Linux Server Operating System
Server profile:
Packages : vsftpd
Daemon : vsftpd
Port Numbers : 20, 21
Config file path : /etc/vsftpd/vsftpd.conf
Features:
1. It is very secure and fast
2. Bandwidth throttling
3. IPv6 ready
4. Encryption support through SSL integration
5. Virtual IP configurations
6. Virtual users
7. Per-user configuration
8. Per-source-IP configuration and limits
Installation and Configuration FTP server in RHEL 7
Before going to install the vsftpd packages, ensure that the server has access
to internet. If it doesn’t have, configure local YUM repository for vsftpd
packages installation.
Install vsftpd yum command
:wq
:wq!
Conclusion
Installation and configuration FTP server is completed. FTP protocol is not
an platform independent which support multiple platforms.
Please do comment your feedback
find command
./resolvedbugs.txt
./resolvedbugs.txt
[root@ArkIT-Serv ~]# find . -name Resolvedbugs.txt
find -name
3. Search Only files out of all
Only files i want to list out of all directories and files. We have an option -type
f to fetch only files, here f means file
Find directories
5. Find all files which are end with same
file extension
Some times we did not remember what is the file name, we just know file
extension, so find all same extension files in particular path. In this case we are
using * wild card character which replace one or more characters.
/root/find/file1.txt
/root/find/file1.txt
mention range from in between 24hours + ten minutes to 24 Hours -20 minutes
/var/spool/mail/admin
22. Find files and directories based on group ownership
Locate files and directories based on their group ownership permissions. In below
example admin is the group name. find command is most useful over here.
Related Posts
ps command in Linux
25 commonly used Linux Commands
ls command 25 practical examples
Linux Video tutorial
Local File Systems are used to format partitions into usable without making file
system in partitions we can’t store data. Just making the partitions will turn them as
RAW. Partitions are used to organize users data on a Hard Disk.
When you make an Extended File System it will create an different types off
blocks to segregate data store
1. Master Blocks / Boot Blocks
2. Super Blocks
3. Inode Blocks
4. Data Blocks
Master Blocks / Boot Blocks : Only boot partitions contain
master blocks data. Remaining partitions master blocks are empty.
Super Blocks : Just like an index to the book and it works holds to the
information as follows
Utilized inode numbers
Free inode numbers
Utilized data blocks
Free data blocks
Inode table (index table) which holds all the information about
files/directories like permissions, owner, group name, size and time stamps.
4096 bytes default block size
15 data blocks = inode
If data size is more than 100MB block size is 4096bytes. If data size is less than
100MB block size is 1024bytes.
Data block storage of files
Below is the File System comparison in brief
File Max File Max Partition
Journal-ling Notes
System Size Size
Fat16 2 GB 2 GB No Legacy
Fat32 4 GB 8 TB No Legacy
(For Windows Compatibility) NTFS-3g
NTFS 2 TB 256 TB Yes is installed by default in Ubuntu, allowing Read/W
support
ext2 2 TB 32 TB No Legacy
Standard linux filesystem for many
ext3 2 TB 32 TB Yes
years. Best choice for super-standard installatio
Modern iteration of ext3. Best choice
ext4 16 TB 1 EB Yes for new installations where super-standard isn’
necessary
reiserFS 8 TB 16 TB Yes No longer well-maintained
JFS 4PB 32PB Yes Created by IBM – Not well maintained
(metadata)
Yes Created by SGI. Best choice for a mix
XFS 8 EB 8 EB
(metadata) of stability and advanced journaling
GB= Gigabyte (1024 MB) TB = Terabyte (1024 GB) PB = Petabyte (1024 TB) EB = Exabyte (1024 PB)
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
WARNING: Re-reading the partition table failed with error 16: Device or resource
busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
by default when you create an extended partition it will not update kernel to update
kernel we have to execute below command
# partprobe /dev/sdc
Mount partition
Partition has been formatted with EXT4, to mount it permanently we have to add
an entry in /etc/fstab file.
#
# /etc/fstab
# Created by anaconda on Wed Jun 22 11:14:58 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=5b0f4ed0-592e-4114-9a8e-10a7b99d2cd3 /boot xfs
defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/sdc1 /data ext4 defaults 0 0
[root@Techtutorials ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.3G 15G 19% /
devtmpfs 1.2G 0 1.2G 0% /dev
tmpfs 1.2G 80K 1.2G 1% /dev/shm
tmpfs 1.2G 8.9M 1.2G 1% /run
tmpfs 1.2G 0 1.2G 0% /sys/fs/cgroup
/dev/sda1 497M 124M 373M 25% /boot
Conclusion
Standard partition can be created using fdisk utility. Standard Linux File system
can’t be increased/decreased which is not flexible for production environment.
That’s it about Linux File System
Related Articles
Linux Boot process
Linux Swap File System
What is LVM.? How to Create LVM
Linux (Logical Volume Manager)
BY ARK · AUGUST 6, 2016
what is LVM.? How to create LVM Linux
LVM = Logical Volume Manager, Simply telling definition is not enough we
should know the purpose and advantages to use further.
If we take an example of standard Linux partitions are not flexible to increase and
decrease file system when required, In this case we can’t use standard file system
in production environment which is having high data growth rate.
Standard partitions can be used where there is no high data growth, which
partitions are used to store data and delete data later on.
Advantages of LVM
Very easy to create partitions
Increasing and decreasing file system size online is made easy
Adding more than one HDD will increase performance
LVM will support larger size of file system (100TB single partition)
What is LVM
We can create Logical Volumes using single HDD OR multiple HDD see the
below example how they works
Multiple HDD LVM Logical Volumes
As per the above example we are going to combine multiple HDD as a single
Volume Group then create required size of Logical Volumes. Here we can achieve
more performance compare to single HDD standard partition.
Example: One member job is divided into multiple members ultimately work
should complete faster. Adding multiple disks as Physical Volumes will increase
reading / writing headers.
As per above example Single HDD is divided into multiple Physical Volumes and
combined as Volume group then created Logical volumes. Here we may not see
more performance compare to above multiple disks. Here we get flexibility to
create and manage file system.
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Repeat above step will create one more partition, After completion of creating
required partitions we have to change its partition type to ‘Linux LVM’
Now required partitions are created and converted into Linux LVM type, after
creating partitions update kernel
PV Name /dev/sdc2
VG Name
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ViWQYD-Qjte-fdPi-YgUd-mGBW-3ep3-R6xffx
"/dev/sdc1" is a new physical volume of "2.00 GiB"
PV Name /dev/sdc1
VG Name
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID YtPDk4-sBDF-ryBW-cqIo-ndym-9nfR-a7f9nn
VG Name VG0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
Alloc PE / Size 0 / 0
VG UUID LSzoLa-C5vq-ilBm-j9hZ-b2Am-y2Ye-K6Cgsn
LV Path /dev/VG0/lvm1
LV Name lvm1
VG Name VG0
LV UUID 6KoIMO-SRJW-g0S0-bxrt-ABK1-pbjr-qPxRwF
# open 0
Current LE 768
Segments 2
Allocation inherit
As per above command output lv has been created LVM name is lvm1 and its size
is 3GB from Volume group VG0
LVM creation has been completed. Now let’s see how to create file system in
LVM
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
24 block groups
Logical Volume has been formatted with EXT4 file system. Mounted to /data1
That’s about Logical Volume Manager
Conclusion
Creating and using Logical volumes using multiple HDD’s will give more
performance and flexibility.
Related Articles
Linux File System
Access Control List in Linux
Swap File System in Linux
RHCSA certification Complete Road Map
New password:
To create group and add users to group, repeat the same steps create and add
multiple groups
finance:x:1005:ravi
File Permissions
As per above screenshot permission of the file / directory can only given to User,
Group and Others. User ownership and Group ownership.
How to restrict particular user, group has full permissions to file / directory
How to provide an file / directory permissions to user / group without
chaning existing ownership
All the above conditions will be possible by using POSIX Access Control List –
ACL
Let’s see how can we acheive above conditions practically
# file: test1
# owner: root
# group: root
user::rw-
group::r--
other::r--
# file: root/ARK-ACL/
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
As per above output we are able to read test1 file but we are not able to write test1
file
Let’s provide write access and see
# file: test1
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
# file: acltest
# owner: root
# group: root
user::rw-
group::r--
group:finance:rwx
mask::rwx
other::r--
finance:x:1005:ravi
Test
^C
Test
ravi user part of finance group so when we provide permission to finance group
automatically user ravi will get an access
Restrict particular user from group has full
permissions
In this scenario restrict particular user from group. Group finance has full access
but member of finance group kumar user restricted. See below example
finance:x:1005:ravi,kumar
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
group:finance:rwx
mask::rwx
other::---
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
group:finance:rwx
mask::rwx
other::---
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
mask::r--
other::---
To replicate one of the file ACL permissions to another file. In this example we are
going to replicate test1 file ACL to acltest file.
[root@Techtutorials ARK-ACL]# getfacl test1
# file: test1
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
mask::r--
other::---
# file: acltest
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
Conclusion
POSIX Access Control List is extended permissions which are used provide access
to more users / groups, who are not owners of user:group.
Thanks for the read, Please provide your valuable feedback on the same.
Related Articles
Setup your own Linux Lab using VMWare workstation
Setup Your Own Linux Lab Customize your home network settings
RHEL 7 Installation Step by Step Guide
Setup Linux Lab Server Step by Step Guide
whenever you schedule a cronjob with particular user the same cronjob will run
using same user, ensure user is having execution permission to the user.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# | | | | |
# crontab -e
* * * * * sh /scripts/everyminute.sh
1,2,3,4,5,6,7,8,9,10......60 * * * * sh /scripts/everyminute.sh
*/1 * * * * sh /scripts/everyoneminute.sh
*/5 * * * * sh /scripts/testscript.sh
5,10,15,20,25,30,35,40,45,50,55,0 * * * * sh /scripts/testscript.sh
OR
0,30 * * * * sh /scripts/FS-Monitoring.sh
0 * * * * sh /scripts/everyhour.sh
@hourly sh /scripts/everyhour.sh
0 */3 * * * sh /scripts/cronjob-every-3hours.sh
OR
* 0,3,6,9,12,15,18,21 * * * sh /scripts/cronjob-every-3hours.sh
59 23 * * * sh /scripts/daily-report.sh
OR
@daily sh /scripts/daily-report.sh
0 * * * 0,2,4,6 sh /scripts/every-alternate-day.sh
8. Run cronjob first and Second Saturday
of the month
it means that cronjob should run first Saturday of the month and Second Saturday
of the month, remaining Saturdays cron should not run. Detailed explanation of
below example is yet any cose first Saturday will fall from 1-7 it means range from
1st date to 7th date. Second Saturday may fall from 15th to 21st Dates.
0 1 1-7,15-21 6 /scripts/every-first-second-sat.sh
0 0 * * 0 sh /scripts/every-week.sh
OR
@weekly sh /scripts/every-week.sh
0 0 1 * * sh /scripts/every-mont-1st.sh
OR
@monthly sh /scripts/every-month.sh
OR
Linux distributions also have /etc/cron.* directory, scripts in this location will be
executed by root privileges
# | | | | |
Be VERY careful when using the percent (%) sign in your command. Unless they are
escaped \% they are converted into newlines and everything after the first non-escaped
% is passed to your command on stdin.
Picture 1. SELinux
As a example if you see above Picture 1 Whenever outside client request for a data
to access from Linux Server, SELinux will verify requested data port is allowed
from SELinux, It will verify process SELinux context is enabled and File security
context enabled. Three layer security system. This security will work only when
SELinux is in enforcing mode.
SELinux is a set of security rules that determine which process can access which
directories, files and ports. Every file, process, port and directory has a special
label called a SELinux context.
SELinux label context are user, role, type and sensitivity. The type context names
end with “_t“
To display or set SELinux contexts with option “Z”:
SELinux Modes:
SELinux modes are three types :-
1. Enforcing Mode
2. Permissive Mode
3. Disabled Mode
Enforcing Mode: Default mode which will enforce and enabled the SELinux
security on your system. In this mode SELinux logs and protects.
Permissive Mode: This mode can be used to temporarily allow access to content
that SELinux is restricting. No reboot required to go from enforcing to permissive
vice versa. This mode is useful for troubleshooting SELinux security issues. When
SELinux is in permissive mode it will not deny the access it will only log.
Disabled Mode: Completely disables SELinux your system. Your system reboot is
required to disable SELinux entirely or to get disabled mode to enforcing. Until
unless you reboot your machine after disable it will not effect.
For the first time when you change SELinux from disable mode to enforcing mode
SELinux will relabel all the files and processes from context rules
Change SELinux modes
To check SELinux security status
Disabled
SELINUX=enforcing
SELINUXTYPE=targeted
Enforced mode
Enforcing
Permissive
To enable port
http_port_t tcp 15000, 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
ftpd_anon_write --> on
Conclusion
SELinux security context is highly improved in the newer version of Linux RHEL
7 / Centos 7 / Fedora 24.
That’s it.
Please do comment your feedback on the same
Related Articles: Firewald Kerberized NFS
Book download: Download Security Intelligence
Server Profile:
Packages: nfs-utils*
Daemon Name: nfs-service
Port Number: 2049
Config file path: /etc/exports
Above commands will enable the firewall ports from server to client
Create and Configure NFS share
# mkdir /ravi
# vim /etc/exports
/ravi 192.168.4.0/24(rw)
# exportfs -avr
# showmount -e NFS-SERVER-IP
# showmount -r 192.168.4.20
To see the NFS shares, which are shared from NFS server
Manually mounting the NFS shares using mount command
# df -h
Now you should to see an mount point /mnt/nfs
That’s it very easy and simple way to configure nfs server
Conclusion
You learn that how to install and configure NFS server in Linux
Please do comment your feedback on the same
File system Usage Monitoring Script
Reset root user password in RHEL 7
Stale File Handle Error Resolution
RHCSA video tutorial
public
As per above output public is the default zone we can also set other zone as
default. Using multiple zones we can mange firewall rules in very flexible
way. As a Example when we change machine network we can just change
default zone to other so that default zone rules will be applicable. Yet any
point of time one zone should be in active. firewalld installation configuration rhel 7
Step 6: Change Default Zone & verify active zone
success
home
interfaces: eno16777736
0.3.9
eno16777736
success
success
[root@server ~]# firewall-cmd --list-all [List all open ports, services and all]
interfaces: eno16777736
sources:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
Adding and Removing services to the firewall. By default when you add /
remove service to firewall it will enable associated port in background
Step 15: List, Add & Remove Services to firewall
rules
success
[root@server ~]# firewall-cmd --permanent --add-service=https
success
<zone>
<short>Public</short>
<service name="dhcpv6-client"/>
<service name="http"/>
<service name="ssh"/>
<service name="https"/>
<service name="mysql"/>
</zone>
success
success
Conclusion
Firewalld service will use ipchains to inject firewall rules. Firewall is used to
enable port level security which will filter incoming and out going packets
in newer versions of Linux such as RHEL 7 and Centos 7. In Ubuntu Linux
there is no firewalld is enabled.
Thanks for reading please do comment your feedback on the same.
That’t it about Firewalld.
Related Posts
Multi User Samba installation and configuration
Enabling SSL certificate along with http
Simple way to create samba server
SEO Keywords
kadmin: quit
:wq
/nfssecure *.arkit.co.in(rw,sec=krb5p)
:wq
# setsebool -P nfsd_anon_write 1
:wq
:wq
Now login as ldapuser1 and try to access the nfssecure share it will be
accessible. You can also write data to that share path.
Conclusion
kerberized NFS server is highly secured and encrypted communication.
NFS kerberized share can’t be accessible by other users who does not have
permission to NFS share within the same client.
Thanks for the read please provide your valuable comments on the same
ldapuser1:*:1001:1001:ldapuser1:/home/ldapuser1:/bin/bash
-bash-4.2$
/misc /etc/auto.misc
/home /etc/auto.ldapuser
* -rw 192.168.4.15:/home/&
Now restart autofs service
ln -s '/usr/lib/systemd/system/autofs.service' '/etc/systemd/system/multi-
user.target.wants/autofs.service'
[ldapuser1@ldapclient1 ~]$
Advantages
Accessing CIFS shares across the multiple environments
Sharing Printer using SMB
Mount windows CIFS shares to Linux
Fully Secured shares using user authentication
ln -s '/usr/lib/systemd/system/smb.service' '/etc/systemd/system/multi-
user.target.wants/smb.service'
ln -s '/usr/lib/systemd/system/nmb.service' '/etc/systemd/system/multi-
user.target.wants/nmb.service'
Starting SMB and NMB services, use below mentioned commands to start required
services
# mkdir /arkit_share
# ls -ldZ /arkit_share
drwxr-xr-x. root root system_u:object_r:samba_share_t:s0 /arkit_share
As shown above when you applied an SELinux context to particular directory you
can see using ls -ldZ command. Change directory permissions for user
# ls -ld /arkit_share/
# ls -ld /arkit_share/
Create an normal user with restricted shell access then convert the same user as
samba user. Below is the command to verify samba user is correctly created or Not
# pdbedit -L -v
Configuring samba / CIFS shares
Edit the configuration file to share directory using SMB / SAMBA server.
/etc/samba/smb.conf
# vim /etc/samba/smb.conf
[CIFS_Share]
comment = CIFS share for windows clients
path = /arkit_share
browseable = yes
valid users = arkit
writable = yes
success
# firewall-cmd --reload
success
Installed:
cifs-utils.x86_64 0:6.2-7.el7
Complete!
# mkdir /cifs
Now Enable and Start SMB service. Enabling service which will
automatically start the smb service immediate after server reboot.
# mkdir /arkit-multiuser
# ls -ldZ /arkit-multiuser/
success
# firewall-cmd --reload
success
# useradd ravi
# useradd ramana
# useradd srikanth
# smbpasswd -a ravi
# smbpasswd -a ramana
# smbpasswd -a srikanth
# pdbedit -L -v
# groupadd IT
Configuring the Samba share with multi user support. Edit the
configuration file and add the configuration yet end of config file
username=ravi
password=redhat
Open /etc/fstab file and mount the samba share permanently
# mount -a
now let login to other user and check the CIFS share visibility and access
Related Articles
Linux Tutorial
CIFS Share Single USer
Video tutorial
HowTo Install KVM Hypervisor
RHEL 7 Kernel-Based Virtual
Machine
BY ARK · PUBLISHED JUNE 23, 2017 · UPDATED AUGUST 19, 2017
We have many hypervisor’s in IT industry but opensource solutions are very
popular. KVM is one of it. KVM stands for Kernel-Based Virtual Machine Using
KVM we can run multiple machines within one server. It will support multiple
operating systems Like: Windows, SUSE, Centos, Ubuntu and Etc.. In this Article
we are going to see HowTo Install KVM Hypervisor (Kernel-Based Virtual
Machine) RHEL 7/Centos 7.
KVM is called as kernel-Based because whenever you install packages which goes
and load from kernel level modules.
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm
constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf
eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm
pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm arat
epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
Package Selection
Software Selection
Select Either Virtualization Host Or Server GUI and Select Virtualization selection
Prerequisites and required packages you have to install in order to get KVM
functionality enabled
# yum install qemu-kvm qemu-img libvirt virt-install libvirt-python virt-manager
virt-install libvirt-client virt-viewer
kvm 554609 0
Or
Start Virt-Manager
By Default virtual machines supportable files are going to store in
/var/lib/libvirt/images/ make sure before start virt-manager you have enough space
to deploy /create virtual machine.
virt-manager we can either from command line or GUI ( install KVM
Hypervisor )
From GUI Click on Applications –> System Tools –> Virtual Machine
Manager
Command Line
# virt-manager
Click on the Icon to create New Virtual Machine from GUI Mode
Creating Virtual Machine using KVM
Select Appropriate option to load Operating system in this case i am selecting ISO
or CD-ROM and Click Forward
Select ISO
You have ready with .iso file for installing operating system, copy .iso file to base
Linux machine to attach. Browse and attach ISO file click Forward
CPU and Memory
Provide Appropriate CPU’s and Memory (RAM) for virtual machine and Click
Forward
Disk Space
Give virtual Machine name, Select Network options and Click Finish
Instead of going trough all the above steps simply create Virtual Machine using
command line
That’s it about Install KVM Hypervisor RHEL 7 Kernel-Based Virtual Machine
Related Articles
Setting Up Linux Lab at Home
Introduction to Linux Operating System Centos 7
Logical Volume Manager
PXE Boot server configuration step by
step Guide
BY ARK · PUBLISHED MARCH 20, 2016 · UPDATED MAY 17, 2018
Preboot execution Environment (PXE Boot, sometimes pronounced as pixie)
specification describes a standardized client-server environment that boots a
software assembly, retrieved from a network, on PXE-enabled clients. On the
client side it requires only a PXE-capable network interface controller (NIC), and
uses a small set of industry-standard network protocols such as DHCP and TFTP.
The concept behind the PXE originated in the early days of protocols like
BOOTP/DHCP/TFTP, and as of 2015 it forms part of the Unified Extensible
Firmware Interface (UEFI) standard. Given fast and reliable local area networks
(LANs), PXE is the most frequent choice for operating system booting, installation
and deployment.
Assume if there is no PXE Boot server we have to have more OS CD/DVD’s to
install multiple clients and require manual intervention to configure partitions,
software packages users creation so an.
PXE Boot is very useful when we looking to re-image / install more clients yet a
time.
Server OS – RHEL 7 / Centos 7
Note: Observe carefully and do not miss even single character of config files,
which may result un-successful PXE Boot Server.
[root@Ark-PXEBootServer ~]# ip a
[localyum]
baseurl=file:///var/ftp/pub/
enable=1
gpgcheck=0
Select the option if you want enable Firewall configuration after the client
installation
in this GUI tool there is no option to include packages, we have to add them by
manually
in Post installation Script if you want to execute any script after the installation you
can include them
Save the file to /var/ftp/pub/ location
Now edit the configuration file and add packages list to that config file
we can make use of anaconda-ks.cfg file add blod characters to
your /var/ftp/pub/auto.cfg file
%packages
@base
@compat-libraries
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
kexec-tools
kexec-tools
%end
%post
useradd ravi
echo "ravi" |passwd --studin redhat
%end
# default: off
# description: The tftp server serves files using the trivial file transfer \
service tftp
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
default vesamenu.c32
timeout 600
display boot.msg
label ws
menu label Unattend Installation of RHEL7
kernel vmlinuz
append biosdevname=0 ksdevice=link load_ramdisk=1 initrd=initrd.img network
ks=http://192.168.4.13/pub/auto.cfg noipv6
label si
menu label RHEL 7 ^Standard Installation
kernel vmlinuz
append biosdevname=0 ksdevice=link load_ramdisk=1 initrd=initrd.img
success
success
success
success
success
If you would like to install new bootloader then select to install a new bootloader
or else select do not install the bootloader. If you’re interested in setting up the
GRUB password you can also do that by selecting the GRUB password option and
provide a password.
Partition Information Tab
Using Partition Information tab declare partition details which are the partitions
you would like to create.
Clear Master Boot Record — Will clear before boot record if any
Do Not Clear Master Boot Record — It will not touch the previous boot
record
Remove all – Will remove all existing partitions and create new
Remove only existing Linux partitions – it will not delete NTFS partitions
Preserve existing partitions – Will does not touch any of existing partitions
Note: There is no option to create LVM partitions in this tool, Add config
definition after file generation.
Authentication Tab
Authentication Configuration is the option where you can select the option to join
to NIS, LDAP, Kerberos and local encrypted authentication
Firewall Options
Display Configuration
Note: Package option did not have an option to select packages, after generating
config file will add
Pre-installation script
Before starting installation would like to run any script you can include
Post-Installation script
%packages
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@mariadb
@multimedia
@print-client
@x11
kexec-tools
Install HTTP packages, enable web service and start web service. Enable service
and port number in a firewall. Automated OS installation
success
success
success
copy the auto answer file and RHEL7 media to default path /var/www/html
# firewall-cmd --reload
Boot Menu
When you see above boot menu options do not select anyone just press Escape
button
Hi Enter.
That’s It. Your Installation process starts and will complete
automatically. Automated OS installation
Step 2: POST
(Power-on-Self-Test) is diagnostic testing sequence all the computer parts will
diagnose there own.
Step 3: BIOS
(Basic Input Output System) BIOS is program which verifies all the attached
components and identifies device booting order
Based on device order BIOS will first boot device, in this case we are considering
as HDD as first boot device.
Step 4: MBR
(Master Boot Record) contains Boot Loader, Partition information
and Magic Blocks
Boot loader – contains boot loader program which is 446 bytes in size.
64 Bytes of partition information will be located under MBR, which will
provide / redirects to actual /boot partition path to find GRUB2
2bytes are magic bytes to identify errors
Step 5: GRUB
(Grand Unified Boot Loader) configuration file located in /boot/grub2/grub.cfg
which actually points to initramfs is initial RAM disk, initial root file system will
be mounted before real root file system.
Basically initramfs will load block device drivers such as SATA, RAID .. Etc. The
initramfs is bound to the kernel and the kernel mounts this initramfs as part of a
two-stage boot process.
Step 6: KERNEL
GRUB2 config file will invoke boot menu when boot is processed, kernel will
load. When kernel loading completes it immediately look forward to start
processes / Services.
When you type wrong password above authentication failure screen will appear.
Then in the top right corner there is a power button will appear as shown in below
screenshot, click on power button then click restart
Click Restart
Server will restart.
When server is loading boot menu then press any key (Arrow Key / Space Bar) to
stop the boot menu, then press ‘e’ to edit the kernel line. Whenever kernel lines are
edited below screen will appear
in kernel line where you see “linux16” word go to end of that line and
type rd.break console=tty1 then press CTRL+X
server will continue to boot in single user mode. File system in this mode will be in
Read Only mode. So we have to remount the file system as Read / Write then only
we can able to make a change in configuration files. when we change an Password
of root user encrypted password will be stored in /etc/shadow.
Keywords:
reset root user password rhel7, reset root user password centos 7, changing root
user password rhel7, how to reset root user password in linux
we have to add init=/bin/bash after the rhgb quiet in kernel line linux16
To relabel the SELinux context just create an new file under / which will
automatically reset required SELinux context to all the files
Server Profile:
1. Packages: MariaDB,MariaDB-server,MariaDB-libs
2. Daemon Name: MariaDB
3. Port Number: 3306
4. Configuration file path: /etc/my.cnf
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Installed:
Dependency Installed:
Complete!
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-
user.target.wants/mariadb.service'
success
success
How you would like to configure the MariaDB instance, Networking without
Networking.
Networking = Enable instance networking so that we can connect to instance from
remote machine
Without Networking = We can’t connect instance from the remote machine just we
can use within the server
:wq
New password:
... Success!
Remove anonymous users? [Y/n] y
... Success!
... Success!
... Success!
... Success!
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
After installation of MariaDB server, database root user password is blank. So for
security to reset the root password.
Note: Without database root password we can able to login
Now connect to Maria DB server with root password first time
Enter password:
MariaDB [(none)]>
Conclusion
Install of MariaDB 10.2 RHEL 7 / Centos 7 is completed. MariaDB is the
replacement of Mysql in a newer version like RHEL 6 / RHEL 7 / Centos 7.
Please do comment your feedback. Stay tuned for upcoming article Database
creation, Creating Tables, user creation, granting privileges, Inserting, Updating
and deleting records
3. Case insensitive
word using grep -i (ignore case sensitive)
To grep text as case insensitive we have to use -i option. So it matches all the
words such as “first”, “FIRST” and “First” case insensitively as shown below.
If you want to set this option as permanent we have to set the environment variable
which basically highlights the matched pattern with foreground color black and
background color yellow (shown below in the snap).
The set display attributes list:
0 Reset all attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden
Foreground Colors
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
Background Colors
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White
demofile
From the above output you can come to know when all the messages has got
interrupt. Just like ^ matches the beginning of the line only if it is the first
character, $ matches the end of the line only if it is the last character in a regular
expression.
This grep command most useful commands when we want to search for some
strings in the files, searching for the particular files on the directories.
Do comment you feedback about this article
while providing the permanent IP address to the DHCP client it will collect its
MAC address. Provided IP address will not changed until DHCP server lease time
expires.
DHCP Server Profile
Packages : dhcp*
Service : dhcpd.service
Config file : /etc/dhcp/dhcpd.conf
Port Number: 67
Installing DHCP server required packages using yum
you may receive above error some times don’t worry after we set and DHCP server
configuration restart service will work normally
dhcp server configuration verification we can verify the config file using below
command, will tell you where is the configuration went wrong
collect client machine MAC address simple trick, ping to all the clients which you
want configure MAC binding then run # arp -a command
[root@mail ~]# ping 192.168.4.12
^C
host nfsserver {
fixed-address 192.168.4.12;
}
as shown above we have to add host short name MAC address and host IP address.
If you want to configure MAC binding for 50 servers then copy the same line and
paste below 50 times and change there MAC address, hostname and IP address
accordingly.
test configuration file before restarting DHCP server
That’s it restart network services in client and verify specified IP address it will
get. If you restart 100 times also you will get same IP address from DHCP lease.
First start named-chroot before named.service because it will generate config files
# vim /var/named/chroot/etc/named.conf
options {
# vim /var/named/chroot/etc/named.rfc1912.zones
zone "arkit.com" IN {
type master;
file "arkit.for.zone";
allow-update { none; };
};
zone "4.168.192.in-addr.arpa" IN {
type master;
file "arkit.rev.zone";
allow-update { none; };
};
as shown above copy the zone configuration lines (Default line numbers from 19 to
23) and paste there itself. copy the Reverse zone configuration line (Default line
number 31 to 35) and paste there itself. Now modify the copied lines as per your
requirement ( which are in pink color).
zone “arkit.com” IN { in this line whatever the domain name you would like to
configure mention that
file “arkit.for.zone”; file name whatever the file name you want you can give
zone “4.168.192.in-addr.arpa” IN { in this line write your IP address in reverse
way
file “arkit.rev.zone”; file name whatever the file name you would like.
Save configuration file and Exit
# cd /var/named/chroot/var/named
# cp named.localhost arkit.for.zone
# cp named.loopback arkit.rev.zone
# vim arkit.for.zone
$TTL 1D
@ IN NS techtutorial.arkit.com.
@ IN NS slave.arkit.com.
$TTL 1D
Note: Even do not miss single (dot) which will not start your named service
# firewall-cmd --reload
search arkit.com
domain arkit.com
nameserver 192.168.4.128
verify master dns server
# nslookup arkit.com
#dig arkit.com
#host 192.168.4.128
#dig -x 192.168.4.128
Prerequisites
1. Create DNS entry to resolve you web server name
2. Web browser to access the web server
Server profile
Package Name: httpd*
Daemon Name: httpd
Config File: /etc/httpd/conf/httpd.conf, /etc/httpd/conf.d/ANYNAME.conf
Port Numbers: 80 (HTTP) and 443 (HTTPS)
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-
user.target.wants/httpd.service'
service enable – which means whenever you restart server, service should
automatically enable
service start – Normally starting service
As per the above commands web server is installed and started
success
# firewall-cmd --reload
success
web server ports are 80 and 143 default for HTTP and HTTPS
in RHEL 7 and Centos 7 version instead of port numbers we can directly mention
the service which will automatically take its related default port
if you would like to mention the port use below commands
success
# firewall-cmd --reload
success
# cat /etc/httpd/conf.d/main.conf
<VirtualHost *:80>
ServerAdmin root@arkit.co.in
ServerName server1.arkit.co.in
DocumentRoot /var/www/html/
</VirtualHost>
<Directory "/var/www/html/">
AllowOverride none
Require all granted
</Directory>
# vim /etc/httpd/conf.d/main.conf
Syntax OK
# cat /var/www/html/index.html
Client side
Web server testing, as you created above test file with some text in it. Now go to
client machine and type server IP / Name to test your web server is working or not
That’s it about Apache / HTTP service installation and configuration.
Please provide your valuable feedback on the same
For an standard SSL it will not show an PadLock but it will show an https protocol.
If you would like to see an listed Certificate authorities in Google chrome
Settings → Show Advanced Settings → HTTPS/SSL → Manage
Certificates (Screenshot is shown below)
Above listed certificates are pre-
loaded when you install an browser
Now Let’s Go back our real installation and configuration of Secure web server
using SSL certification in RHEL 7
First install an http packages
Now create an sample html file in default web location /var/www/html/ directory
# vim /var/www/html/index.html
<h1>Secure Site</h1>
</h2> Secure Site is Opened </h2>
# firewall-cmd --reload
In RHEL 7 we can mention directly the service name which will automatically
enables the appropriate port number in the backend
This is purely demo purpose only (Generating an SSL Certificate)
# cp /etc/httpd/conf.d/ssl.conf /opt/
in Default ssl.conf file delete lines from 1 to 69 until ‘SSLEngine on‘ Key word
appears
below is the final configuration file for configuring the SSL certificate
# vim /etc/httpd/conf.d/arkit.conf
<VirtualHost *:443>
ServerAdmin root@localhost
ServerName TechTutorial.arkit.com
DocumentRoot /var/www/html
SSLEngine on
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLHonorCipherOrder on
SSLCertificateFile /etc/pki/tls/certs/arkit.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/arkit.com.key
SSLCertificateChainFile /etc/pki/tls/certs/arkit.com.csr
</VirtualHost>
Client Side
Browse the website which should load with https://arkit.co.in
That’s it. you successfully configure secure web server with SSL certificate in
RHEL 7 / Centos 7
Please do provide your valuable feedback on the same
SEO Keywords: secure web Server, What is Web Server, Web Server Installation
and configuration, HTTP Service Enable.
Related Articles
Install and Configure HTTPD
Success
Success
OR
[root@TechTutorials ~]# firewall-cmd --permanent --add-port=123/tcp
Success
Success
edit main configuration file and make changes as required to configure NTP
restrict default kod nomodify notrap noquery nopeer -->>> allows other clients
to query time server
restrict -6 default kod nomodify notrap noquery nopeer --->> allows forces DNS
resolution to IPV6 address resolution
:wq
restrict 127.0.0.1
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
:wq
That’s about install and configure NTP server and client in RHEL 7
Please do comment your feedback
insert, update, delete, create mariadb
databases records
BY ARK · SEPTEMBER 11, 2016
As we see installation and configuration of mariadb server which is the new
replacement for MySql Server. After installation we have to create database,
Create users, grant permissions to users, Insert, update, delete, create mariadb
databases records. Create tables and insert, update and delete data.
Enter password:
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
To connect mariadb server, we have to use mysql command only. Mariadb will use
same features as like MySql.
+--------------------+
| Database |
+--------------------+
| information_schema |
| contacts |
| mysql |
| performance_schema |
+--------------------+
+--------------------+
| Database |
+--------------------+
| information_schema |
| contacts |
| emploees |
| employees |
| mysql |
| performance_schema |
+--------------------+
Connection id: 3
Database changed
create table with specified column names and list the tables. int (integer
values) only number 0-9 are allowed. varchar (alpha and number
allowed) a-z, 0-9.
MariaDB [emploees]> create table employee (id int(10), name varchar(50), empid
varchar(20), number int(10), mail_id varchar(10));
+--------------------+
| Tables_in_emploees |
+--------------------+
| employee |
+--------------------+
+---------+-------------+------+-----+---------+-------+
+---------+-------------+------+-----+---------+-------+
+---------+-------------+------+-----+---------+-------+
+------+------+-------+------------+------------+
+------+------+-------+------------+------------+
+------+------+-------+------------+------------+
1 row in set (0.00 sec)
+------+------+-------+------------+------------+
+------+------+-------+------------+------------+
+------+------+-------+------------+------------+
+------+-------+-------+------------+------------+
+------+-------+-------+------------+------------+
+------+-------+-------+------------+------------+
+------+-------+-------+------------+------------+
+------+-------+-------+------------+------------+
+------------------------------------------------------+
| EXISTS(SELECT 1 FROM mysql.user WHERE user = 'ravi') |
+------------------------------------------------------+
| 1 |
+------------------------------------------------------+
Related Articles
10 reasons to migrate databases from MySql to Mariadb
Installation and configuration of MariaDB
Creating Partition
Here i have new HDD called /dev/sdb 10GB with no partitions
Changes will remain in memory only, until you decide to write them.
Update to Kernel when we create new partition, partition table should be up-to date
other wise partition will not be listed, use below command to update
[root@iSCSIServer ~]# partprobe /dev/sdb
Installed:
targetcli.noarch 0:2.1.fb37-3.el7
Dependency Installed:
Complete!
targetcli command
Create Storage Object and Create IQN (iSCSI Qualified Name) to map LUN. This
IQN we should take from iSCSI client machine, either we can create our own.
Get IQN number from Client machine and add to server for mapping disk from
server.
InitiatorName=iqn.1994-05.com.redhat:ba1abe3b1a4
ln -s '/usr/lib/systemd/system/iscsid.service' '/etc/systemd/system/multi-
user.target.wants/iscsid.service'
iscsid.service - Open-iSCSI
Loaded: loaded (/usr/lib/systemd/system/iscsid.service; enabled)
Active: active (running) since Sun 2016-10-23 19:19:49 IST; 11s ago
Docs: man:iscsid(8)
man:iscsiadm(8)
Process: 4144 ExecStart=/usr/sbin/iscsid (code=exited, status=0/SUCCESS)
Main PID: 4146 (iscsid)
CGroup: /system.slice/iscsid.service
├─4145 /usr/sbin/iscsid
└─4146 /usr/sbin/iscsid
Created LUN 0.
If your able to see above error while creating portal then do delete default port
0.0.0.0 then create new
/> saveconfig
/> exit
success
success
success
192.168.4.27:3260,1 iqn.1994-05.com.redhat:ba1abe3b1a4
After successful mapping of LUN now you can create file system on LUN, To
Create file system repeat Step 1 (Creating Partition)
Filesystem label=
OS type: Linux
40 block groups
32768 blocks per group, 32768 fragments per group
Enjoy…………….
Related Articles
Could Not Create Networkportal iscsi
What is LVM and How to Create LVM
Creating Swap File System
[root@Techtutorial ~]# nmcli connection add type team con-name team0 ifname team0
config '{"runner": {"name": "activebackup"}}'
[root@Techtutorial ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens36 master
team0
Connection 'team0-port2' (6e57d69e-44d3-4d12-8e6d-dc6e70189800) successfully added
setup:
runner: activebackup
ports:
ens33
instance[link_watch_0]:
link: up
ens36
link watches:
instance[link_watch_0]:
link: up
runner:
as shown above active port is ens33. Now bring down the ens33 and see
as soon as we disconnect / bring down one NIC card other backup NIC will
activate automatically with in Milli seconds.
That’s it..!! NIC Teaming with active backup runner configured and working.
Please provide your review on the same.
Related Articles
tmpwatch Command Linux
Recover Deleted Files RHEL 6
Linux Interview Questions and Answers