Apr 17 2017

Find And Delete Files Greater Than Given Size on Linux

Category: Linux & UnixFatih Acar @ 19:56

If you want to delete files which are greater than given size on Linux, you can use below examples by changing as your need.

Delete Files

Delete files which are size more than 2 MB. and type is jgp.

[root@testserver ~]# find /tmp/ -type f -size +2M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size more than 2 MB low than 5 MB. and type is jpg.

[root@testserver ~]# find /tmp/ -type f -size +2M -size -5M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size low than 10 MB. and type is zip.

[root@testserver ~]# find /tmp/ -type f -size -10M -name “*.zip” -exec rm -rf {} \;

3,000 total views, 20 views today

Tags: Linux Administration, System Administration


Dec 09 2016

Check Service Status With Python on OEL 7 / Centos 7

Category: Linux & Unix,PythonFatih Acar @ 21:42

I write a python code to check mysql service open or close. It is simple and you can change service_name parameter in the code to check another services. You can download from here check_service_status.py Below code maybe can not run because of python language format is tab structure. You can use with download original code check_service_status.py

Check MySQL Service Status


#-*- coding: utf-8 -*-

import os
import commands

service_name = "mysql"

def check_service_status(service_name):

        status = os.system('systemctl status '+service_name+ ' > /dev/null')
        return status

def main():

        if (check_service_status(service_name) == 0):
                print "Running"
        else:
                print "Stopped"
main()

Download

Execute Script
Continue reading “Check Service Status With Python on OEL 7 / Centos 7”

3,130 total views, 6 views today

Tags: Linux Administration, Python, System Administration


Nov 30 2016

Change Hostname on OEL 7 CentOS 7

Category: Linux & UnixFatih Acar @ 10:24

You can use hostnamectl command to list and change hostname of operating system on OEL 7 or CentOS 7 version.

List Hostname Status


[root@localhost ~]# hostnamectl 

   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6f021291e2384a219e1f23ca39eadc9a
           Boot ID: ec195c69cfde417b88b86f4d7419cf24
    Virtualization: vmware
  Operating System: Oracle Linux Server 7.3
       CPE OS Name: cpe:/o:oracle:linux:7:3:server
            Kernel: Linux 4.1.12-61.1.28.el7uek.x86_64
      Architecture: x86-64

Change Hostname Status
Continue reading “Change Hostname on OEL 7 CentOS 7”

2,570 total views, 5 views today

Tags: Linux Administration, System Administration


Nov 01 2016

Change Hostname in RHEL 7

Category: Linux & UnixFatih Acar @ 10:29

Changing hostname is different from RHEL 6 version in RHEL 7. You can use few method to change hostname. I will demonstrate useful and easy method that is hostnamectl command.

Show Current Hostname

[root@localhost ~]# hostname
localhost.localdomain

or

[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 418f684e1a5c45c9a22f76065c732de3
Boot ID: 9b07d8a45e60437e9ef31164d394ad17
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.36.3.el7.x86_64
Architecture: x86-64

Change Hostname
Continue reading “Change Hostname in RHEL 7”

2,943 total views, 2 views today

Tags: Linux Administration, System Administration


Oct 31 2016

Firewalld Add New Port, List All Ports, Remove Port with firewall-cmd command in Oracle Linux 7

Category: Linux & UnixFatih Acar @ 16:32

What is firewalld

Firewalld provides a dynamically managed firewall with support for network/firewall zones that define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings, ethernet bridges and IP sets. There is a separation of runtime and permanent configuration options. It also provides an interface for services or applications to add firewall rules directly.

Benefits of using firewalld

Changes can be done immediately in the runtime environment. No restart of the service or daemon is needed.

With the firewalld D-Bus interface it is simple for services, applications and also users to adapt firewall settings. The interface is complete and is used for the firewall configuration tools firewall-cmd, firewallctl, firewall-config and firewall-applet.

The separation of the runtime and permanent configuration makes it possible to do evaulation and tests in runtime. The runtime configuration is only valid up to the next service reload and restart or to a system reboot. Then the permanent configuration will be loaded again. With the runtime environment it is possible to use runtime for settings that should only be active for a limited amount of time. If the runtime configuration has been used for evaluation, and it is complete and working, then it is possible to save this configuration to the permanent environment.

firewall

Add a Port to Firewalld as temporary

[root@test ~]# firewall-cmd –add-port=1521/tcp

Add a Port to Firewalld as permanent
Continue reading “Firewalld Add New Port, List All Ports, Remove Port with firewall-cmd command in Oracle Linux 7”

5,831 total views, 12 views today

Tags: Linux Administration, System Administration


Aug 18 2016

How to Add EPEL Yum Repository on Oracle Linux 7

Category: Linux & UnixFatih Acar @ 11:50

EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/CentOS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo. Nagios packages are example in EPEL Repo.

Why we use EPEL repository?

  • Provides lots of open source packages to install via Yum.
  • Epel repo is 100% open source and free to use.
  • It does not provide any core duplicate packages and no compatibility issues.
  • All epel packages are maintained by Fedora repo.

Download EPEL Repo

Address : http://download.fedoraproject.org/pub/epel/7

Download link mirror: http://mirror.dgn.net.tr/epel//7/x86_64/e/epel-release-7-8.noarch.rpm

Install RPM

rpm -ivh epel-release-7-8.noarch.rpm

Control Epel Repo

yum repolist

Install Nagios Packages

List Nagios Packages
yum –enablerepo=epel -y list nagios-plugins*

Install Packages
yum –enablerepo=epel -y install nrpe nagios-plugins

7,287 total views, 12 views today

Tags: Linux Administration, Oracle Linux


Dec 04 2015

RPM Command Using on Linux Systems

Category: Linux & UnixFatih Acar @ 15:46

If you connect linux repo, you can use yum install or yum update to manage your package. On the other hand, if you have RPM package, you can use rpm command to manage packages.

RPM command has been using for installing, uninstalling, upgrading, listing,querying and checking RPM packages on linux system. You can use rpm command with root user.

Frequently Used RPM Commands

Install RPM Package

[root #] rpm -ivh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

Update RPM Package

[root #] rpm -Uvh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

List All Installed Packages

[root #] rpm -qa

Search From Installed Packages

[root #] rpm -qa | grep postgresql-libs

Take Information From Installed Package

[root #] rpm -qi postgresql-libs

Uninstall RPM Package

[root #] rpm -ev postgresql-libs

5,357 total views, 5 views today

Tags: Linux Administration, Oracle Linux, System Administration


Nov 21 2015

How to Lock and Unlock Users on Oracle Linux / Centos / Redhat

Category: Linux & UnixFatih Acar @ 13:25

Lock User

Method 1

[root@test ~]# passwd -l username

Method 2

[root@test ~]# usermod -L username

Unlock User

Method 1

[root@test ~]# passwd -u username

Method 2

[root@test ~]# usermod -U username

Check Status of Users

[root@test ~]# more /etc/shadow

username:!!$6$pmQO0ZPH$POolvCzxe1nsd1OpLkMc6E3cd1ffOkcz224caQs1d/oL.OwscUhYfcas//41sS12.:16531:0:99999:7:::

Note : If you see “!!” expression or “!” expression start of password of username, the user is locked.

1,870 total views, 5 views today

Tags: Linux Administration, System Administration


Oct 02 2015

How to Create Virtual IP Address on Oracle Linux System

Category: Linux & UnixFatih Acar @ 16:50

You can create virtual IP addresses on Oracle Linux, Redhat and Centos Operating Systems with below operations.

Virtual IP address can be temporary or static according to your wishes. You have to have a ethernet adaptor interface for example eth0. You can use ifconfig eth0:0 <IP address> syntax to create temporary virtual IP.

Create Temporary Virtual IP

[root@test ~]# ifconfig eth0:0 192.168.27.150

Delete Temporary Virtual IP

[root@test ~]# ifconfig eth0:0 down

Create Static Virtual IP

[root@test ~]# cd /etc/sysconfig/network-scripts
[root@test ~]# vi ifcfg-eth0:0

DEVICE=eth0:0
IPADDR=192.168.27.150
NETMASK=255.255.255.0
NETWORK=192.0.0.0
BROADCAST=192.168.27.255
ONBOOT=yes

Activate Network Configuration

[root@test ~]# service network restart

13,973 total views, 15 views today

Tags: Linux Administration, Oracle Linux, System Administration


Feb 18 2015

Linux Logical Volume Manager Configuration And Extend Disk Operation

Category: Linux & UnixFatih Acar @ 11:38

Logical Volume Manager is a disk partitioning solution on linux systems. This architecture provides advantages. You can extend disk size easily with lvm without losing exist data. But, If you use fdisk that is classical method for partition, you can not resize this partitions without losing data.

You can follow below steps to configure lvm.

LVM Creation Steps

1- Disk partition “cfdisk”
2- Create physical volume “pvcreate”
3- Create virtual group “vgcreate”
4- Create logical volume “lvcreate”
5- Format logical volume “mkfs.ext4”
6- Add Fstab “vi /etc/fstab”

LVM Architecture

Logical Volume Manager Architecture

Logical Volume Manager Architecture

Configure LVM Disks
Continue reading “Linux Logical Volume Manager Configuration And Extend Disk Operation”

36,781 total views, no views today

Tags: Linux Administration, System Administration


Next Page »