Friday, December 28, 2018

RHEL7 - Splunk server installation



[root@server2 network-scripts]# nmcli dev status
DEVICE       TYPE      STATE                                  CONNECTION
virbr0       bridge    connected                              virbr0
eno16780032  ethernet  connected                              ens192
eno33559296  ethernet  connected                              devi2
eno50338560  ethernet  connected                              team0-port1
eno67109888  ethernet  connected                              team0-port2
virbr0-nic   ethernet  connected                              virbr0-nic
team0        team      connected                              team0
eno83889152  ethernet  connecting (getting IP configuration)  team-port1
eno2         team      connecting (getting IP configuration)  team1
lo           loopback  unmanaged                              --
[root@server2 network-scripts]# ls -l ifcfg-devi2
-rw-r--r--. 1 root root 308 Dec 23 13:01 ifcfg-devi2
[root@server2 network-scripts]# more ifcfg-devi2
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.10.122
PREFIX=24
GATEWAY=192.168.10.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=devi2
UUID=025ddafc-d79e-4b5f-a3df-23bd9c60ba34
DEVICE=eno33559296
ONBOOT=yes
[root@server2 network-scripts]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.10.1    0.0.0.0         UG        0 0          0 eno16780032
192.168.10.0    0.0.0.0         255.255.255.0   U         0 0          0 eno16780032
192.168.10.0    0.0.0.0         255.255.255.0   U         0 0          0 team0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0
[root@server2 network-scripts]# nmcli connection up devi2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/25)
[root@server2 network-scripts]# ifconfig | more


[root@server2 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@server2 network-scripts]# cd
[root@server2 ~]# ls
anaconda-ks.cfg  createusers        Downloads        random     testfile
ca.crt           createweb.sh       Music            random1    Videos
ca.csr           createweb.sh.orig  original-ks.cfg  script.sh
ca.key           Desktop            Pictures         stderr
create12         Documents          Public           Templates

[root@server2 ~]# cd Downloads/
[root@server2 Downloads]# pwd
/root/Downloads
[root@server2 Downloads]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.5G  3.6G  56% /
devtmpfs                 905M     0  905M   0% /dev
tmpfs                    921M  320K  920M   1% /dev/shm
tmpfs                    921M   64M  858M   7% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                497M  180M  318M  37% /boot
tmpfs                    185M   32K  185M   1% /run/user/0
tmpfs                    185M   20K  185M   1% /run/user/1000
/dev/sr0                 507M  507M     0 100% /run/media/kamal/CentOS 7 x86_64
tmpfs                    921M   76K  921M   1% /tmp
[root@server2 Downloads]# rpm -ivh splunk-7.2.3-06d57c595b80-linux-2.6-x86_64.rp                                                      m
warning: splunk-7.2.3-06d57c595b80-linux-2.6-x86_64.rpm: Header V4 RSA/SHA256 Si                                                      gnature, key ID b3cd4420: NOKEY
Preparing...                          ################################# [100%]
useradd: cannot create directory /opt/splunk
Updating / installing...
   1:splunk-7.2.3-06d57c595b80        ################################# [100%]
complete
[root@server2 Downloads]# ls -ld /opt/splunk
drwxr-xr-x. 8 splunk splunk 222 Dec 28 23:57 /opt/splunk
[root@server2 Downloads]# cd /opt/splunk
[root@server2 splunk]# ls
bin            license-eula.txt
copyright.txt  openssl
etc            README-splunk.txt
ftr            share
include        splunk-7.2.3-06d57c595b80-linux-2.6-x86_64-manifest
lib
[root@server2 splunk]# /opt/splunk/bin/^C
[root@server2 splunk]# cd /opt/splunk/bin/
[root@server2 bin]# ls
bloom                   jars                            scripts
bottle.py               jp.py                           scrubber.py
btool                   jsmin                           searchtest
btprobe                 locktest                        setSplunkEnv
bzip2                   locktool                        shc_upgrade_template.py
cherryd                 mongod                          signtool
classify                mongod-3.4                      slim
ColdStorageArchiver.py  mongod_cc                       splunk
coldToFrozenExample.py  node                            splunkd
copyright.txt           openssl                         splunkdj
dbmanipulator.py        parsetest                       splunkmon
exporttool              parse_xml_buckets.py            splunk-optimize
fill_summary_index.py   pcregextest                     splunk-optimize-lex
genAuditKeys.py         pid_check.sh                    srm
genRootCA.sh            python                          tarit.py
genSignedServerCert.py  python2                         tocsv.py
genSignedServerCert.sh  python2.7                       tsidxprobe
genWebCert.py           recover-metadata                tsidxprobe_plo
genWebCert.sh           rest_handler.py                 tsidx_scan.py
importtool              runScript.py                    untarit.py
installit.py            safe_restart_cluster_master.py  walklex
[root@server2 bin]# ls -l splunk
splunk               splunkdj             splunk-optimize
splunkd              splunkmon            splunk-optimize-lex
[root@server2 bin]# ls -l splunk^C
[root@server2 bin]# cp /root/
anaconda-ks.cfg    .createusers.swp   .ICEauthority      script.sh
.bash_history      createweb.sh       .lesshst           .ssh/
.bash_logout       createweb.sh.orig  .local/            stderr
.bash_profile      .cshrc             .mozilla/          .targetcli/
.bashrc            .dbus/             Music/             .tcshrc
.cache/            Desktop/           .mysql_history     Templates/
ca.crt             Documents/         original-ks.cfg    testfile
ca.csr             Downloads/         Pictures/          Videos/
ca.key             .elinks/           Public/            .xauth2PhtaQ
.config/           .esd_auth          random             .Xauthority
create12           .gnome2/           random1
createusers        .gnome2_private/   .rnd
[root@server2 bin]# cp /root/Downloads/Splunk-Enterprise-v7.1.2-x86_Technet24/
CRACK/
ReadMe.txt
splunk-7.1.2-a0c72a66db66-x86-release.msi
splunk-7.1.2-a0c72a66db66-x86-release.msi.md5
Technet24.url
[root@server2 bin]# cp /root/Downloads/Splunk-Enterprise-v7.1.2-x86_Technet24/CR                                                      ACK/
adsldpc.dll                    traitor.dll
splunkEnterpriseTechnet24.lic
[root@server2 bin]# cp /root/Downloads/Splunk-Enterprise-v7.1.2-x86_Technet24/CR                                                      ACK/splunkEnterpriseTechnet24.lic .
[root@server2 bin]# sp
spacewalk-channel  spdsend            spice-vdagent      split
spd-conf           speaker-test       spice-vdagentd     sprof
spd-say            speech-dispatcher  splain
[root@server2 bin]# pwd
/opt/splunk/bin
[root@server2 bin]# /opt/splunk/bin/./splunk start
SPLUNK SOFTWARE LICENSE AGREEMENT

............
modification, disclosure or transfer of this commercial product and data, is
restricted in accordance with 48 C.F.R. Section 12.211, 48 C.F.R. Section
12.212, 48 C.F.R. Section 227.7102-2, and 48 C.F.R. Section 227.7202, as
applicable. Consistent with 48 C.F.R. Section 12.211, 48 C.F.R. Section
--More--(52%)


Splunk Software License Agreement 10.01.2018
Do you agree with this license? [y/n]:      y
Do you agree with this license? [y/n]: y

This appears to be your first time running this version of Splunk.

Splunk software must create an administrator account during startup. Otherwise,
Create credentials for the administrator account.
Characters do not appear on the screen when you type in credentials.

Please enter an administrator username: root
Password must contain at least:
   * 8 total printable ASCII character(s).
Please enter a new password:
Please confirm new password:
Copying '/opt/splunk/etc/openldap/ldap.conf.default' to '/opt/splunk/etc/openldap/ldap.conf'.
Generating RSA private key, 2048 bit long modulus
.......................................+++++
........................................................................................+++++
e is 65537 (0x10001)
writing RSA key

Generating RSA private key, 2048 bit long modulus
..............................................................................................................+++++
........+++++
e is 65537 (0x10001)
writing RSA key

Moving '/opt/splunk/share/splunk/search_mrsparkle/modules.new' to '/opt/splunk/share/splunk/search_mrsparkle/modules'.

Splunk> Like an F-18, bro.

Checking prerequisites...
        Checking http port [8000]: open
        Checking mgmt port [8089]: open
        Checking appserver port [127.0.0.1:8065]: open
        Checking kvstore port [8191]: open
        Checking configuration...  Done.
                Creating: /opt/splunk/var/lib/splunk
                Creating: /opt/splunk/var/run/splunk
                Creating: /opt/splunk/var/run/splunk/appserver/i18n
                Creating: /opt/splunk/var/run/splunk/appserver/modules/static/cs                                                      s
                Creating: /opt/splunk/var/run/splunk/upload
                Creating: /opt/splunk/var/spool/splunk
                Creating: /opt/splunk/var/spool/dirmoncache
                Creating: /opt/splunk/var/lib/splunk/authDb
                Creating: /opt/splunk/var/lib/splunk/hashDb
New certs have been generated in '/opt/splunk/etc/auth'.
        Checking critical directories...        Done
        Checking indexes...
                Validated: _audit _internal _introspection _telemetry _thefishbucket history main summary
        Done
        Checking filesystem compatibility...  Done
        Checking conf files for problems...
        Done
        Checking default conf files for edits...
        Validating installed files against hashes from '/opt/splunk/splunk-7.2.3-06d57c595b80-linux-2.6-x86_64-manifest'
        All installed files intact.
        Done
All preliminary checks passed.

Starting splunk server daemon (splunkd)...
Generating a 2048 bit RSA private key
...+++++
................................................................................                                                      ........................+++++
writing new private key to 'privKeySecure.pem'
-----
Signature ok
subject=/CN=server2.expanor.local/O=SplunkUser
Getting CA Private Key
writing RSA key
Done
                                                           [  OK  ]

Waiting for web server at http://127.0.0.1:8000 to be available...... Done


If you get stuck, we're here to help.
Look for answers here: http://docs.splunk.com

The Splunk web interface is at http://server2.expanor.local:8000

[root@server2 bin]#


[root@server2 bin]# firewall-cmd --add-port=8000/tcp --permanent
success
[root@server2 bin]# firewall-cmd --reload
success
[root@server2 bin]# firewall-cmd --list-all
public (default, active)
  interfaces: eno16780032 eno33559296 eno50338560 eno67109888 team0
  sources:
  services: dhcpv6-client mysql smtp ssh
  ports: 3306/tcp 8085/tcp 8000/tcp 5423/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

[root@server2 bin]#

Wednesday, December 26, 2018

RHEL - Remove old Kernals on RHEL based systems

Remove old Kernals on RHEL based systems
===================================

1. Check current version of installed Kernel
[root@sam ~]# uname -a
Linux sam.expanor.local 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

2. List all installed Kernels on your system

[root@sam ~]# rpm -q kernel
kernel-3.10.0-229.el7.x86_64
kernel-3.10.0-327.el7.x86_64


3. Remove old kernel packages
- You need to install cleanup package tool which in part of yum-utils package.

[root@sam ~]# yum search yum-utils
[root@sam ~]# yum install yum-utils
Package yum-utils-1.1.31-34.el7.noarch already installed and latest version
Nothing to do

[root@sam ~]# package-cleanup --help | grep old
    usage: package-cleanup --problems or --leaves or --orphans or --oldkernels
    --oldkernels        -> Remove old kernel and kernel-devel packages
[root@sam ~]# package-cleanup --help | grep count
    --count=KERNELCOUNT -> Number of kernel packages to keep on the system (default 2)

# package-cleanup -–oldkernels -–count=1

4. Now review the remaining kernels on your system

[root@sam ~]# rpm -q kernel
kernel-3.10.0-229.el7.x86_64
kernel-3.10.0-327.el7.x86_64

5. Automatically remove old kernels
Edit a file /etc/yum.conf and check the value for installonly_limit=. Change the vlue to the one you like. Just keep minimum of 2 version so set 2 or more number.

Thursday, December 20, 2018

vi editor - arrow key now working properly

By default, we use h, j, k and l keys for navigation on vi/vim text editor.
You can use arrow key to navigate around.
But sometimes, when you press arrow keys in the insert mode, it will insert newlines and prints A, B, C, D capital letters.

To fix this issue, set the following,
:set nocompatible

or add this entry to user's home directory

$ echo "set nocompatible" >> ~/.vimrc
$ echo "set nocompatible" >> ~/.exrc

RHEL - How to Reduce PDF file size

How to Reduce PDF file size

If you have a large size pdf file due to scanned document, you can reduce it using the tool called ps2pdf.
ps2pdf is available on linux based systems and its a part of ghostscript package.

Installation of a software

Redhat based systems
# yum install ghostscript

On Debian based systems
$ sudo apt-get install ghostscript

Compress PDF File In Linux
Once package is installed, run the command below.
$ ps2pdf old_file.pdf new_file.pdf

$ du -sh *.pdf
5M old_file.pdf
500K new_file.pdf

Tuesday, December 18, 2018

RHEL7 - Set up a secure HTTPS server with SSL


  1. Install httpd packages for default page display

Verify that you have httpd package is installed and default page is working as expected.
[root@server2 ~]# rpm -qa | grep httpd
httpd-tools-2.4.6-40.el7.x86_64
httpd-manual-2.4.6-40.el7.noarch
httpd-2.4.6-40.el7.x86_64
[root@server2 ~]# yum install httpd
[root@server2 ~]# echo "This is a test default page" >/var/www/html/index.html
[root@server2 ~]# systemctl status httpd
[root@server2 ~]# systemctl start httpd
[root@server2 ~]# systemctl enable httpd
[root@server2 ~]# elinks http://localhost

  1. Allow http on firewall

Allow apache http port 80 and https port 443

To check run the command
[root@server2 ~]# firewall-cmd --list-all
if you didn't see the ports on output, add them

[root@server2 ~]# firewall-cmd --permanent --add-port=80/tcp
[root@server2 ~]# firewall-cmd --permanent --add-port=443/tcp
[root@server2 ~]# firewall-cmd --reload


  1. Now, Install SSL packages

We need ssl package to generate the keys. Check to see if its already installed.
[root@server2 ~]# rpm -qa | grep mod_ssl
mod_ssl-2.4.6-40.el7.x86_64
[root@server2 ~]# rpm -qa | grep openssl
openssl-1.0.1e-42.el7_1.9.x86_64
openssl-libs-1.0.1e-42.el7_1.9.x86_64

If not installed, install it
[root@server2 ~]# yum install mod_ssl openssl


  1. Now, generate certificates.

a. Generate self-signed certificate (key) with 2048 bit encryption
[root@server2 ~]# openssl genrsa -out ca.key 2048
Generating RSA private key, 2048 bit long modulus
.........................................................................................................................+++
............................................+++
e is 65537 (0x10001)
[root@server2 ~]#

b. Generate certificate signing request (csr)
[root@server2 ~]# openssl req -new -key ca.key -out ca.csr
just follow the prompt.

c. SSL certificate
Note: self-signed certificate (csr of x509 type) is valid for a year.

[root@server2 ~]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
Getting Private key

[root@server2 ~]# ls -ltr
-rw-r--r--. 1 root root 1679 Dec 18 23:07 ca.key
-rw-r--r--. 1 root root  997 Dec 18 23:10 ca.csr
-rw-r--r--. 1 root root 1188 Dec 18 23:11 ca.crt

Once these certificates are created, you need to copy to the right directory location as follows.

[root@server2 ~]# cp ca.crt /etc/pki/tls/certs/
[root@server2 ~]# cp ca.key ca.csr /etc/pki/tls/private/

Note: if you copied these certs from different location, you have
to run the semanage command to apply right context. Just verify ..
for eg,
[root@server2 ~]# wget http://192.168.10.120/certs/ca.crt
[root@server2 ~]# mv ca.crt /etc/pki/tls/certs/
[root@server2 ~]# ls -lZd /etc/pki/tls/certs/
drwxr-xr-x. root root system_u:object_r:cert_t:s0      /etc/pki/tls/certs/
[root@server2 ~]# ls -lZd /etc/pki/tls/certs/ca.crt
-rw-r--r--. root root unconfined_u:object_r:cert_t:s0  /etc/pki/tls/certs/ca.crt
and so on

  1. Now, configure your server with the certificates.

[root@server2 ~]# mkdir /var/www/html/best.expanor.local
[root@server2 ~]# echo "Best.expanor.local" >/var/www/html/best.expanor.local/index.html
[root@server2 ~]# systemctl restart httpd
[root@server2 ~]# cat /etc/httpd/conf.d/spage.conf
<virtualhost 192.168.10.122:443>
        servername best.expanor.local
        documentroot best.expanor.local
        directoryindex  index.html
        sslengine on
        sslcertificatefile /etc/pki/tls/certs/ca.crt
        sslcertificatekeyfile /etc/pki/tls/private/ca.key
</virtualhost>

Note: You append/specify sslengine , sshcertificate file, and sslcertificatekeyfile.

[root@server2 ~]# vi /etc/hosts
192.168.10.122  best.expanor.local
[root@server2 ~]# systemctl restart httpd

Or

You can directly edit ssl.conf file which is created by default.

# vi /etc/httpd/conf.d/ssl.conf
Go to the section <VirtualHost _default_:443>.
Uncomment the DocumentRoot and ServerName line and replace example.com with your domain/ipaddress.

<VirtualHost _default_:443>
DocumentRoot "/var/www/html"
ServerName 192.168.10.122:443

Now, go to line SSLCertificateFile and SSLCertificateKeyFile and change with your cert.

SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Save the file and restart the service
# systemctl restart httpd

Or
[root@server2 ~]# cat /etc/httpd/conf.d/webpage.conf
<virtualhost 192.168.10.122:443>
        servername best.expanor.local
        documentroot /var/www/html/best.expanor.local
        directoryindex  index.html
        sslengine on
        sslcertificatefile /etc/pki/tls/certs/ca.crt
        sslcertificatekeyfile /etc/pki/tls/private/ca.key
</virtualhost>
[root@server2 ~]#

Note: Make sure to add hosts entry of domain
# cat /etc/hosts
192.168.10.122  best.expanor.local

  1. Verify it. Open your browser and type

Sunday, December 16, 2018

Monday, December 10, 2018

RHEL7 - Installing OpenStack



  rubygem-io-console.x86_64 0:0.4.2-34.el7_6
  rubygem-json.x86_64 0:1.7.7-34.el7_6
  rubygem-psych.x86_64 0:2.0.0-34.el7_6
  rubygem-rdoc.noarch 0:4.0.0-34.el7_6
  rubygem-rgen.noarch 0:0.6.6-2.el7
  rubygems.noarch 0:2.0.14.1-34.el7_6

Complete!
[root@ipa ~]# yum install openstack-packstack
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.cogentco.com
 * extras: mirror.cogentco.com
 * updates: mirror.cogentco.com
Package 1:openstack-packstack-12.0.0-2.el7.noarch already installed and latest version
Nothing to do
[root@ipa ~]# clear
[root@ipa ~]# echo "disable selinux"
disable selinux
[root@ipa ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.2G  3.9G  52% /
devtmpfs                 903M     0  903M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M   22M  898M   3% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1                497M  212M  286M  43% /boot
tmpfs                    184M  4.0K  184M   1% /run/user/42
tmpfs                    184M   44K  184M   1% /run/user/1000
[root@ipa ~]# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sda2  centos lvm2 a--  10.00g 4.00m
[root@ipa ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   2   0 wz--n- 10.00g 4.00m
[root@ipa ~]# fdisk -l

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d8fa2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    22013951    10493952   8e  Linux LVM

Disk /dev/mapper/centos-root: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@ipa ~]# vi /etc/selinux/config
[root@ipa ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@ipa ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-12-07 08:33:36 EST; 3 days ago
     Docs: man:firewalld(1)
 Main PID: 5649 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─5649 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Dec 07 08:33:34 rhel7.6.expanor.local systemd[1]: Starting firewalld - dynamic firewall dae.....
Dec 07 08:33:36 rhel7.6.expanor.local systemd[1]: Started firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ipa ~]# systemctl status NetworkManager status
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabl                                                                        ed)
   Active: active (running) since Fri 2018-12-07 08:33:36 EST; 3 days ago
     Docs: man:NetworkManager(8)
 Main PID: 5697 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─5697 /usr/sbin/NetworkManager --no-daemon

Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5305] device...)
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5308] device...)
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5310] manage...L
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5778] manage...E
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5780] policy...S
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5810] device....
Dec 08 22:09:30 rhel7.6.expanor.local NetworkManager[5697]: <info>  [1544324970.5816] manage...L
Dec 08 22:14:31 ipa.expanor.local NetworkManager[5697]: <info>  [1544325271.8679] hostname: ..."
Dec 08 22:14:31 ipa.expanor.local NetworkManager[5697]: <info>  [1544325271.8725] policy: se...)
Dec 10 22:42:02 ipa.expanor.local NetworkManager[5697]: <info>  [1544499722.2493] manager: k...d
Unit status.service could not be found.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ipa ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.servi                                                                        ce.
[root@ipa ~]# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
[root@ipa ~]# systemctl mask NetworkManager
Created symlink from /etc/systemd/system/NetworkManager.service to /dev/null.
[root@ipa ~]# echo " 1. Make sure you have enought disk space available.
> 2. Assign Static IP address
> 3. Disable Selinux/Firewall
> 4. Disable NetworkManager"
 1. Make sure you have enought disk space available.
2. Assign Static IP address
3. Disable Selinux/Firewall
4. Disable NetworkManager
[root@ipa ~]# cat /etc/sysconfig/network-scripts/ifcfg-
ifcfg-ens192  ifcfg-lo
[root@ipa ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
#BOOTPROTO="dhcp"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens192"
UUID="ddaf1fdc-e7c6-474d-8713-2b19315bf41f"
DEVICE="ens192"
ONBOOT="yes"
ETHTOOL_OPTS="wol d"
IPADDR="192.168.10.140"
PREFIX="24"
GATEWAY="192.168.10.1"
DNS1="192.168.10.110"
DOMAIN="192.168.10.120"
IPV6_PRIVACY="no"
[root@ipa ~]# echo "Now install OpenStack"
Now install OpenStack
[root@ipa ~]# packstack --allinone
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20181210-225648-zoz5cX/openstack-s                                                                        etup.log
Packstack changed given value  to required value /root/.ssh/id_rsa.pub

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Preparing Nova Compute entries                       [ DONE ]
Preparing Nova Scheduler entries                     [ DONE ]
Preparing Nova VNC Proxy entries                     [ DONE ]
Preparing OpenStack Network-related Nova entries     [ DONE ]
Preparing Nova Common entries                        [ DONE ]
Preparing Neutron LBaaS Agent entries                [ DONE ]
Preparing Neutron API entries                        [ DONE ]
Preparing Neutron L3 entries                         [ DONE ]
Preparing Neutron L2 Agent entries                   [ DONE ]
Preparing Neutron DHCP Agent entries                 [ DONE ]
Preparing Neutron Metering Agent entries             [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Swift builder entries                      [ DONE ]
Preparing Swift proxy entries                        [ DONE ]
Preparing Swift storage entries                      [ DONE ]
Preparing Gnocchi entries                            [ DONE ]
Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 192.168.10.140_controller.pp
Testing if puppet apply is finished: 192.168.10.140_controller.pp  [ | ]


RHEL7- Extending xfs root filesystem on CentOS 7

kamal@192.168.10.140's password:
Last login: Mon Dec 10 22:35:38 2018 from 192.168.10.2
[kamal@ipa ~]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.4G  3.7G  55% /
devtmpfs                 903M     0  903M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M   22M  898M   3% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1                497M  212M  286M  43% /boot
tmpfs                    184M  4.0K  184M   1% /run/user/42
tmpfs                    184M   44K  184M   1% /run/user/1000
tmpfs                    184M     0  184M   0% /run/user/0
[kamal@ipa ~]$ su -
Password:
Last login: Mon Dec 10 22:35:52 EST 2018 on pts/1
[root@ipa ~]# fdisk -l

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d8fa2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    22013951    10493952   8e  Linux LVM

Disk /dev/mapper/centos-root: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@ipa ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (22013952-33554431, default 22013952):
Using default value 22013952
Last sector, +sectors or +size{K,M,G} (22013952-33554431, default 33554431): $
Last sector, +sectors or +size{K,M,G} (22013952-33554431, default 33554431):
Using default value 33554431
Partition 3 of type Linux and of size 5.5 GiB is set

Command (m for help): p

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d8fa2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    22013951    10493952   8e  Linux LVM
/dev/sda3        22013952    33554431     5770240   83  Linux

Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d8fa2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    22013951    10493952   8e  Linux LVM
/dev/sda3        22013952    33554431     5770240   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

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.
[root@ipa ~]# partprobe -s
/dev/sda: msdos partitions 1 2 3
[root@ipa ~]# echo "If it does not work, you can use partx"
If it does not work, you can use partx
[root@ipa ~]# partx  -v -a /dev/sda
partition: none, disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition table type 'dos' detected
partx: /dev/sda: adding partition #1 failed: Device or resource busy
partx: /dev/sda: adding partition #2 failed: Device or resource busy
partx: /dev/sda: adding partition #3 failed: Device or resource busy
partx: /dev/sda: error adding partitions 1-3
[root@ipa ~]# fdisk -l

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d8fa2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    22013951    10493952   8e  Linux LVM
/dev/sda3        22013952    33554431     5770240   8e  Linux LVM

Disk /dev/mapper/centos-root: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@ipa ~]# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.
[root@ipa ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   2   0 wz--n- 10.00g 4.00m
[root@ipa ~]# vgextend centos /dev/sda3
  Couldn't create temporary archive name.
[root@ipa ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   2   0 wz--n- 10.00g 4.00m
[root@ipa ~]# df -h .
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.8G  3.3G  60% /
[root@ipa ~]# vgextend centos /dev/sda3
  Volume group "centos" successfully extended
[root@ipa ~]# pvscan
  PV /dev/sda2   VG centos          lvm2 [10.00 GiB / 4.00 MiB free]
  PV /dev/sda3   VG centos          lvm2 [5.50 GiB / 5.50 GiB free]
  Total: 2 [15.50 GiB] / in use: 2 [15.50 GiB] / in no VG: 0 [0   ]
[root@ipa ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   2   2   0 wz--n- 15.50g 5.50g
[root@ipa ~]# df -h .
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.9G  3.2G  61% /
[root@ipa ~]# xfs_info /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@ipa ~]# echo "now, extend your logical volume using whole partition, rather then specifyting particular size"
now, extend your logical volume using whole partition, rather then specifyting particular size
[root@ipa ~]# lvextend /dev/mapper/centos-root /dev/sda3
  Size of logical volume centos/root changed from 8.00 GiB (2048 extents) to 13.50 GiB (3456 extents).
  Logical volume centos/root successfully resized.
[root@ipa ~]# lvs
  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- 13.50g
  swap centos -wi-ao----  2.00g
[root@ipa ~]# lvscan
  ACTIVE            '/dev/centos/root' [13.50 GiB] inherit
  ACTIVE            '/dev/centos/swap' [2.00 GiB] inherit
[root@ipa ~]# df -h .
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.0G  4.9G  3.2G  62% /
[root@ipa ~]# echo "You just extended LVM, now you have to extend xfs filessytem"
You just extended LVM, now you have to extend xfs filessytem
[root@ipa ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 2097152 to 3538944
[root@ipa ~]# echo "It says data blocks changed from 2097152 to 3538944"
It says data blocks changed from 2097152 to 3538944
[root@ipa ~]# df -h .
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   14G  5.0G  8.6G  37% /
[root@ipa ~]#