Using logrotate

1. create configuration file: bash-3.2# cat /etc/logrotate.d/myconf-logrotate.conf PATH_TO_FILE/LOG.FILE { daily missingok rotate 10 compress delaycompress compresscmd /usr/bin/gzip notifempty copytruncate } 2. Testing logrotate /etc/logrotate.conf --force -d 3. Add a crontab job. A job should be run every hour export EDITOR=vi crontab -e >> 0 * * * * /usr/sbin/logrotate /etc/logrotate.conf --force > /dev/null 2>&1 Sources: … Continue reading Using logrotate

Advertisements

Edit files in Linux FS using remote Visual Studio

Source 1. Launch Visual Studio Code, or install it here if you don’t have it yet 2. Go to the ‘Extensions’ page and search for ‘Remote VSCode’ 3. Install the extension and re-launch Visual Studio Code 4. In your Linux Virtual Machine, execute the following command in your terminal to install rmate mkdir /opt/rmate $ … Continue reading Edit files in Linux FS using remote Visual Studio

Installing and configuring a simple Kerberos server.

Installing necessary packages yum install krb5-server krb5-workstation -y Editing configuration file: vi /etc/krb5.conf # Configuration snippets may be placed in this directory as well includedir /etc/krb5.conf.d/ [logging] default = FILE:/var/log/krb5libs.log kdc = FILE:/var/log/krb5kdc.log admin_server = FILE:/var/log/kadmind.log [libdefaults] dns_lookup_realm = false ticket_lifetime = 24h renew_lifetime = 7d forwardable = true rdns = false default_realm = LAB.COM … Continue reading Installing and configuring a simple Kerberos server.

Create NFS Share. (RH299)

Server side Hostname of the server machine is rhce1.lab.com Installation and configuration yum install nfs-utils -y systemctl start nfs-server systemctl enable nfs-server echo "/shares/firstshare rhce2.lab.com(sync)" > /etc/exports echo "/shares/secondshare rhce2.lab.com(ro)" > /etc/exports mkdir -p /shares/{firstshare,secondshare} exportfs -r [root@rhce1 ~]# showmount -e Export list for rhce1.lab.com: /shares/secondshare rhce2.lab.com /shares/firstshare rhce2.lab.com firewall-cmd --add-port=2049/udp --permanent firewall-cmd --add-port=2049/tcp --permanent … Continue reading Create NFS Share. (RH299)

Storage and partitions managing. Managing LVM. Extend and reduce a volume. (RHCSA)

Extending Logical Volume: [root@machine-1 ~]# vgdisplay shazam --- Volume group --- VG Name shazam System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 508.00 MiB PE Size … Continue reading Storage and partitions managing. Managing LVM. Extend and reduce a volume. (RHCSA)

Storage management and partitions. Managing LVM (RHCSA)

Steps to create Logical Volumes are following: Prepare a Physical Volume: [root@machine-1 ~]# pvcreate /dev/sda3 /dev/sdb3 Physical volume "/dev/sda3" successfully created. Physical volume "/dev/sdb3" successfully created. Create a Volume Group [root@machine-1 ~]# vgcreate new-volumegroup /dev/sda3 /dev/sdb3 Volume group "new-volumegroup" successfully created [root@machine-1 ~]# Create a Logical Volume [root@machine-1 ~]# lvcreate -l 100 new-volumegroup -n logvol … Continue reading Storage management and partitions. Managing LVM (RHCSA)

Storage management and partitions. Creating and mounting a single partition (RHCSA)

Basically, there are three classical tools that administrators mostly use to create and manage file system (FS) of Linux: fdisk, gdisk and parted Current system state. To check current state of available state of the FS, mostly used df and fdisk with parameters. [root@machine-1 ~]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors … Continue reading Storage management and partitions. Creating and mounting a single partition (RHCSA)

Creating rpm package from java tarball: jdk*.tag.gz

In order to create from java installation tarball a rpm package I procedeed following steps. As example I have used jdk-8u161-linux-x64.tar.gz file from oracle download portal. 1. Installing rpmbuild package from yum repository: yum install rpmbuild -y 2. Creating directories for rpmbuild: mkdir -p packages/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} 3. Place jdk-8u161-linux-x64.tar.gz in $RPM_SOURCE_DIR (packages/SOURCES) 4. Creating a spec … Continue reading Creating rpm package from java tarball: jdk*.tag.gz