Category Archives: Inf. Tech

Ansible Core Yum Update RHEL

Scenario: Patching run yum update using Ansible to RHEL 6/7 remote machine
System: RHEL 7, Ansible 2.6 (Callback and ansible log is active)
Remote System: RHEL 6/7 (not using ssh key), same root password.

Example yum update host group devservers, here my steps:
1) Empty ansible log.
# cat /dev/null > /var/log/ansible.log

2) Input hosts devservers in /etc/ansible/hosts
# vi /etc/ansible/hosts

[devservers]
192.168.99.18
192.168.99.19

Continue reading

Configure Samba File Sharing AD Auth on RHEL/CentOS 7

Scenario: How to configure file sharing using samba with AD authentification on CentOS/RHEL 7
System:
– CentOS/RHEL 7, IP address: 192.168.99.15, hostname: centos7ht
– Windows Server 2012 as AD Domain: toya.toyaseta.com, IP address: 192.168.99.10, also as DNS server.

Steps as root login:
1) Point cetos7ht DNS server to AD server and edit /etc/hosts
– Edit /etc/hosts.
# vi /etc/hosts

192.168.99.10 toya.toyaseta.com toya

– Edit DNS /etc/resolv.conf
# vi /etc/resolv.conf

# Generated by NetworkManager
search toya.toyaseta.com
nameserver 192.168.99.10
nameserver 192.168.99.1

Continue reading

Bash script to get list of expired local users on Linux

Scenario: How to get the list of expired local users on Linux.
System :
CentOS/RHEL 6/7
IP address: 192.168.99.11
Hostname : horse

Steps:
1) Create the bash script file with file name listchageusers.sh
$ vi /home/bachem/listchageusers.sh
Continue reading

Bash script to get list of local users on Linux

Scenario: How to get the list of normal users and System users in Linux.
System : CentOS/RHEL 6/7

Steps:
1) Login as local users (work without login to root), example I login as bachem.
2) Create the bash script file with file name listusers.sh
$ vi /home/bachem/listusers.sh
Continue reading

How to add sudo user on CentOS 7

Scenario: add sudo user on CentOS 7
System: CentOS 7

Steps to Create a New Sudo User
– Log in to your server as the root user.
– Use the adduser command to add a new user to your system,example add user with username bachem.

[root@horse ~]# useradd bachem
[root@horse ~]# passwd bachem
Changing password for user bachem.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@horse ~]#

Continue reading

Set JAVA_HOME/PATH environment variable on CentOS/RHEL

Scenario: Set JAVA_HOME/PATH environment variable on CentOS/RHEL
System: CentOS/RHEL 6/7

– Set JAVA_HOME / PATH for a single user,example set up on user bachem
1) Check java path
Refer to below output the path is /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre
Continue reading

Limit memory usage per user on CentOS/RHEL

Scenario: How to limit memory usage per user on CentOS/RHEL
System: CentOS/RHEL 6/7

I would like to cap the amount of memory the users on a server can use. The applications developed by our users have memory leaks and I want to prevent them from using all the memory and crashing the system.

Resolution
It is possible to limit the amount of memory that each process can allocate with the RLIMIT facility in Red Hat Enterprise Linux. RLIMIT_AS limits the size of the virtual address space and it is a suitable solution in many cases which require limiting per-process memory consumption even though there are many limits related to memory.
Continue reading

Install Apache Tomcat 8.5 on CentOS 7

Scenario: Install Apache Tomcat 8.5 on CentOS/RHEL 7

STEPS:
1) This scenario using Oracle Java. Login as root user then install Oracle Java.
Continue reading

Install MariaDB 10 on CentOS/RHEL 7

Scenario: How to install MariaDB on CentOS/RHEL 7

Steps:

1) Create MariaDB 10 repository
$ sudo yum install wget
$ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
$ chmod +x mariadb_repo_setup
$ sudo ./mariadb_repo_setup

Continue reading

Using Ansible Callback

Scenario: Set up Ansible callback to monitor running task on remote machine.
Ansible system: CentOS 7, Ansible 2.6
Remote machines:
Both have same root password
1. CentOS 7, ip address: 192.168.99.18
2. CentOS 6, ip address: 192.168.99.19

I set up callback plugins to see running ansible-playbook task on remote machine and it is fun and useful.
To set up callback, edit /etc/ansible/ansible.cfg and change the value to minimal.

# vi /etc/ansible/ansible.cfg

stdout_callback = minimal

Continue reading