Wednesday, January 18, 2017

ifconfig command not found in centos 7 minimal installation

By default in Centos 7 minimal installation , ifconfig command is not found, so for obtenining this command , first you need to check which packages yum provide for this.

[root@localhost]# yum provides ifconfig

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Packages/filelists_db                                                                                                                              
No matches found

Note: here no packages is installed on the system.

So, using yum we will install the net-tool rpm which is required for ifconfig command

[root@localhost]# yum install net-tools*

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                  Arch           Version                                   Repository                    Size

Installing:
 net-tools                x86_64         2.0-0.17.20131004git.el7         Packages                        304 k

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

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                     1/1
Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                    1/1

Installed:
net-tools.x86_64 0:2.0-0.17.20131004git.el7

Complete!

Now run the ifconfig command after successfully installed the packages.

[root@localhost]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.26.12.1  netmask 255.255.0.0  broadcast 192.26.255.255
        inet6 fe80::250:56ff:febf:f6  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:bf:00:f6  txqueuelen 1000  (Ethernet)
        RX packets 18939  bytes 1251073 (1.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 433  bytes 63109 (61.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


[root@localhost]# yum provides ifconfig

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo: @Packages
Matched from:
Filename: /usr/sbin/ifconfig


Tuesday, January 17, 2017

How to create or increase a swap partition on Solaris

In this post, I will explain to you, how to create or increase a swap partition on Solaris operating system. Swap partition is more useful file system which is used on Solaris as a virtual memory. Once the resource memory utilization get full, then swap memory comes in the role which maintain the server performance on the Solaris operating system.

If your Solaris server is connected to SAN storage then we will create a extra swap partition with storage. Normally ZFS file system we are using in Solaris operating system. By default swap partition which we created during Solaris OS installation is use rpool. In my case we are using SAN storage space to create the new swap partition.

Step by Step method of creation of swap partition:

1. First you can check the current swap space with below command.

     sun#swap -l
     swapfile             dev    swaplo   blocks     free
     /dev/zvol/dsk/rpool/swap 228,1        16  8388592  5850576

If you see the the output, only one "swap" named file is created on the server.

Note: this is default swap partition which we created during OS installation.

2. Now I want to increase my swap partition. for this please run the below command.

    sun#zfs create –V 64G san/swap1

    sun#swap –a /dev/zvol/dsk/san/swap1

In above command, I will created the new swap file "swap1" with 64 GB.

3. Swap partition is created now, you can check the status by below command
 
    sun#swap -l

4. For permamnent entry please add this file system in /etc/vfstab

/dev/zvol/dsk/san/swap1 -       -       swap    -       no      -

Note: If after reboot or shutdown the server, swap space is not present then please check the /dev/zvol/dsk/san directory and found the swap file name after that run the below command

swap –a /dev/zvol/dsk/san/swap1

Hope, you like this post, In case of any query please comment on this post, I will try to resolve your problem asap.

Monday, January 9, 2017

Solaris local zone not booting "zoneadm: zone 'zone_name': call to zoneadmd failed"

Hello Friends,

In this post, I will explain you the one important issue which we generally facing while we boot the local Solaris zone on the Sun Solaris operating system.

When you are trying to boot the local zone from your Global zone, you encounter the below error message as mentioned below.

Error: zoneadm: zone 'sunz1': "/usr/lib/fs/zfs/mount das/sunz1/export /zones/sunz1/root/export" failed with exit code 1
zoneadm: zone 'sunz1': call to zoneadmd failed.



Solution: For such type of issue is normally related to NFS. When you boot the server, it will start NFS service before start zones. so, as NFS is started, FS /zones/sunz1/root/export  is already in use so global zone doesn't want to start a zone with a FS already in use by a process. You can check which file system is mounted on your global zone as describe below.

sun:/> cat /etc/dfs/dfstab

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home
share -F nfs -o rw=sun.vibhor.com:sunz1.vibhor.com /zones/sunz2/root/export

In above output you can see one folder is NFS mounted on the two local zone.

2. Now for resolving the issue , please stop the NFS service, boot the zone and restart the service.

sun:/> svcs status nfs/server
STATE          STIME    FMRI
online          5:13:30 svc:/network/nfs/status:default
online          5:13:36 svc:/network/nfs/server:default

Currently NFS server service is online on the Global zone, so using below command we will disable the service.

sun:/> svcadm disable nfs/server

sun:/> svcs status nfs/server
STATE          STIME    FMRI
disabled        5:21:57 svc:/network/nfs/server:default
online          5:13:30 svc:/network/nfs/status:default

3. Now we will boot the local zone again and see the existing error occur or not.

sun:/> zoneadm -z sunz1 boot

Note: Now your local zone is boot without any error. So normally this problem occur when NFS is mounted on the server.

4. Once the issue has been resolved you may enable the NFS server services.

sun:/> svcadm enable nfs/server

sun:/> svcadm restart nfs/server











If you see the my screen output images the whole method is describe step by step. If you facing still issue please comment on this post.

Friday, January 6, 2017

How to install Samba Server in RHEL 5

In this Post, I will describe how to install samba server in RHEL 5. Samba Server is basically used for file sharing services. 

In this article, We will install the Samba Server using "YUM" utility. All the required packages are installed using YUM.

Step by Step installation method of SAMBA Server:

1. In the first step, we will install the required packages or rpm for SAMBA server creation. As describe already for this I will use YUM utility.
#yum install samba*

Using above command all the required packages has been installed successfully.

2.  Now start the service of samba on the server operating system.

#service smb restart
#chkconfig  smb  on

Once you start the SAMBA service, you must permanent this services otherwise once you take a restart of your machine the service get disabled.

3. In this step , please create a folder which you want to share through samba.

#mkdir /backup

In my case I have created the "/backup" folder for SAMBA sharing.

4. Now, we will provide the full permission to samba folder to everyone have read/write access for this shared folder.

#chmod  -R 777 /backup

Permission for the samba folder depends upon your requirment.

5. In this step, go to the configuration file of samba and edit the below configuration lines which is mandatory during SAMBA server installation.

#vi  /etc/samba/smb.conf

"Changes all below in configuration file
Work group = SAMBA
Server string = This is my samba server
Uncomment  this line  ;netbios name= DNS server
Passwd backend= smb passwd

[backup]
path=/backup
browseable = yes
writable = yes
valid users = vibhor
guest ok = yes
Save the file"

If you see the above entry, the shared samba path is browseable and writeable for only valid user "vibhor". If you want provide access more user then you need to add user name in this entry.

6. Now to check the entry in samba is correct or not which I was made in smb.conf file, please run the below command for verification.

#testparm

7. Now add a user which you want to give a access of samba folder.

#useradd  vibhor
#passwd  vibhor

You can replace the user name according to your client requirement.

8. After final configuration is done , now you need to restart the samba services on the server, So that configuration is made permanent.

#/etc/init.d/smb  restart

8. In the final step, if you want to login on SAMBA server on same operating system you need to use below command for login.

#smbpasswd  -a  vibhor

It is asking the password , once you enter the Samba user password it is login on the server. And if you want to access the samba server from another Linux machine please use the below command/synatx for login.

#smbclient  //192.168.1.12/backup  -U  vibhor
smb>exit

So, using above step by step method you can installed and configured the SAMBA server on Red hat operating system. I would request to you please let me know if you facing any issue while creating the SAMBA server.

Thursday, January 5, 2017

How to Set a Solaris 11 Machine's NIS Domain Name

Hello Friends,

Hope you are doing well at your end. In this post, I will explain to you, how to set a Solaris machine NIS domain name on Solaris 11 operatings system. 

If domainname command not showing any output then you need to check either defaultdomain or NIS domain is configured or not.

Steps which we need to follow to set the NIS domain name as describe below.

1. Please run  "cat /etc/defaultdomain" command and check the output that domain is set or not.

    #domainname

The above command shows you the current domain name on the server, if no output is display you need to set the domain by below command.

   #domainname UNIX

Run the below command to check the output again.

   #domainname
   UNIX

You can see the output. All the above command is used for checking and setting the domain name on the Solaris operating server.

2. If you want to set the domain using NIS, then first please check the NIS/DOMAIN service is running or not

root@sun:~# svcs status nis/domain
STATE          STIME    FMRI
disabled       18:20:04 svc:/network/nis/domain:default

In my Solaris machine, currently NIS domain services is stop, we will start it later once we will configured the NIS domain name on the Solaris server.

3. Now you need to configure the NIS domain for your machine ( in my case - UNIX is my domain name)

root@sun:~# svccfg -s svc:/network/nis/domain setprop config/domainname = UNIX

If you see the above command, "svccfg" command is used to configure the domain and set the proper properties.

4. In the final step once the configuration has been completed you need to refresh & enable the NIS domain service again.

root@sun:~# svccfg -s nis/domain:default refresh
root@sun:~# svcadm enable nis/domain

You can check the NIS domain service status as describe in step 2. 

5. Now you can verify the domain name using below command so we can ensure that the NIS domain name has been set successfully. 

root@sun:~# domainname
UNIX
The above command output show "UNIX" domain name which we set during the configuration, so using these above method we can easily set the NIS domain name on the Solaris operating server.

I would request to you please comment on the post if you are facing any issue during setting the NIS domain name on Solaris platform. 

Tuesday, January 3, 2017

Remotely shutdown Linux & windows machine using shell script

Please find the below script for shutdown the Unix & Windows server remotely.

#!/bin/bash

 SSH=/usr/bin/ssh
 POWERCMD="/sbin/shutdown -h now"
 HOSTS="server1 server2 server3"

 # Shutdown remote machines
 for i in $HOSTS;
 do
  $SSH -l root $i $POWERCMD;
 done

  telnet=/usr/bin/telnet
  POWER="C:\Windows\System32\shutdown.exe \s"
  IP="server1 server2 server3"

  # Shutdown window machine
  for i in $IP;
  do
        $telnet -l administrator $i $POWER;
  done

 # Shutdown ourself
 /sbin/shutdown -h now

Monday, January 2, 2017

Step by step installation method of FTP server in linux

In this post, I will guide to you how to install or create the ftp server in Linux operating system.

Generally FTP server is used to upload or download the files from server machine to client machine. FTP works on TCP 20/21 protocol, TCP port 20 is used for uploading and TCP 21 port is used for downloading purpose.

In this article, I will explain step by step method of ftp server creation and configuration.

Step by step method of FTP server installation and configuration:

1. In the initial step , we will install the all required rpm or packages on the Linux server using "YUM" utility.

#yum  install  vsftpd*

If you have source rpm packages then you can install it. In our case we will install the rpm with yum. Using above command all the ftp packages and their dependency are installed.

2. Once the required packages has been installed successfully on the Linux server, we will start the ftp services on the server.

#service  vsftpd  start

Once the service start successfully we will make permanent it so after reboot of server it would be enable always.

#chkconfig vsftpd on

3. Now, to check the location of ftp server file which we upload or create after ftp server installation.

#cd /var/ftp/pub
#ls

And check the file which you have created after ftp server installation. If you find your created file here then you can ensure your ftp server has been installed successfully on Linux server.

4. Now for checking the ftp server using login in it.

# ftp  Server IP address  ( In my case server ip is 192.168.1.240)
Name(192.168.1.240:root):anonymous
Passwd   (press enter)   --- by defult anonymous password is blank

ftp>   (It will show you have successfully enter in ftp server)
ftp> ls
pub ( will see this directory in ftp location)
ftp>cd  pub
pub> mkdir  vibhor
pub> permission denied  (error getting)

5. To give the permission to make a directory in pub ,changes in this file

#vi  /etc/vsftpd/vsftpd.conf

Uncomment all these below lines
anonymous_enable=yes
anon_upload_enable=yes
anon_mkdir_write_enable=yes
save the file

6. Now we will take a restart of the ftp services again. You can follow the step 2 to take a restart of ftp services.

7. In this step we will provide the permission to pub folder so that client user can read/write the file and folder in the default direcoty.

#chmod 777  /var/ftp/pub

In my case I will give the full permission to pub folder. You can set the permission according to your project requirement.

8. If you want to ensure that you are able to created and access the folder or not on ftp server then in this case you need to login again in ftp server.

#ftp  192.168.1.240
Name: anonymous
Passwd (enter)
ftp> Cd  pub
pub>mkdir vibhor
vibhor           (directory created)
pub>ls
vibhor

If you want to check the directory which we created in above text please go to the below location and find it

#cd  /var/ftp/pub
Pub]#ls
Vibhor

So now you will get the file on the ftp pub folder which you created that means the permission which you provide to the user are working properly.

9. You want only one user is able to login by ftp server and access only one particular folder, also not able to delete the file and folder on ftp server, having a ability of uploading and downloading through ftp server. For this thing we have to change in configuration file and chroot_list, ftpuser file.

First create a user which you want to access for ftp user
# useradd  -s /sbin/nologin  ttftpuser       (His shell is nologin so other user not login)
#passwd  ttftpuser

Now create a folder in ttftpuser which you want to give access

#cd  /home/ttftpuser
ttftpuser~]#mkdir  noidaftp
ttftpuser~]#chmod  777  noidaftp

Now go to the file chroot_list, add the user  only which you want to give access.

#vi  /etc/vsftpd/chroot_list
ttftpuser    (make a entry of user which you want to give access)

Now if you want no other user login in ftp server then entry all those user except chroot_list user in ftpuser file.

#vi /etc/vsftpd/ftpuser

Promartuser    (these are users on which ftp server is make )
Vibhor

Now go to configuration file and make changes in  file and change all the parameter which is required on the configuration files.

#vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
syslog_enable=NO
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
ftpd_banner=*************************Welcome to blah FTP service******************
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
listen_port=54321
cmds_allowed=ABOR,ACCT,ALLO,APPE,CDUP,CWD,EPRT,EPSV,FEAT,HELP,LIST,MDTM,MKD,MODE,NLST,NOOP,OPTS,PASS,PASV,PORT,PWD,QUIT,REIN,REST,RETR,RMD,RNFR,RNTO,SITE,SIZE,SMNT,STAT,STOR,STOU,STRU,SYST,TYPE,USER,XCUP,XCWD,XMKD

Save the file for above changes which is in bold text in file and restart the ftp services which is describe in step 2.

#service vsftpd restart

Now check login on console mode

#ftp  192.168.1.243 54321

Enter username:ttftpuser
Passwd..enter the passwd
ftp> you have successfully enter
ftp>ls
noidaftp      (folder you have seen)
ftp>put  vsftpd.conf        (it will upload file )
ftp>get  vsftpd.org          (it will download file)

If you want to change the user shell please run the below command method as describe below.

#usermod  -s  /sbin/nologin  username
#usermod  -s /bin/bash  username

So using above method we can easily installed and configured the ftp server on Linux operating system.