Skip to main content

Posts

Containers in Linux .

 The term container and the concept came from the shipping container .  These container are shipped from city to city and country to country .  No matter which part of the world you go , you will always find these containers with the exact same measurements because around the world  all docks , trucks ,ships and warehouse are built to easily transport and store them .  > Now consider the situation , developers create the application and that application is working fine in their laptop , but when the application is moved to the production environment , application is not running . The most basic reason is change of the architecture .  > Then comes the container technology which allows developers or programmer to test and build applications on any computerr just by putting it in the container and then run on another computer regardlesss of its architechture .  >you can move the application anywhere without moving its OS just like moving actual container anywhere that would fit o

server build checklist

 Network configuration completed. Register to RHΝ. Apply updates and reboot. Setup time synchronization. Sentinel one installed on all the 2 servers. AD configuration has been done. Sudo to root access has been given to Linux team selinux has been disabled. Rsyslog has been enable Ip address has been reserved. Computers has been added to Linuxoid OU. SNMPV3 setup done on 2 servers. Firewall has been enabled on 2 servers. Servers have been added to Solarwinds using SNMP polling method. ure Subtask created DNS entry. Subtask created for sentinelone Subtask created for Backup. ************************************************ Build a server DNS entry has been added for the VM uln_register selinux (/etc/selinux/config) has been disabled Rsyslog has been enable Added Disk and created file-system Mount disk u01, u02 Sentinel-one has been installed on the VM SNMP has been configured & Solarwind monitoring enabled Added VM to AD group and user has been added in the group for login using AD

Patching Notes .

If plymouth is NOT disabled during boot time, it may create issue working on the console, we need to disable it during patching window. cat /proc/cmdline | grep -i plymouth : to check if the plymouth is disabled or not. if no output then no if any output then YES.  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Before patching : history      systemctl status scsm      :   check the status of scsm . systemctl status cloud-init     :  check the status of cloud init . df  -h  /   : check the available space in /  .  cd  /home/homedir   :   Go to the directory .  ********************************************************* lsblk >> lsblk ; df  -hT>> df-ht  ;  free  -tm >> swap  ;  cat /etc/fstab >> etcfstab     #compulsary     cat  /etc/mail/sendma

User and group management

  user and group management: useradd spiderman:  add the new user called spiderman groupadd superheros  create the group called superheroes. cat /etc/group: shows the list of groups and its members. userdel -r spiderman:  delete the user spiderman. groupdel superheroes:  deletes the group superheroes. usermod -G superheroes superman  change the group of superman to superheroes.  chgrp -R superheroes spiderman:  change the group of spiderman to superheroes. cat /etc/passwd:  gives the local accounts output. output format of /etc/passwd file:  username: password: userid: groupid: home directory: shell type. output format of /etc/group file:  groupname:x: groupid: groupmembers. useradd -g linux_admins -s /bin/bash -c "sadik pathan" -m -d /home/admin_spathan admin_spathan:  add the username admin_spathan in linux_admins group.  passwd admin_spathan : create the passwd for admin_spathan chage -m 5 -M 90 -w 10 babubutt   : after the password change, babubutt is not allowed to chang

Tune system performance

  Tune system performance: what is tuned?  Pronounced as tune-d. Tune is for system tuning and d is for daemon. It is a systemd service that is used to tune linux system performance. It is installed in Centos /redhat version 7 and 8 by default. tuned package name is tuned The tuned service comes with predefined profiles and settings. Based on the selected profile the tuned service automatically adjust system to get the best performance. The tuned daemon applies system settings when the service starts or upon selection of the new tuning profile. • Check if the tuned package has been installed: rpm -qa | grep -i tuned •Install the tuned package: yum install tuned -y •play with the tuned service: systemctl status / enable/disable/start/stop tuned •command to change the setting for the tuned daemon: tuned-adm •to check which profile is active: tuned-adm active •to list the available profiles: tuned-adm list •some of the tuned profiles given below: balanced desktop throughput-performance la

Install and update the software packages.

  Install and update the software packages: package : Its a container that contains the software related programs, files and executables. system updates and repositories: yum  (rhel and centos) command installs the packages that are defined in the linux system. configuration files location: / etc/yum.repos.d apt-get  (ubuntu debain) rpm  (redhat package manager) Difference between yum and rpm: yum downloads the package from the internet and installs it as well. rpm just installs the package which is allready downloaded on the linux machine. In some companies internet access is not allowed. In that case repos are setup locally on another server within the same network. yum install ntp : it will first check in the machine if ntp is installed or not. if not installed, it will install the ntp package. rpm -qa:  gives the list of the packages that are installed in the linux system. rpm -qa | wc -l:  gives the count of the packages that are installed in the system, it is not actually couting

Networking in Linux

  Networking in Linux :  ifconfig :  lists the ip address and network interface like eth0/eth1/enpos3/lo . ip addr :  lists the interface and ip address . ip r l :  lists ip address . hostname -I :  lists the IP address . netstat -rnv :   gives the gateway information . ping www.google.com :  ping the ip address of the google . nslookup www.google.com :  it will give the ip address of the google.com and also it will give ip address of our dns server . Note :  if you have the personal linux computer , your dns server and gateway would be same . systemctl status NetworkManager :  shows the status of network manager . ps -ef | grep NetworkManager :  shows the process which is running the network manager .   ........................................ Network configuration methods :  1. nmcli :  stands for network manager command line interface .This tool is useful when access to graphical environment is not available to make the network configuration changes . 2 .nmtui :  stands for network

Linux basic commands

 Linux basic commands: du  -sh  *  |  sort  -h  -r   |  head  -n  40  :    list out first 40 files in the directory that are taking more space in the directory.  cd : change directory Is-l listing the items in long listing format  pwd : print working directory Is-I format: type :no of links:owner : group:size :month :day :time :name cd/: go to/directory whoami: tells us by which username we are logged in. touch jerry: creates the file named jerry in present working directory. cp jerry lex: copy the content of jerry file and paste it to lex file. vi text1: creates the file text1 and open it in vi editor mkdir superman: creates the directory called superman mkdir abc def  : creates 2 folder in one command. touch filename wont work in /etc/ folder if logged in by normal account. man cp: shows manual for cp command. echo "india is my country"> file1 puts the text in file1. rm filename: remove the filename  mv lex luther renames the file from lex to luther  mv luther /h

NFS : Network file system

  Network file system (NFS): Its a filesystem developed by sun Microsystem.Inc. It is a client server system that allows the users to access files accross a network and treat them as if they resided in local file directory. For example: if you were using a computer linked to second computer via NFS, you could access files on the second computer as if they resided in the directory on the first computer. This is accomplished through the process of exporting (the process by which an NFS server provides remote clients with access to its files) and mounting (the process by which client map NFS shared filesystem) Steps for NFS configuration on server side: • Install NFS Packages: # yum install  nfs-utils  libnfsidmap once the packages are installed enable and start the NFS services #systemctl enable rpcbind #systemctl enable nfs-server #systemctl start rpcbind #systemctl start nfs-server #systemctl start rpc-ststd #systemctl start nfs-idmapd >>>>>>>>>>>>&g

Samba configuration on linux server

  Samba configuration on Linux Server : (without password samba sare) • Samba is the Linux tool or utility that allows sharing of the Linux resources such as files and printers with other operating system. • It works exactly like NFS but the difference is NFS shares within linux or Unix like system whereas Samba shares with other OS. (Windows,MAC). For Example: computer A shares its filesystem with computer B using samba then computer B will see the shared filesystem as if it is mounted as the local filesystem. • samba shares its filesystem through a protocol called SMB. (server message Block) which was invented by IBM. • Another protocol used to share the samba is through CIFS(common Internet File system) invented by Microsoft and NMB. • Steps of the samba configuration: > Take the snapshot of VM. Alway take the snapshot before any configuration, because if anything goes wrong we can revert to the snapshot. >>>>>>>>>>>>>>>>>>>

SELinux (Security advanced Linux)

  What is SELinux ? Security enhanced Linux is the linux kernel security module that provides a mechanism for supporting access control security policies. including mandatory access controls. It is the project of united states national security Agency and SElinux Community. >>>>>>>>>>≥>>>>>>>>>>> SELinux Options: Enforcing : Enabled (enabledby default in redhat centos, Fedora) Permissive : disabled but logs the activity. Disable : disabled and not the activity logs. >>>>>>>>>>>>>>>>>>>≥>>>>>>>>>>>>> how to check the SElinux status? # sestatus or getenforce • SElinux setting: # setenforce 0 = permissive/disable # setenforce 1 = enable but these changes are temporary. Once the server reboots, these settings will flush. >>>>>>>>>>>>≥>>>>>>>>>>>>>>> •

Linux boot process

  Every system administrator needs to understand the boot process on the OS in order to troubleshoot effectively. >BIOS- basic input output setting(firmware interface) POST : power on self test > MBR is loaded: master boot record Information saved in the first sector of the hard disk that indicates where GRUB2 is located so it can be loaded in the computer RAM. > GRUB2 is loaded: grand unified boot loader v2. loads the linux kernel: /boot/grub2/grub.cfg > Kernel is loaded: core of the OS.  loads the required drivers from the initrd.img, starts the first OS process. > systemd process is started: System daemon (PID=1) It then starts all the required processes. It reads /etc/systemd/system/default.target to bring the system to run-level. Total 7 run levels we have.  ************************************* How to reboot/shutdown: power off the system: # systemctl poweroff = stops all the running services, unmount all the filesystems. and then power off the system. # syste

Firewall in Linux

  Firewall : >A wall that prevents the spread of the fire. > A data moves in and out of the server its packet information is tested against the firewall rules to see if it should be allowed or not. > In simple words, a firewall is like a watchman, a bouncer, or a shield that has a set of rules given and based on that rule they decide who can enter and leave. >There are 2 types of firewall in IT: 1. software : runs on the operating system. 2. hardware : A dedicated appliance with firewall software. ************************************ firewalld: it works the same way as iptables but ofcourse it has its own commands. #firewall-cmd • It has a few predefined service rules that are very easy to turn on and off. Services such as NFS,NTP,httpd etc • Firewalld also has the following: >tables >chains >rules >targets @you can run one or the other: iptables or firewalld ********************************** Make sure iptables is stopped disabled and mask # systemctl stop ipta

What is Logical Volume manager in Linux?

Topics to be covered in this blogpost: What is LVM and its examples . Advantage of LVM Posssibilities of LVM Realtime LVM Examples Adding new Space /Disk using LVM  What is LVM ? LVM is used to manage volume and disk on the linux Server. LVM allows disks to be combined together. Example of LVM: Like partition of disk in windows C,D drive similarly we can do the same in Linux. Single disk can be divided into different partitions. Multiple disks can be combined and grouped into one. LVM can be understood using the image below: Advantage of LVM: In case of disk is running out of space ,you can add new disk without breaking partitions of your  file system. Possibilities of LVM: 1.New space can be created on server for new project 2.In case of the low disk space we can increase the space. 3.In case of the extra space allocated to the partition, capacity can be reallocated (reduce capacity in one volume group and add it to another.) 4. Possibilities and different combinations of LVM can be e

Partitions and file system creation in Linux

  Storage: types of storages: • Local Storage. • SAN (storage area network) • NAS (network attached storage) *************************************** Commands for disk partitions: • df : lists the filesystems and its info • fdisk : lists the disks and the partitions on the disks *************************************** Adding the disk and creating the partitions and creating filesystem from partition and mounting it on the directory: fdisk /dev/sdb : It will open the fdisk program. n: create new partition pick the partition number: 1 first sector: default 2048 Last sector: +1G (creating the partition of 1G) partition 1 of type Linux of size 1Gb is set. w : write the table to disk and exit. fdisk  -l: it will now show the /dev/sdb1 partition created on the /dev/sdb disk, mkfs.xfs /dev/sdb1: make the xfs filsystem for /dev/sdb1 partition mkdir /data: create data directory mount /dev/sdb1  /data: mount filesystem /dev/sdb1 on data directory. df  -h: outputs the filesystems where we ca