Install VLC 3.0 Vetinari on Linux

This post will guide you how to install VLC3.0 Vetinari on Ubuntu/Debian Linux system. How do I install VLC 3 application with snap package manager to play multimedia files on Linux.

What is VLC Vetinari?


VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols.

Install VLC 3.0 Vetinari on Linux


To install VLC tool, you need to install the snap package manager firstly. Then find the VLC 3.0 application in snap, and then install it with snap. Just do the following steps:

#1 Install Snap Package Manager

You need to install snapd package with apt-get command.

For Ubuntu/Debian Linux:

Type the following command:

$ sudo apt-get install snapd

Outputs:

root@ubuntu-dev:~# apt-get install snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ubuntu-core-launcher
The following packages will be upgraded:
snapd ubuntu-core-launcher
2 upgraded, 0 newly installed, 0 to remove and 478 not upgraded.
Need to get 14.2 MB of archives.
After this operation, 23.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 ubuntu-core- launcher amd64 2.34.2 [1,560 B]
Get:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 snapd amd64 2.34.2 [14.2 MB]
Fetched 14.2 MB in 5s (2,478 kB/s)
(Reading database ... 179597 files and directories currently installed.)
Preparing to unpack .../ubuntu-core-launcher_2.34.2_amd64.deb ...
Unpacking ubuntu-core-launcher (2.34.2) over (2.25) ...
Preparing to unpack .../snapd_2.34.2_amd64.deb ...
Warning: Stopping snapd.service, but it can still be activated by:
snapd.socket
Unpacking snapd (2.34.2) over (2.25) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up snapd (2.34.2) ...
Installing new version of config file /etc/apparmor.d/usr.lib.snapd.snap-confine .real ...
Installing new version of config file /etc/profile.d/apps-bin-path.sh ...
snapd.snap-repair.service is a disabled or a static unit, not starting it.
Setting up ubuntu-core-launcher (2.34.2) ...

 For Fedora Linux:

Type the following command:

$ sudo dnf install snapd
$ sudo ln –s /var/lib/snapd/snap /snap

For OpenSUSE Linux:

Type the following command:

#### add repo
$ sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.3/ snappy
$ sudo zipper intall snapd
$ sudo systemctl enable –now snapd.socket

#2 Find  and Check VLC Application Version on Snap package manager

After installed snapd package, you can execute the following command to check the current VLC version in snap if it is V3.0. Type:

$ sudo snap find vlc

Outputs:

root@ubuntu-dev:~# snap find vlc

Name                        Version                 Publisher    Notes  Summary

vlc                         3.0.4                   videolan     -      The ultimate media player
mjpg-streamer               2.0                     ogra         -      UVC webcam streaming tool
audio-recorder              1.1.2+rev1413+pkg-7036  lin-buo-ren  -      A free audio-recorder for Linux
simplescreenrecorder-mardy  0.3.8-3                 mardy        -      Simple Screen Recorder

From the above output, you will see that the version of vlc is 3.0.4.

#3 Install VLC 3.0 via snap

Type the following command:

$ sudo snap install vlc

#4 Start VLC

Type the following command to start vlc application to watch multimedia file.

# vlc &

If you want o remove vlc application, you still can use the snap package manager to remove it. Just type the following command:

$ sudo snap remove vlc

 

How to Install Nginx on OpenSUSE Linux

This post will guide you how to install Nginx web server on OpenSUSE Linux. How do I install Nginx, PHP and MySQL Web server on your OpenSUSE Linux.

What is Ngiunx?


NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Install Nginx on OpenSUSE Linux


To Install Nginx on OpenSUSE Linux, you just need to do the following steps:

#1 install and configure SUSEfirewall2

You need to install SuSefirewall2 package to configure firewall policy with zipper command. Type the following command:

# zipper install SuSefirewall2

Then you need to update the configuration file of SuSefirewall2, it is located in /etc/sysconfig/SuSefirewall2, edit it with vim editor, type:

# vim /etc/sysconfig/SuSefirewall2

Find one variable called “FW_SERVICES_EXT_TCP” and change it as below:

FW_SERVICES_EXT_TCP="22 80 443"

Save and close the file. Then restart SuSEfirewall2 service. Type the following command:

# /sbin/rcSuSEfirewall2 restart

# systemctl restart sshd.service

#2 install and Configure Nginx

You can use the zipper tool to install nginx package and it’s dependency packages. Type:

#zypper install nginx

#3 enable the Nginx service

You need to enable the nginx service so that it can be started at boot time. Type:

# systemctl enable nginx

#4 start the Nginx service

Type the following command:

# systemctl  start nginx

Now you can create one index.html file in the root web directory located in “/src/www/htdocs”. Then try to access the web service with web browser, then type the link address: http://127.0.0.1

Install MariaDB on OpenSUSE Linux


You can also use the zipper command to install the stable MariaDB, type:

# zipper install mariadb mariadb-client

Then enable and start mariadb service, type the following command:

# systemctl enable mariadb

# systemctl start mariadb

Install PHP-FRM on OpenSUSE Linux


If you need to install php5-fpm, just type the following command:

# zipper install php5 php5-mysql php5-fpm php5-gd php5-mbstring

Then you need to update the configuration file of php5-fpm located in /etc/php5/fpm/php-fpm.conf, changing some variables like as the below lines:

error_log = log/php-fpm.log

user = nginx

group = nginx

listen = /var/run/php-fpm.sock

listen.owner = nginx

listen.group = nginx

listen.mode = 0660

cgi.fix_pathinfo=0

Save and close the file.

Start php-fpm service and restart the nginx service, type:

# systemctl start php-fpm

# systemctl restart nginx

 

 

 

Configure Network Bridge on Ubuntu Debian Linux

This post will guide you how to setup and configure a network interface bridge on Ubuntu or Debian Linux system. How do I create a network bridge based on an existing network interface on Ubuntu Linux.

Configure Network Bridge on Ubuntu Debian Linux


If you want to create a network bridge, and you need to find one network interface, and then update one configuration file called /etc/network/interface. Just do the following steps:

#1 Install brctl package

Type the following command:

# apt-get install bridge-utils

Outputs:

root@ubuntu-dev:~# apt-get install bridge-utils

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

bridge-utils

0 upgraded, 1 newly installed, 0 to remove and 480 not upgraded.

Need to get 28.6 kB of archives.

After this operation, 102 kB of additional disk space will be used.

Get:1 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 bridge-utils amd64 1.5-9ubuntu1 [28.6 kB]

Feched 28.6 kB in 4s (5,753 B/s)

Selecting previously unselected package bridge-utils.

(Reading database ... 179571 files and directories currently installed.)

Preparing to unpack .../bridge-utils_1.5-9ubuntu1_amd64.deb ...

Unpacking bridge-utils (1.5-9ubuntu1) ...

Processing triggers for man-db (2.7.5-1) ...

Setting up bridge-utils (1.5-9ubuntu1) ...

#2 create network bridge br0

If you want to create a network bridge br0 based on the network interface enp0s3, you need to create an configuration file called bro, and placed it in /etc/network/interfaces.d/ directory.

Create br0 file via vim editor:

# vim /etc/network/interfaces.d/br0

Adding the following lines into the file.

# For the bootproto as static

auto br0

iface br0 inet static

address 192.168.1.199

broadcast 192.168.1.255

netmask 255.255.255.0

gateway 192.168.1.1

bridge_ports enp0s3

bridge_stp off

bridge_waitport 0

bridge_fd 0

# For the bootproto as DHCP

auto br0

iface br0 inet dhcp

bridge_ports enp0s3

#3 restart the network service

After updated the configuration file, and you need to restart the network service, type:

# systemctl restart network.service

#4 show bridge

# brctl show

Use Cloud Images to Create Virtual Machines with Uvtool

This post will guide you how to use cloud images to create virtual machines with KVM in Ubuntu Linux. How do I create a virtual machine using a cloud images with uvtool on Ubuntu Linux 16.04/14.04.

What is Uvtool?


Starting with 14.04 LTS, a tool called uvtool greatly facilitates the task of generating virtual machines (VM) using the cloud images. uvtool provides a simple mechanism to synchronize cloud-images locally and use them to create new VMs in minutes.

Create VM with Uvtool in Ubuntu


If you want to create a virtual machine with uvtool in Ubuntu Linux, just do the following steps:

#1 Install and Configure KVM

Type the following command to install and configure KVM on Ubuntu Linux:

$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
# kvm-ok
# apt install virt-manager
# virt-manager

# 2 Install uvtool Pakcage

Type the following command to install uvtool package:

# apt install uvtool  -y

This command will install uvtool’s ain commands: uvt-simplestreams-libvirt and uvt-kvm.

#3 get the Ubuntu cloud image

You can execute uvt-simplestreams-libvirt to download the Ubuntu cloud image, type:

$ uvt-simplestreams-libvirt sync arch=amd64

This command will download all the Ubuntu cloud images from the office site.

And you can run the following command to check what has been downloaded:

$ uvt-simplestreams-libvirt query

Outputs:

$ uvt-simplestreams-libvirt query

release=oneiric arch=amd64 label=release (20130509)

release=precise arch=amd64 label=release (20160315)

release=quantal arch=amd64 label=release (20140409)

release=raring arch=amd64 label=release (20140111)

release=saucy arch=amd64 label=release (20140709)

release=trusty arch=amd64 label=release (20160314)

release=utopic arch=amd64 label=release (20150723)

release=vivid arch=amd64 label=release (20160203)

release=wily arch=amd64 label=release (20160315)

release=xenial arch=amd64 label=beta1 (20160223.1)

#4 Generate the SSH Keys

Type the following command:

# ssh-keygen

Outputs:

[root@devops ~]# ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:R25TT2+VUXIU7eCNRsCe55nIr2iY7eMr4F8TNFNUZDc root@devops

The key's randomart image is:

+---[RSA 2048]----+

|           o++=EO|

|           ...o+=|

|          =..+.*.|

|         + +oo=.+|

|        S *. =.oo|

|      .  o oo +. |

|     . . +o  .   |

|      . +.+o  .  |

|       ..==o..   |

+----[SHA256]-----+

#5 create the VM using uvt-kvm

Type  the following command:

# uvt-kvm create vm1

Get the list of running Ubuntu cloud image VMs

Type the following command:

# uvt-kvm list

Destroy VM

Type the following command:

# uvt-kvm destroy vm1

Install KVM on Ubuntu 14.04/16.04

This post will guide you how to install and configure KVM and create a virtual machines on Ubuntu 14.04/16.04 Linux. How to install and setup KVM on Ubuntu 18.04 to create a VM guest.

What is KVM?


Kernel Virtual Machine KVM (for Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. Using KVM, one can run multiple virtual machines running unmodified Linux or Windows images. Each virtual machine has private virtualized hardware: a network card, disk, graphics adapter, etc.

KVM Installation


#1 Pre-installation Checklist

You need to check that you CPU supports hardware virtualization, and you need to make sure that you Intel or AMD CPU have developed extensions for their processors, deemed respectively Intel VT-x  and AMD-V. Type the following command to check the compatibility:

# egrep –c ‘(vmx|svm)’ /proc/cpuinfo

If the output of this command is 1 or greather than 1, and it indicates that you system can be used to create VM guest with KVM virtualization technology.

#2 Install KVM Packages

Type the following command:

$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

#3  Verify KVM installation

Type the following command:

# kvm-ok

Or

#virsh –c qemu:///system list

Outputs:

[root@devops ~]# virsh -c qemu:///system list

Id    Name                           State

----------------------------------------------------

#4 install Virtual Machine Manager

You can install an virtual machine manager which is a desktop application to manage the KVM virtual machines through libvirt.

Type the following command:

# apt install virt-manager

After you have installed virt-manager package, just run the following command to startup virtual manager application.

# virt-manager

Then you can follow the guide to create a new virtual machine.

 

Linux Delete All Root User Mails

This post will guide you how to delete all root user mail on Linux. How do I delete all root emails from a shell in Linux system. Or how to empty root inbox on Linux or Unix system.

Linux Delete All Root User Mails


If you want to delete all emails from root mailbox in Linux, you just need to remove mailbox file for root user, and this mail file is located in /var/spool/mail/root or /var/mail/root. Type the following command:

# > /var/mail/root
# > /var/spool/mail/root

There is another way to delete all root user mails in Linux, you can use Mail or Mailx command to achieve the same result.

Install Mail Tool

The Mail package is not installed by default in Linux system, so you need to install it firstly.

For CentOS/RHEL Linux:

Type the following command:

# yum install mailx

Outputs:

[root@devops ~]# yum install mailx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package mailx.x86_64 0:12.5-19.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mailx x86_64 12.5-19.el7 base 245 k

Transaction Summary
================================================================================
Install 1 Package

Total download size: 245 k
Installed size: 466 k
Is this ok [y/d/N]: y
Downloading packages:
mailx-12.5-19.el7.x86_64.rpm | 245 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mailx-12.5-19.el7.x86_64 1/1
Verifying : mailx-12.5-19.el7.x86_64 1/1
Installed:
mailx.x86_64 0:12.5-19.el7
Complete!

For Ubuntu/Debian Linux:

You need to use the apt-get command to install mail package, type:

# apt install mailutils

For Fedora Linux:

Type the following command:

# dnf install mailx

Read Email about Root User Using Mail command

You just need to execute mail command directory in CLI, type:

# mail

Or

#mailx

Outputs:

[root@devops ~]# mail
No mail for root

Delete Root Mails using Mail Command

You can remove all emails of root or any other user on Linux system using the following command:

# echo ‘d *’ | mail –N

 

Automatic YUM Updates with Yum-cron

This post will guide you how to use yum-cron to update system under CentOS/RHEL Linux. How do I configure yum automatic updates with yum-cron tool in Linux. How to set yum updates with yum-cron.

What is Yum-cron?


The yum-cron is an optional package starting from RHEL 6/CentOS 6 and it is a yum plugin.
yum-cron is a simple way to call yum commands from cron. It provides configuration to keep repository metadata up to date, and to check for, download, and apply updates.

Install yum-cron


If you want to setup automatic yum updates with yum-cron, you need to install the yum-cron package firstly. Type the following command:

# yum install yum-cron

Outputs:

[root@devops ~]# yum install yum-cron
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package yum-cron.noarch 0:3.4.3-158.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
yum-cron noarch 3.4.3-158.el7.centos base 63 k

Transaction Summary
================================================================================
Install 1 Package

Total download size: 63 k
Installed size: 51 k
Is this ok [y/d/N]: y
Downloading packages:
yum-cron-3.4.3-158.el7.centos.noarch.rpm | 63 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : yum-cron-3.4.3-158.el7.centos.noarch 1/1
Verifying : yum-cron-3.4.3-158.el7.centos.noarch 1/1

Installed:
yum-cron.noarch 0:3.4.3-158.el7.centos

Complete!

Start Yum-cron Service


After installed yum-cron package, you need to start the yum-cron service.

For CentOS 7/RHEL 7 Linux:

# systemctl start yum-cron.service

Outputs:

[root@devops ~]# systemctl start yum-cron
[root@devops ~]# systemctl status yum-cron
yum-cron.service - Run automatic yum updates as a cron job
Loaded: loaded (/usr/lib/systemd/system/yum-cron.service; enabled; vendor preset: disabled)
Active: active (exited) since Sun 2018-09-16 11:14:36 EDT; 2s ago
Process: 3579 ExecStart=/bin/touch /var/lock/subsys/yum-cron (code=exited, status=0/SUCCESS)
Main PID: 3579 (code=exited, status=0/SUCCESS)

Sep 16 11:14:36 devops systemd[1]: Starting Run automatic yum updates as a .....
Sep 16 11:14:36 devops systemd[1]: Started Run automatic yum updates as a c...b.
Hint: Some lines were ellipsized, use -l to show in full.

For CentOS 6/RHEL 6 Linux:

Type the following command:

# service yum-cron start

Configure Yum-cron


You need to edit the configuration file of yum-cron, and it is located in /etc/yum/yum-cron.conf.

For CentOS 6/RHEL 6 Linux:

Adding the below line into the file:

MAILTO=osetc@gmail.com
YUM_PARAMETER=kernel* http*

Note: The YUM_PARAMETER variable is used to exclude packages using yum-cron to update the system. So it won’t update the kernel and http packages.

For CentOS 7/RHEL 7 Linux:

Adding the below line into the file:
MAILTO=osetc@gmail.com
exclude=kernel* http*

Then save and close the file.

You still need to restart the yum-cron service.

Type the following command:

# systemctl restart yum-cron

Or

# service yum-cron restart

By default, the yum-cron tool will be run daily based on the yum-daily.cron job. Let’s see this cron job.

[root@devops ~]# cat /etc/cron.daily/0yum-daily.cron
#!/bin/bash
# Only run if this flag is set. The flag is created by the yum-cron init
# script when the service is started -- this allows one to use chkconfig and
# the standard "service stop|start" commands to enable or disable yum-cron.
if [[ ! -f /var/lock/subsys/yum-cron ]]; then
exit 0
fi
# Action!
exec /usr/sbin/yum-cron

If you want to get more information about the yum-cron, just see the man page of yum-cron.

# man yum-cron

 

Linux/Awk: Print Filename

This post will guide you how to print filename with awk tool in Linux. How do I print multiple filenames with Awk tool under CentOS/RHEL/Ubuntu Linux.

Print Filename with Awk


If you want to print the filename with awk tool, you just need to use the print command in the awk script, and then pass FILENAME variable to print. Like this:

# awk '{print FILENAME}' /etc/passwd

Outputs:

[root@devops ~]# awk '{print FILENAME}' /etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd
/etc/passwd

If you just want to print one line of filename in the awk prompt, just type the following awk command:

# awk 'FNR ==1{ print FILENAME }' /etc/passwd

Outputs:

[root@devops ~]# awk 'FNR ==1{ print FILENAME }' /etc/passwd
/etc/passwd

Print multiple Name with Awk


You can pass a filename with wildcard to AWK command, and so it will print all filename match the pattern. Type the following command:

# awk '{ print FILENAME; nextfile } ' /root/*.sh

Outputs:

[root@devops ~]# awk '{ print FILENAME; nextfile } ' /root/*.sh
/root/fio1.sh
/root/fio2.sh
/root/test1.sh
/root/test2.sh

 

CentOS Linux: Install Keychain Manager For SSH-agent

This post will guide you how to install keychain manager for ssh-agent in y our Linux system.

What is Keychain?


keychain – re-use ssh-agent and/or gpg-agent between logins
Synopsis

keychain [ -hkQqV ] [ --clear --help --ignore-missing --noask --nocolor --nogui --nolock --quick --quiet --version ] [ --agents list ] [ --attempts num ] [ --dir dirname ] [ --host name ] [ --lockwait seconds ] [ --stop which ] [ --timeout minutes ] [ keys... ]

Description

keychain is a manager for ssh-agent, typically run from ~/.bash_profile. It allows your shells and cron jobs to share a single ssh-agent process. By default, the ssh-agent started by keychain is long-running and will continue to run, even after you have logged out from the system. If you want to change this behavior, take a look at the –clear and –timeout options, described below.

When keychain is run, it checks for a running ssh-agent, otherwise it starts one. It saves the ssh-agent environment variables to ~/.keychain/${ HOSTNAME }-sh, so that subsequent logins and non-interactive shells such as cron jobs can source the file and make passwordless ssh connections. In addition, when keychain runs, it verifies that the key files specified on the command-line are known to ssh-agent, otherwise it loads them, prompting you for a password if necessary.

Keychain also supports gpg-agent in the same ways that ssh-agent is supported. By default keychain attempts to start all available agents but will fall back to only gpg-agent or only ssh-agent if either is unavailable. You can specifically limit keychain using the –agents option.
keychain supports most UNIX-like operating systems, including Cygwin. It works with Bourne-compatible, csh-compatible and fish shells.

Install keychain in CentOS Linux


You need to install the keychain package firstly. Do the following steps:

#1 enable psychotic repo, type the following command:

# rpm --import http://wiki.psychotic.ninja/RPM-GPG-KEY-psychotic

#2 install psychotic package

#rpm -ivh http://packages.psychotic.ninja/6/base/i386/RPMS/psychotic-release-1.0.0-1.el6.psychotic.noarch.rpm

Outputs:

[root@devops ~]# rpm -ivh http://packages.psychotic.ninja/6/base/i386/RPMS/psychotic-release-1.0.0-1.el6.psychotic.noarch.rpm
Retrieving http://packages.psychotic.ninja/6/base/i386/RPMS/psychotic-release-1.0.0-1.el6.psychotic.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:psychotic-release-1.0.0-1.el6.psy################################# [100%]
#3 install keychain package using yum command, type:
# yum --enablerepo=psychotic install keychain
Outputs:
[root@devops ~]# yum --enablerepo=psychotic install keychain
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
psychotic | 2.9 kB 00:00
psychotic/7/x86_64/primary_db | 70 kB 00:02
Resolving Dependencies
--> Running transaction check
---> Package keychain.noarch 0:2.8.0-3.el7.psychotic will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
keychain noarch 2.8.0-3.el7.psychotic psychotic 44 k

Transaction Summary
================================================================================
Install 1 Package

Total download size: 44 k
Installed size: 97 k
Is this ok [y/d/N]: y
Downloading packages:
keychain-2.8.0-3.el7.psychotic.noarch.rpm | 44 kB 00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : keychain-2.8.0-3.el7.psychotic.noarch 1/1
Verifying : keychain-2.8.0-3.el7.psychotic.noarch 1/1

Installed:
keychain.noarch 0:2.8.0-3.el7.psychotic

Complete!

#4 generate SSH keys

Type the following command:

# ssh-keygen –t rsa

Outputs:

[root@devops ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pHc9wiRYzts96nImi5AJIywtC5SifIwd37B/r/3AO1E root@devops
The key's randomart image is:
+---[RSA 2048]----+
| . |
| . = |
|.o . .. = . |
|*.+ o +o * o E |
|*+++ o..S = * |
|o+.o o.. ..+ o |
|. + . ..o. |
| . .+.=.o |
| . .Bo+o. |
+----[SHA256]-----+

#5 update .bash_profile in your home directory

Added the below line into this file:

/usr/bin/keychain $HOME/.ssh/id_dsa
source $HOME/.keychain/$HOSTNAME-sh

Keychain Examples


This snippet should work in any shell to load two ssh keys and one gpg key:

eval `keychain --eval id_rsa id_dsa 0123ABCD`

If you have trouble with that in csh:

setenv SHELL /bin/csh
eval `keychain --eval id_rsa id_dsa 0123ABCD`

This is equivalent for Bourne shells (including bash and zsh) but doesn’t use keychain’s –eval feature:

keychain id_rsa id_dsa 0123ABCD
[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
[ -f $HOME/.keychain/$HOSTNAME-sh ] && \
. $HOME/.keychain/$HOSTNAME-sh
[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ] && \
. $HOME/.keychain/$HOSTNAME-sh-gpg

This is equivalent for C shell (including tcsh):

keychain id_rsa id_dsa 0123ABCD
host=`uname -n`
if (-f $HOME/.keychain/$host-csh) then
source $HOME/.keychain/$host-csh
endif
if (-f $HOME/.keychain/$host-csh-gpg) then
source $HOME/.keychain/$host-csh-gpg
endif

To load keychain variables from a script (for example from cron) and abort unless id_dsa is available:

# Load keychain variables and check for id_dsa
[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
. $HOME/.keychain/$HOSTNAME-sh 2>/dev/null
ssh-add -l 2>/dev/null | grep -q id_dsa || exit 1

 

Linux Reload .vimrc File without Restarting Vim Editor

This post will guide you how to reload your .vimrc file without restarting vim editor in Linux. and how do I apply vim configurations without restarting vim on CentOS/RHEL Linux machine. How to reload syntax file without restarting vim.

If you cannot find your .vimrc file in your home directory, you need to create it. and in the most installations this file is not created by default.

Reload .vimrc File without Restarting Vim Editor


Let’s see the below detailed steps:
#1 open one file called fio.txt using vim editor

#vim fio.txt

#2 Load vim configuration file called ~/.vimrc, type Esc key, and then type :vs ~/.vimrc, press Enter key.

#3 added some configuration in .vimrc file, such as:

set number

#4 type :wq to save and close the current .vimrc file.

#5 type the following command to reload the latest .vimrc configuration file:

:so $MYVIMRC

Or

:source ~/.vimrc