Category Archives: Installation

Simple shell script to know your Linux systems Interface IP’s

Below is the simple shell script  which tells simply scan all interface in Linux system and tells which interface  have what IP assigned.

#!/bin/bash

ip r l |grep kernel|awk ‘{print $3}’|paste -sd” “|while read line
do
ARRAY=$line

for i  in $ARRAY
do
IPREAD=`ip r l |grep ‘kernel’|grep $i|awk ‘{print $9}’`

echo “Interface:$i having $IPREAD IP assigned”
done

done

Sample Output:

Interface: wlan0   having  192.168.X.X   IP  assigned
Interface: virbr0   having  192.168.X.X   IP assigned

 

 

 

 

 

 

 

 

 

Advertisements

Simple way to share your file’s using python’s SimpleHTTPServer module.

Prerequisite:

python

Command:
python -m SimpleHTTPServer
eg. python -m SimpleHTTPServer 8000

1.If your firewall is enabled then make sure that above port is open

Open new terminal
Checking the connection are listening on port 8000

root@localhost:/# netstat -ncpl |grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python

2. Open your browser

python_module

3. To close connection over above mentioned port

press Ctrl + C

root@localhost:/# python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 …
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET / HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:02] code 404, message File not found
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET /favicon.ico HTTP/1.1” 404 –
127.0.0.1 – – [08/Nov/2015 08:17:02] code 404, message File not found
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET /favicon.ico HTTP/1.1” 404 –
127.0.0.1 – – [08/Nov/2015 08:17:16] “GET /data/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:21] “GET /mnt/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:28] “GET /var/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:30] “GET /var/tmp/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:16] “GET /var/www/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:17] “GET /var/www/emp_reg/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:19] “GET /var/www/emp_reg/a.php HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:24] “GET /proc/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:24] “GET /proc/149/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:25] “GET /proc/149/cgroup HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:25] “GET /proc/149/cgroup HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:34] “GET /bin/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:36] “GET /bin/bash HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:46] “GET / HTTP/1.1” 200 –
^CTraceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
“__main__”, fname, loader, pkg_name)
root@localhost/#

4.Check in Browser again after closing connection over mentioned port.

Mysql Backup Script

images

This is the Simple Shell Script to take the dump of Mysql Database either full or selective.
Requirements:
O.S:Linux
Editor:gedit vim according to our choice.
Software:mysql server installed in Linux.

Steps:
1. Write the shell script as Below.

#!/bin/bash
#shell script to take the backup of the mysql database dump
#first shell script will check for the user is root user or not,if not then it  exits.

user=`whoami`

if [ $user != ‘root’ ];then
echo ‘user $user  is not a root user this insidence will be reported ‘

exit 12
fi

host=’localhost’
mysql_user=’root’
mysql_pass=’root’
date=`date +%y-%m-%d`
#mysql dump used to create the dump of the database
echo “======================list of known databases==========================”

mysql -uroot -proot -e “show databases”

###########################################
#asking for the user which database you want to dump
echo “FULL or SELECTIVE”
echo  “Choose your database dump option”
read SEL
case $SEL in
FULL)
echo “Backup of all database”
mysqldump -uroot -proot –all-databases > /var/tmp/1.sql
if [ $? -eq 0 ];then
echo ‘database dump successful’
else
echo ‘database dump failed’
fi
exit 15
;;
SELECTIVE)
echo “Backup of selective database choose database you want to dump?”
read database
mysqldump -h$host -u$mysql_user -p$mysql_pass -B $database>$database.$date.sql
if [ $? -eq 0 ];then
echo ‘database dump successful’
else
echo ‘database dump failed’
fi
exit 15
;;
esce

2.save the shell script by <any name>.sh extension

3.We can run shell script either giving the executable permission to the file or by sh command as below
3.1 root@L595:~/shellscript#chmod 777 mysqldump.sh
root@L595:~/shellscript#./mysqldump.sh
or
root@L595:~/shellscript#sh mysqldump.sh

OUTPUT:
==================================================================================================
root@L595:~/shellscript# sh mysqldump.sh
======================list of known databases==========================
+——————–+
| Database           |
+——————–+
| information_schema |
| employee           |
| misal              |
| mysql              |
| performance_schema |
+——————–+
FULL or SELECTIVE
Choose your database dump option
FULL
Backup of all database
database dump successful
root@L595:~/shellscript#

*/backup of selective database */

root@L595:~/shellscript# sh mysqldump.sh
======================list of known databases==========================
+——————–+
| Database           |
+——————–+
| information_schema |
| employee           |
| misal              |
| mysql              |
| performance_schema |
+——————–+
FULL or SELECTIVE
Choose your database dump option
SELECTIVE
Backup of selective database choose database you want to dump?
employee
database dump successful
root@L595:~/shellscript#ls -l
employee.15-03-22.sql

Installation of Joomla on Fedora/CentOs/Redhat Linux

Joomla-Logo-Vert-Color-Slogan1

What is Joomla?                                                                                                         Joomla is one of the most Popular Content Management System (CMS) Like WordPress.Which is having different tools available creating the dynamic website, writing the Blogs. Without having prior knowledge of programming Language one can easily create dynamic pages, Blogs,Upload Pictures with Joomla.
Why to Install Joomla in Linux?
Linux is popular mostly in the server side and Use of Linux Apache Mysql Php (LAMP) for web hosting over the Cloud(VPS) or in Data Center is increasing now a days. Everything is open source. we can get advantage of different Communities for Troubleshooting    the  issues.

Perquisites:

  • Redhat Linux/Centos/Fedora
  • Linux Apache Mysql Php(LAMP) already installed using Package Manager (YUM).
  • JOOMLA.

In this tutorial I am going to show you how to install and configure the Joomla in Linux .

STEP 1:
First check all the required packages along with their dependencies are installed or not.If not then install it using YUM.
[root@srk html]# yum -y install httpd* mysql* php-*

STEP 2:
Go to the Document Root of Apache (/var/www/html) and Download the Joomla from the
https://joomlacode.org by wget command and extract it using             tar archive.
[root@srk html]# wget http://joomlacode.org/gf/download/frsrelease/18323/80367/Joomla_3.1.1-Stable-Full_Package.tar.gz [root@srk html]# tar -xzpvf Joomla_3.1.1-Stable-Full_Package.tar.gz
joomla wget
STEP 3:
Change the ownership and group ownership of the Document root to the Apache user.
[root@srk]# chown -R apache:apache /var/www/html
3
STEP 4:
Go to the configuration file of the apache and edit the following lines
[root@srk html]# vi /etc/httpd/conf/httpd.conf
ServerAdmin root@admin.com           # give your domain name here
ServerName http://www.admin.com:80      # give  name for site,if your DNS is configured otherwise keep IP address of your computer.
Restart the httpd service and permanently on the service
[root@srk html]#service httpd restart                                                              [root@srk html]# chkconfig httpd on
4
STEP 5:
Mysql Configuration
Login As a root user to Mysql,Create database joomla and grant all privileges as follows:
mysql> create database joomla;
mysql>grant all on joomla.* to joomla@’localhost’ identified by ‘redhat’;
mysql> flush privileges;
mysql>exit;
5
STEP 6:
Go to the Browser and type your domain name or ip address and press enter this will shows you joomla installation screen.
6
STEP 7:
Database Configuration
7
STEP 8:
Setup Completed.
8
STEP 9:
Admin Panel of joomla.

http://www.admin.com/administrator
10
11
STEP 10:
Your Site

http://www.admin.com

12

ESTABLISHING A TELNET SERVER IN RHEL6/FEDORA/CENTOS

sandesh

What is Telnet?


Telnet protocol is user to connect the remote Computer(also called as Host computer) over the TCP/IP network. Using Telnet client software we can establish a connection with the remote server such as (Linux,Unix,Mac).Once you establish a connection your terminal become an virtual Terminal.
Telnet can works on Port no 23.
We have to enter the command in command Prompt as
telnet hostname/IP address Port No(By default 23),which establish connection with the remote server.
Disadvantage using Telnet


The data transferred in between Client and server is in the form of Plane Text.
So there must be a possibility of Intruder (Hacker) can hack the data while data is being transmitted. So Telnet is not secure Protocol.
It can be used in small Offices,Colleges,Labs where there is no primary issue of security.
Most of Big companies strictly prohibit the use of telnet. They use SSH Protocol to connect with the Remote server which is very secure than the Telnet protocol.
Implementation of telnet server in RHEL6/FEDORA/CENTOS


For implementing the telnet server in Fedora/Centos/Rhel6 it is necessary to check the following package must be installed on system.
• telnet-server.
• xineted.
1.Check whether the packages are installed on system or not
rpm -qa telnet-server
rpm –qa xinetd

1

2.If the packages are not installed Install using yum or rpm command.
yum –y install telnet* xinetd

2

3.After installation of packages go to the configuration file of telnet and make change configuration file as follows.
vim /etc/xinetd.d/telnet
make disabled=no .so Telnet client can connect to the remote server.

3

4.Restart the xinetd service and also make telnet server can be available at booting time on as follows
service xinted restart
chkconfig telnet on

4

5.Telnet client can’t directly connected to root account. so add one user and assing password to that user
useradd sandesh
passwd sandesh
Logging to telnet server using the telnet client
1.Telnet client is not enabled on windows by default. for enabling it do following steps:
Start->Control Panel->Programs and Features->Turn Windows Feature on or off
->(check the check box) telnet->click on Ok button.
It will turn the telnet feature on.
2.Go to Run -> type CMD.
3.within Command Prompt type the command as follows
telnet ip ( ip address of remote server)
eg
telnet 192.168.2.129
4.It will ask for login user and password for connecting to the remote server, type User name and Password .

Aa

 

 


 

WELCOME TO THE WORLD OF OPEN SOURCE

Linux System Administration

Linux is operating system which was designed by the person named as Linus Torvalds. It is a free Open source PO SIX compliant Operating system. It can runs on wild variety of Hardware  platforms.The development of Linux is one of the most prominent examples of free and open source software collaboration. The underlying source code may be used, modified, and distributed—commercially or non-commercially—by anyone under licenses such as the GNU General Public License.
Linux mainly used as server side Operating System. Linux servers are more secure than any other operating system.

 

Introduction to Linux

  This tutorial is helping you to understand the  basic concept in Linux .
  What is Linux?
Linux is the Operating System which was developed by Linux Torvalds.It is free and open source operating System and it is diff rant from Unix operating system.Most of us we think that it is same as that of Unix.Its structure is similar to Unix.
Linux is mostly used as server side operating system which can be used to built various servers such as Mail server,web server,samba server,DNS server etc. We can use Linux as Desktop O.S such as Ubuntu,Linux Mint which is having very rich Graphical User interface.  The software’s run inside the Linux O.S are very diffrant from Windows O.S.
  Distributions
When the Linux was first discovered, it was Single Operating System.Linus created the original Version of Linux Kernel and it’ source  code was distributed to the people. So people from diff rant regions created the diffrant versions of Linux by modifying the source code.Today their are many distributions can be available such as Red Hat linux,Suse Linux,Ubantu,Linux Mint etc. Every Linux Distribution is made for specific purpose. So before installing the Linux,we have to think about that what type of services we actually want,example whether we want to use linux as a server or desktop. and according to that we have to go to specific Distribution

Root
Root is the Superuser in Linux.Root having full access over the system. The normal user having the limited privilege to access the system.The root user can do multiple tasks such user administration,server installation,Back up and Recovery,Monitoring the Log files etc.It can be represented in terminal as # and  the normal user can be represented by $ in terminal.


Shell

The computer can understand the language of 0’s and 1’s Known as the binary language. In early days of computing the instruction were providing using binary language which is difficult for all of us to read and write all those files in those directory .so in Linux there is special program called Shell. Shell accepts instruction from command line interface and and if it is valid command it passes to the kernel. The shell acts as an Interpreter which reads the command from input devices such as Keyboard and passes them into the Kernel.

Capitalization

The capitalization is one of the most important thing in Linux world .In widows world capitalization does not matter.

eg. If we create the folder  under Windows  and named as Data and search for the folder by naming the DATA|Data|data.  It will give same result named as Data because all  the folder name pointing towards the Data. But in linux   these folders or file names are different. These pointing towards  three different   folder. So the Data folder is different  from DATA folder.

Server Vs Desktop

Linux comes under two diff rant versions. Server version and Desktop   Version. The Server version contain only the command line interface (CLI).If we can install server version, then we will get only the Login shell with blinking cursor onto which we have to fire the commands.

If we can install Desktop version then we will get the nice fancy looking Graphical User Interface(GUI)  just like as windows. In  Linux Desktop we can also  install software just like windows like Games, Media players, Image editing software.

For beginner user it is better to install the Desktop version of Linux and play with Linux Such as Ubantu Linux, Linux Mint, Puppy Linux etc.

For better understanding watch below video.