Posts

Showing posts with the label centos

How to Create Bootable CentOS 7 USB Stick (to Command Line) on Linux

Image
  Downloading CentOS ISO file Download the CentOS ISO file from the  CentOS downloads  page where you can choose between “DVD ISO” and “Minimal ISO”. Creating Bootable CentOS 7 USB Stick on Linux Insert the USB flash drive into the USB port. Find out the name of your USB drive with the  lsblk  command:  $ lsblk The output will look like this: Output Sample of lsblk command In our case the name of the USB device is  /dev/sdx  but this may vary on your system. 3. On most Linux distributions the USB flash drive will be automatically mounted when inserted. Before flashing the image make sure the USB device is not mounted. To do so use the umount command followed by either the directory where it has been mounted (mount point) or the device name: unmount the device 4. The   last step is to flash the CentOS ISO image to the USB drive. Make sure you replace  /dev/sdx  with your drive and do not append the partition number. Also, rep...

Useful network command for Linux

  nc (netcat) command : used for port scanning, port redirection, as a port listener $ nc -v -w 2 z <ip-address> 22 #scan a single port $ nc -v -w 2 z <ip-address> 22 80 #scan multiple ports $ nc -v -w 2 z <ip-address> 20–25 #scan range of ports nmap command : Nmap is used for exploring networks, perform security scans, network audit and finding open ports on remote machine The Nmap tool offers various methods to scan a system. In this example, I am performing a scan using hostname to find out all open ports, services and MAC address on the system # nmap [Scan Type(s)] [Options] {target specification} # yum install nmap [on Red Hat based systems] $ sudo apt-get install nmap [on Debian based systems] with “-v” option is giving more detailed information about the remote machine. nmap <hostname or IP> nmap -v <IP> You can scan multiple hosts by simply writing their IP addresses or hostnames with Nmap. nmap <IP1><IP2> nmap -sU <IP...

Restore the size of USB drive in Linux

  Run  lsblk  command to find outUSB partition. In this case you see the USB flash drive is sdb so you  VERY CAREFULLY  run: #sudo dd if=/dev/zero of=/dev/sdb count=100 Create a new partition table  in the format you like: #dd if=/dev/zero of=/dev/sdb bs=32k count=1 Create mounting point: #sudo mkdir /media/external Mount the Drive:  We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point): #sudo   mount -t vfat /dev/sdb /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137 OR If the device is formatted with NTFS , run: #sudo mount -t ntfs-3g /dev/sdb1 /media/external Note: You must have the ntfs-3g driver installed Unmounting the Drive : #sudo umount /dev/sdb ENJOY

How to Create System Configuration Summaries for CentOS using cfg2html

  Find cfg2html rpm from below link https://gitlab.com/vineetkumar03/gitnotes/-/blob/master/cfg2html-1.79-1.el7.rf.noarch.rpm Copy this .rpm to /tmp directory on your server. Now we will use  cfg2html-1.79–1.el7.rf.noarch.rpm  to install cfg2html in Linux CentOS #rpm -hiv  cfg2html-1.79–1.el7.rf.noarch.rpm #which cfg2html-linux Output of above command : /usr/bin/cfg2html-linux #mkdir /tmp/cfg2html #cp /usr/bin/cfg2html-linux /tmp/cfg2html/ Please make sure that there are no other files in “/tmp/cfg2html” directory except cfg2html-linux as all the output files will be store in this directory. Proceed to run the cfg2html script. #./cfg2html-linux #ls Make a copy of this cfg2html folder on your local pc. You can view the system configuration by running the hostname.html.

How to set the Proxy for Docker in Linux

  Systemd Docker Service In order to the set the proxy for Docker, you will need to create a configuration file for the Docker service. No configuration files exist by default, so one will have to be created. All Systemd service configuration are stored under /etc/systemd/system. In order to keep things organized,  we can create a child directory docker.service.d, rather than creating a file called /etc/systemd/system/docker.service . Within this configuration file, we can set our HTTP and HTTPS proxy. We can also set our NO_PROXY value, too. Creating Proxy Configuration Create a new directory for our Docker service configurations. sudo mkdir -p /etc/systemd/system/docker.service.d 2. Create a file called proxy.conf in our configuration directory. sudo vi /etc/systemd/system/docker.service.d/proxy.conf 3. Add t h e following contents, changing the values to match your environment. [Service] Environment=”HTTP_PROXY=http://myproxy.hostname:8080" Environment=”HTTPS_PROXY=...