Linux

Once a Linux VM is cloned, you need to do the following:

A. Make sure proper NIC card is selected in the VM settings.

B. Login to the VM. cd /etc/sysconfig/network-scripts -> vi ifcfg-eth0 -> Here change the IP address of the cloned VM. Delete hwaddress which is MAC

C. Come out from the directory by issuing cd .. and cd ..

D. cd /etc/syconfig -> vi network -> Here change hostname. Also here you can change Gateway

E. Remove duplicate MAC entry by deleting….

rm -rf /etc/udev/rules.d/70-persistent-net.rules

F. Now reboot the VM by issuing init 6 command

G. Once the VM is up, login and check.

————

To switch user to root in linux:

su –

————

1. Assign IP address to eth0 interface (NIC) card

cd /etc/sysconfig/network-scripts

ls

vi ifcfg-eth0

Here we can assign the IP address

to save and close it :wq!

To change the Default gateway

cd/etc/sysconfig/ vi network

2. To enable SSH / Root login

Vi /etc/ssh/sshd_config

<< To find escape :/Root >>

Service sshd restart

Service network restart

3. Su root – to execute commands

To restart / start / stop service

Su root

/etc/init.d/sshd restart

/etc/init.d/iptables stop

4. To login via GUI

command prompt

init 5

This will reboot the system and we can login via GUI

5. If you clone a Linux VM, you also need to take care of MAC which usually the parent VM’s MAC will be copied. We need to delete those

> first note down the VM’s MAC by VM -> Edit settings -> Network adapter

> In the VM, go to the below path

vi /etc/udev/rules.d/70-persistent-net.rules

Delete MAC entries which are not related to the cloned VM

6. df -h

To get partition size of all drives in human readable format

7. du -sh

To get folder size

8. uname -r

To get Kernel version

9. Grep

Grep command is used to search inside a file

  1. Open a file vi filename.
  2. /stringname and press enter.
  3. Repeat this if you want to search a repeatedly occuring character / word.

Enable SNMP on Linux servers:

https://theamvj.wordpress.com/2015/01/13/how-to-enable-snmp-on-linux-servers/

————–

Configuring on old linux – RHEL 3

Open Terminal and type

su –

To restart network type

/etc/init.d/network restart

ifconfig

If network is having issues, try giving commands

ifdown eth0

and

ifup eth0

—————

Configuring Network on Cent OS 7 / Redhat 7

Cent OS / Redhat 7 network configurations are little bit different compared to their old versions. During the setup you will configure the IP address however once the installation is completed and if you type ifconfig command, you will get error as command not found.

Cent OS 7 / RHEL 7 does not has ifcfg-eth0 NIC card. Instead it is ifcfg-ens160. so assign IP to this NIC card.

Cent OS 7 RHEL 7 IP configuration NIC card

To rectify this you need to install net-tools through yum command:

yum provides ifconfig
yum install net-tools

Once done make sure to issue the following commands:

service network restart
service sshd restart

you may also want to stop Firewall (iptables)

service iptables stop

———————

service command – list running services

The syntax is as follows for CentOS/RHEL 6.x and older (pre systemd):
service --status-all
service --status-all | more
service --status-all | grep ntpd
service --status-all | less

Print the status of any service

To print the status of apache (httpd) service:
service httpd status

List all known services (configured via SysV)

chkconfig --list

List service and their open ports

netstat -tulpn

Turn on / off service

ntsysv
chkconfig service off
chkconfig service on
chkconfig httpd off
chkconfig ntpd on

More details:

http://www.cyberciti.biz/faq/check-running-services-in-rhel-redhat-fedora-centoslinux/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s