Friday 3 April 2020

Creating Local Repository | AppStream | BaseOS in CentOS and Red Hat

To create local YUM repository you need to copy DVD contents to your local directory on server

To mount the DVD First we need to find a correct CD/DVD block device. To do this execute a command blkid as root user
#blkid
/dev/sda1: UUID="2122c197-7d49-405c-a242-7ca82548952f" TYPE="ext4" PARTUUID="21d5a638-01"
/dev/sda2: UUID="wjkcLP-ULnh-yFdB-Q3HD-JHK2-UuOn-QljGW1" TYPE="LVM2_member" PARTUUID="21d5a638-02"
/dev/sr0: UUID="2020-01-03-21-42-40-00" LABEL="CentOS-8-1-1911-x86_64-dvd" TYPE="iso9660" PTUUID="087a73cc" PTTYPE="dos"


Take a note of the relevant block device eg. /dev/sr0 
2. Create Mount Point:
Mount point will be a directory where you wish to mount your CD/DVD drive. It can be any arbitrary directory. For example in this case we will be using
/software/iso as a directory mount point:
# mkdir /software/iso

3. Mount CD/DVD:
We are now ready to mount CD/DVD by using the mount command:

#mount /dev/sr0 /software/iso
mount: /software/iso: WARNING: device write-protected, mounted read-only.

At this point you should be able to access all files on your DVD drive
#ls
AppStream  BaseOS  EFI  images  isolinux  media.repo  TRANS.TBL

4. Now create a folder for YUM repository here I creating a folder called rpms in root directroty
# mkdir /rpms

5. and copy AppStream folder and BaseOS folder to /rpms folder

root@cent1 ~#cd /sofware/iso
root@cent1 iso#cp -R AppStream /rpms/
root@cent1 iso#cp -R BaseOS /rpms/
root@cent1 iso]# cp media.repo /etc/yum.repos.d/AppStream.repo 

6. Now edit the AppStream.repo file as below
7. and now copy the Appstream.repo file as BaseOS.repo and edit as below
Note: if you want, you can keep these AppStream and BaseOS settings in single .repo file

now clean the yum repository using yum clean all 
then you can install software with out internet connection which is located in /rpms/ folder 
you can see the repo list using the yum repolist as below. From below list top two repolists which we created.


 




 

Thursday 2 April 2020

NMCLI - Network Manager Command Line Interface

To troubleshooting network in Linux we need to first find the status of the device. here i am using the virtual box for it
to find the status of the device
nmcli device status 
nmcli connection show # shows connection profiles






to add the new profile  #must run with sudo privileges
nmcli connection add type ethernet con-name <profile name> ifname enp0s3

adding the ip address to profile manual method not DHCP
nmcli connection modify <profile name> ipv4.addresses 192.168.2.1/24 ipv4.gateway 192.168.2.254 ipv4.dns 192.168.2.254 +ipv4.dns 4.4.4.4 (2nd DNS) connection.autoconnect yes ipv4.method manual

nmcli connection up <profile name> #to bring up connection


if it still cause any issue one option is to restart network with the current configuration files
systemctl restart newtwork

Here is more nmcli commands to troubleshoot

view the configuration file list
/etc/sysconfig/network-scripts
Configure a network card using Text Based User Interface:

backp the configuration  
cp /etc/sysconfig/network-scripts/ifcfg-enp0s3 /tmp/
sudo nmtui # configure the ip addresses using the TUI
edit the configuration as required
deactivate and then reactivate
sudo ifdown enp0s3
sudo ifup enp0s3 
 
see the changes 
 
ip addr show enp0s3  #to display interface details
ip route  #to display the ip route