Tuesday, April 4, 2017

How to Configure Proxy Settings in Linux

In this post, I will explain , how we set or configure the proxy setting in Linux server. Usually when you work on the cooperate server you work behind the proxy. So if you are trying to download any packages or software on the Linux operating system machine, you need to configure the proxy on your browser or on system profile.

1. If you want to set http_proxy shell variable on Linux terminal or bash shell, then please use the below command or method to set the proxy settings on terminal.

# export http_proxy=http://Proxy_IP:Proxyport

or

# export http_proxy=http://Proxy_Domain:ProxyPort

You can use above command to set the proxy on bash shell or on terminal. You can use Proxy IP as well as Proxy DNS name to configure the proxy on shell. In my case I have use proxy IP on my server.

#export http_proxy=http://192.168.1.70:8080

If you want to use https proxy then please run the below command to set the proxy settings on bash or any other shell.

#export https_proxy=https://Proxy_IP:ProxyPort

or

#export https_proxy=https://Proxy_Domain:ProxyPort

You can use this proxy on open shell only if you close the terminal or shell then you need to set proxy variable again.

If your proxy use authentication then you need to give proxy user name and password while you are running the above command.

#export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

2. If you want to setup proxy variable for all users then you need to set proxy environment as a global variable. To do this you need to set proxy variable on /etc/profile file.

# vi /etc/profile

export http_proxy=http://Proxy_IP:Proxyport

or

export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

3. If you want to set the proxy access to a specific user then you need to set the variable on their bash profile.

# vi /home/vibhor/.bash_profile

Append the following line:

export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port

or 

export http_proxy=http://Proxy_IP:Proxyport

You can use the https proxy or ftp proxy also only required to change the name of the varibale. 

Friday, March 24, 2017

HP-UX Logical Volume Manager (LVM) Commands with an Example

In this post, You can get an idea about HP-UX logical volume manager commands with an example. As you know LVM is basically used for disk management in operating system that allow to manager the physical disks and logical volume.

Please find the below HP-UX LVM commands with an example.

1. Create a new volume group, logical volume and file system:

You can used the below command in HP-UX operating system to create a new volume group, logical volume and file system.

hpx:/>pvcreate /dev/rdsk/c2t1d0

For creating a new volume group first we need to create physical volume as describe in above command.

hpx:/>mkdir /dev/vg01
hpx:/>mknod /dev/vg01/group c 64 0x010000

In above step we will create a directory where we need to create a volume group.

hpx:/>vgcreate /dev/vg01 /dev/dsk/c2t1d0

After successfully creation of volume group we will create a new logical voulme as describe in below command.

hpx:/>lvcreate -L 2048 /dev/vg01

hpx:/>newfs -F vxfs -o largefiles /dev/vg01/vgvol1

Using above command we create a new file system now in next step we will create a directory where we need to mount the newly created file system.

hpx:/>mkdir /backup
hpx:/>mount /dev/vg01/vgvol1 /backup

Once you mount the logical voulme with file system you can run the file system checking command to verify that mounting is succesfully or not.

2. Create a stripped filesystem:

In this, we will create a stripped file system with the help of volume group and logical voulme.

hpx:/>lvcreate -i 2 -I 32 -L 48 -n vgvol1 /dev/vg01

-i number of stripes
-I stripe size of 32KB
-L size of the volume

3. HP-UX display boot information:

You can use the below command to display boot information.

hpx:/>lvlnboot -v /dev/vg00

Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
        /dev/dsk/c2t0d0 (0/1/1/0.0.0) -- Boot Disk
        /dev/dsk/c2t1d0 (0/1/1/0.1.0) -- Boot Disk
Boot: lvol1     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Root: lvol3     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Swap: lvol2     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c2t1d0
Dump: lvol2     on:     /dev/dsk/c2t0d0, 0

When you run the above command you can find the above output , if you see the boot information you can find you have two disk which is available for boot.

4. HP-UX display all disks system information:

hpx:/> ioscan -funC disk
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
==============================================================
disk      0  0/0/2/0.0.0.0   sdisk    CLAIMED     DEVICE       TEAC    DV-28E-N
                            /dev/dsk/c0t0d0   /dev/rdsk/c0t0d0
disk      1  0/1/1/0.0.0     sdisk    CLAIMED     DEVICE       HP 146 GMAX3147NC
                            /dev/dsk/c2t0d0   /dev/rdsk/c2t0d0
disk      2  0/1/1/0.1.0     sdisk    CLAIMED     DEVICE       HP 146 GMAX3147NC
                            /dev/dsk/c2t1d0   /dev/rdsk/c2t1d0

In the above output you can found the all the disk which is available in the system.

5. HP-UX display dump devices:

hpx:/> lvlnboot -v

Normally it is showing the boot information in which you can check the dump devices name.

Wednesday, March 22, 2017

Solaris Processes Monitoring - prstat

In this post, I will explain you which commands is used for display the Solaris zone process information.

Using "prstat" command we can display the solaris zone process information. This command generate the reports information about the processes and zones.

The prstat statistics utility shows a summary of the processes that are using system resources currently. The prstat utility summarizes this information for an every 5 seconds by default and reports the statistics for that period.

Display the zones process informtion:

[sun]# prstat -Z

 PID USERNAME  SIZE   RSS STATE   PRI NICE      TIME  CPU PROCESS/NLWP
 18638 20159    2118M 1502M cpu43    10    0   0:00:44 2.4% oracle/7
 20927 24076    8784K 8136K cpu127    0    2   0:00:17 1.8% prstat/1
   897 24865     916M  512M sleep    59    0  27:52:32 0.7% java/95
 17511 26055     599M  285M sleep    59    0  35:08:33 0.6% java/115
 12540 26055     951M  341M sleep    59    0  31:00:01 0.5% java/101

 ZONEID    NPROC  SWAP   RSS MEMORY      TIME  CPU ZONE
     8     3427   73G   27G    21%  44:01:48 2.8% sunz01
     0      100  465M  132M   0.1% 507:26:46 2.6% global
     6     4056   86G   32G    25%  35:23:30 2.3% sunz02    
Total: 13382 processes, 36594 lwps, load averages: 9.11, 9.27, 9.47

Using above command "prstat -Z" we can monitor the server process utilization in every 5 second. This command is show you the global zone & their local zone process utilization only.

If you want to only specific zone process utilization then you can use the below command.

[sun]# prstat -z sun01

This command output show you only process utilization of specific zone only.

Note:

-Z Reports information about processes and zones.
-z Reports information about a particular zone.

You can use the below syntax to monitor the Global zone as well as only specific zone.

Sun Solaris zonecfg commands

In the last post, I had explained the usage of zoneadm command for Solaris servers, now in this post we will get the information about the "zonecfg" command. 

This is very useful command which is mostly used during configuration of new zone or installed zone as well as for removal of any zone configuration files.

1. Command for creating a Solaris zone:

Please find the below commands to creating a zone on Sun Solaris server. The command must be run on Global zone with root user.

[sun]#zonecfg -z <zone>

Example: [sun]#zonecfg -z sunz01

Once you run the above command, you can enter in the configuration file, where you can add or edit the configuration for the zone.

2. Command for deleting a Solaris zone:

Please find the below command to deleting a Solaris zone from Global zone.

[sun]#zonecfg -z <zone> delete -F

Example: [sun]#zonecfg -z sunz01 delete -F

using above command you can delete or remove the configuration file of solaris local zone.

Note: You need to shutdown and uninstall the local zone before deleting the configuration files of Sun Solaris local zone.

3. Command for display zone current configuration:

Please find the below command to display the current configuration of local Solaris zones.

[sun]#zonecfg -z <zone> info

Example: [sun]#zonecfg -z sunz01 info

This command output show you the zonename, zonepath, autoboot etc attributes information of the solaris zone.

4. Command for zone creation file:

Please find the below command to create a solaris zone creation file.

[sun]#zonecfg -z <zone> export

Example: [sun]#zonecfg -z sunz0 export

Once the creation file has been export you can use this file to another zone creation as well as for restoration of this local zone if any problem occur on this zone.

How to use zoneadm command in Solaris Servers

When you are working on the Solaris operating system then you must aware about this command "zoneadm" which is basic command in Solaris operating system. In this post I would like to explain you how to use the zoneadm command in Solaris servers.

"zoneadm" command are used for verification, installation, boot or viewing of the local zones which are created on the Solaris Server. Please find the below syntax with an example.

1. Verify a Solaris zone:

To verify the local solaris zone you need to run the below command with syntax.

[sun]#zoneadm -z <zone> verify

Example: [sun]#zoneadm -z sunz01 verify

In this example once you run the above command, if your zone is installed properly without any error then this is not showing you any output, that's means it is verified. After running the command if it is showing a message then you need to check the configuration of this zone.

2. Installing a Solaris zone:

To install the local Solaris zone you need to run the below command with syntax.

[sun]#zoneadm -z <zone> install

Example: [sun]#zoneadm -z sunz01 install

In this example when you run the above command then your local zone has been started for installation. It is installed the local zone using the Solaris repostiory or flar images which you are kept at server location.

3. Ready a Solaris zone:

To move the local zone in ready or maintainance state you need to run the below command.

[sun]#zoneadm -z <zone> ready

Example: [sun]#zoneadm -z sunz01 ready

In this example, when we run the above command then your local zone moved in to ready or maintianance state.

4. Boot a Solaris zone:

To boot the solaris zone on global system, you need to run the below command with syantx.

[sun]#zoneadm -z <zone> boot

Example: [sun]#zoneadm -z sunz01 boot

After running the above command your local solaris zone has been boot successfully if it is not showing any error during boot time. If you see any message during the boot time then please check where is the issue.

5. Reboot a Solaris zone:

To reboot or restart the solaris zone on Solaris server, you need to perform the below command on global zone.

[sun]#zoneadm -z <zone> reboot

Example: [sun]#zoneadm -z sunz01 reboot

Using this command the local zone "sunz01" has been restart again successfully. You need to run this command from global zone only.

6. Shutdown/Halt a Solaris zone:

If you want to shutdown or halt your local zone without login it, then you need to run the below command from global zone.

[sun]#zoneadm -z <zone> halt

Example: [sun]#zoneadm -z sunz01 halt

After running this command local solaris zone state change from running to installed state that's means your server is shutdown now.

7. Uninstall a Solaris zone:

If you want to uninstall any solaris zone then you need to run the below command for uninstall the zone.

[sun]#zoneadm -z <zone> uninstall -F

Example: [sun]#zoneadm -z sunz01 uninstall -F

"-F" syntax is used to uninstall the zone forcefully. 

8. Viewing a Solaris zone:

if you want to local zone current status and any other display information you need to run the below command. 

[sun]#zoneadm list -icv

 ID NAME       STATUS      PATH               BRAND   IP
   0 global         running        /                        solaris      shared
   1 sunz01        running       /zones/sunz01   solaris      excl
   2 sunz02        running       /zones/sunz02   solaris      excl

Using above command you can check the current status of all installed zones on Solaris server. It is show you the zone path and zone information. All the above command you need to run from Global zone with root privileges.

Monday, March 20, 2017

10 Practical Examples of RPM Commands in Linux

In this post, I will explain you the usage of RPM (Red Hat Package Manager) command with an example. RPM commands are widely used in Linux operating system to install, remove or update the packages on operating system.

RPM (Red Hat Package Manager) is a default open source and package management utlity which is widely used on Redhat, CentOS linux operating system. You can install , remove, upgrade the packages using this commnad. In this post We will explain each syntax with an example so you can understand how this command is very useful on linux operating system. So here, we will explain best 20 example which is related to Red Hat Package Manager.

1. How to Check an RPM Signature Package:

This command with syntax is used for to check the PGP signature of packages before installing them on your Linux systems and make sure its integrity and origin is fine.

[root@locahost]# rpm --checksig vsftpd-2.2.2-14.el6.x86_64.rpm
vsftpd-2.2.2-14.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK

2. How to Install an RPM Package:

Using below syntax you can install the rpm packages on the linux system.

[root@localhost]# rpm -ivh vsftpd-2.2.2-14.el6.x86_64.rpm
Preparing...               ########################################### [100%]
1:vsftpd                    ########################################### [100%]

On the above syantx we are using "-i" option to install the rpm packages on Linux operating system.

3. How to check dependencies of RPM Package before Installing:

If you want to check which packages or dependency is required for RPM packages then you can run the below command to check the dependency.

[root@localhost]# rpm -qpR samba-winbind-3.6.23-12.el6.x86_64.rpm

Here, you can find the syantx meaning of the above command.
-q : Query a package.
-p : List capabilities this package provides.
-R: List capabilities on which this package depends.

4. How to Install a RPM Package Without Dependencies:

If you want to install the packages without any dependency please use the below syntax.

[root@localhost]# rpm -ivh --nodeps samba-winbind-3.6.23-12.el6.x86_64.rpm
Preparing...                       ########################################### [100%]
1:Samba-winbind             ########################################### [100%]

The above command forcefully install rpm package by ignoring dependencies errors, but if those dependency files are missing, then the program will not work at all, until you install them.

5. How to check an Installed RPM Package:

If you want to check which RPM package is installed on the operating system then please use -q option with package name.

[root@localhost]# rpm -q samba
package samba is not installed

If you see the samba packages is not installed on my system so it is show you this message.

[root@localhost]# rpm -q vsftpd
vsftpd-2.2.2-14.el6.x86_64

You can see the above ftp server packages is installed on the system.

6. How to Upgrade a RPM Package:

If you want to upgrade any RPM packages then please use "-U" syntax with rpm name.

[root@localhost]# rpm -Uvh vsftpd-3.0.2-11.el6.x86_64.rpm
Preparing...             ########################################### [100%]
1:vsftpd                 ########################################### [100%]

If you see the above example the packages is upgrade with the new version of vsftpd.

7. How to Remove a RPM Package:

If you want to uninstall or remove the package from the server then please use "-e" erase option is used to remove package.

[root@localhost]# rpm -evv vsftpd

Using above command we can remove the packages with all dependency.

8. How to Remove an RPM Package Without Dependencies:

If you want to remove installed packages without any dependecy then use the below syntax to remove the rpm.

[root@localhost]# rpm -ev --nodeps vsftpd

Using above syntax "--nodeps" we can remove the packages without dependency.

9. How to Import an RPM GPG key:

If you want to import the RPM GPG key then please verify RHEL/CentOS/Fedora packages, you must import the GPG key.

[root@localhost]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

So using above syantx we can import the GPG key on the server.

10. How to List all Imported RPM GPG keys:

To print all the imported GPG keys in your system, use the following command.

[root@localhost]# rpm -qa gpg-pubkey*
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-7fac5991-4615767f

You can see the above entry these are the GPG key which is installed on the server.

Thursday, March 16, 2017

Step by Step Configuration of NTP Server on HP-UX Server

In this post, I would like to explain how we configure the NTP (network time protocol) server on HP-UX operating system server. In my recent post you can found the NTP configuration on Solaris and AIX platform. 

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network. It is basaiclly used for time synchronization on Unix servers.

Step by Step Configuration of NTP Server on HP-UX:

1. In the first step we will check the configuration files of "xntpd" daemon. By default the configuration file for this daemon is "/etc/rc.config.d/netdaemons".

# vi /etc/rc.config.d/netdaemons

######################################
# xntp configuration.  See xntpd(1m) #
######################################
#
#  Time synchronization daemon
#
# NTPDATE_SERVER: name of trusted timeserver to synchronize with at boot
# (default is rootserver for diskess clients)
# XNTPD:        Set to 1 to start xntpd (0 to not run xntpd)
# XNTPD_ARGS:  command line arguments for xntpd
#
# Also, see the /etc/ntp.conf and /etc/ntp.keys file for additional
# configuration.
#
export NTPDATE_SERVER=
export XNTPD=0
export XNTPD_ARGS=

This is default configuration entry of this file so for xntpd daemon we need to change the variable which is defined.

export NTPDATE_SERVER='ntp.in.pool.org'
export XNTPD=1
export XNTPD_ARGS=

Note: You must change the NTPDATE server name.

2. For ntp config please set the correct timezone is setup in /etc/TIMEZONE file.

hpx:/> cat /etc/TIMEZONE
TZ=IST-5:30
export TZ

You can edit the file in vi editor and change the time zone as per your location.

3. Now, we need to make some changes in NTP configuration files. 

hpx29:/> cat /etc/ntp.conf
#Configuration NTP des serveurs
server ntp.in.org.com
server ntpin.in.org.com

You need to replace ntp server name accordingly. In my post I will use dummy server name.

4. After setting the NTP server name we need to restart the NTP service on HP-UX operating system and verify the ntp configuration.

hpx:/> /sbin/init.d/xntpd restart

hpx:/> ntpq -p

If it is showing you correct ntp server information now. You can match these information with the NTP server name which we use in above step.