Wednesday, 27 May 2015

Install Python 3 on CentOS Server


Install Python 3 on CentOS 6.5 Server


------------------------------------------------------------------------------------------------------------
Existing Python Packages You may already have Python installed on your server, you can verify using:

------------------------------------------------------------------------------------------------------------
 # which python
/usr/bin/python


# python --version
Python 2.6.6


------------------------------------------------------------------------------------------------------------
 Download Python 3
------------------------------------------------------------------------------------------------------------
# wget http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2 -O /var/tmp/Python-3.3.2.tar.bz2
 
Unzip the archive:
# bzip2 -cd /var/tmp/Python-3.3.2.tar.bz2 | tar xvf -


------------------------------------------------------------------------------------------------------------
 Install Python 3
------------------------------------------------------------------------------------------------------------ 
# cd /var/tmp/Python-3.3.2

Then setup compilation:
# ./configure


    Note: If you receive the error: configure: error: no acceptable C compiler found in $PATH during this step, run this command before configuring:

 
    # yum groupinstall "Development tools"
  
    Or Debian platforms:
    # apt-get install build-essential


Then build:
# make
# make install

------------------------------------------------------------------------------------------------------------ 
Verify Python 3 installation:
------------------------------------------------------------------------------------------------------------ 
# /usr/local/bin/python3 --version
Python 3.3.2

------------------------------------------------------------------------------------------------------------
 Create a link to Python 3 executable for easy usage:
------------------------------------------------------------------------------------------------------------
 # ln -s /usr/local/bin/python3 /usr/bin/python3

And check:
# python3 --version
Python 3.3.2


Friday, 1 May 2015

How to install Hadoop 2.6.0 in Ubuntu

How to install Hadoop 2.6.0 in Ubuntu (Single node setup)






Coming Soon with Documentation......... 

Thursday, 19 February 2015

Things to do after installation of CentOS-7

---------------------------------------------
Things to do after installation of CentOS-7
---------------------------------------------





-------------------------------------------
1) Install Following Required Commands
-------------------------------------------


yum install net-tools # -----> Install ifconfig Command
yum install wget # -----> Install wget Command
yum install lsof # -----> Install lsof Command
yum install mlocate # -----> Install updatedb Command
yum install bind-utils # -----> Install nslookup Command
yum group install "Development Tools" # -----> Install GCC and Development Tools

yum install mailx # -----> Install mail Command


Command to list groups on a CentOS 7
# yum group list



-------------------------------------------
2) Set Hostname
-------------------------------------------
echo 192.168.1.111 test.deva.com deva >> /etc/hosts
echo test.deva.com > /etc/hostname




-------------------------------------------
3) Set Bashrc Setting
-------------------------------------------

[root@localhost ~]#vi /etc/bashrc

#-------------------------------------------
#Custome CHANGES START
#-------------------------------------------
alias c='clear'
alias df='df -Th'
export HISTSIZE=10000
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTFILESIZE=10000…

#-------------------------------------------
#Custome CHANGES END
#-------------------------------------------

To apply bashrc changes , lgout from server & login again OR
run follwoing command

[root@localhost ~]#. /etc/bashrc




-------------------------------------------
4) Update Kernel
-------------------------------------------
[root@localhost ~]# yum update kernel




---------------------------------------------
5)Enable iptables (instead of firewalld)
---------------------------------------------

### Stop firewalld ### 
#systemctl disable firewalld.service
#systemctl stop firewalld.service


### Install IPtables ### 
# yum install iptables-services

Re-run the command to restart the iptables:
# service iptables restart

#systemctl enable iptables.service
#systemctl start iptables.service

#systemctl enable ip6tables.service
#systemctl start ip6tables.service




-------------------------------------------
6) Change NIC Name
-------------------------------------------
Change the default network interface name to “eth0′′
CentOS7 has a default nic name as “en016.....”,



# vi /etc/default/grub
Search for the line “GRUB_CMDLINE_LINUX” and append the following: “net.ifnames=0 biosdevname=0′′


        GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"


Then it Will look like this:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"



We had just added net.ifnames=0 biosdevname=0 in second last line.



Create a new configuration based on the currently running system using grub2-mkconfig command:
        # grub2-mkconfig -o /boot/grub2/grub.cfg


Rename the interface files by renaming the file 

        # mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0


Reboot the system:
        # reboot



After reboot, check the interface name:

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.58.255
inet6 fe80::20c:29ff:fe6e:b0ae prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:6e:b0:ae txqueuelen 1000 (Ethernet)
RX packets 25336 bytes 2829386 (2.6 MiB)
RX errors 0 dropped 11 overruns 0 frame 0
TX packets 172 bytes 35789 (34.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0




-------------------------------------------
6) Configure the static ip on the server
-------------------------------------------

Edit the interface file under /etc/sysconfig/network-scripts/ directory:


# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Here is my ifcfg-eth0 file as a sample, please change it according to your requirement:

     DEVICE="eth0"
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1


Stop and disable the NetworkManager service, because we don’t need it on the server:
# systemctl stop NetworkManager
# systemctl disable NetworkManager

Restart the network service(Be careful, if you are connecting remotely, because you will be disconnected after issue this command):
# service network restart






-------------------------------------------
7) Disable IPv6:(If U dont have use of IPV6)
-------------------------------------------
First check that IPv6 is enabled or not:

[root@localhost ~]# lsmod | grep -i ipv6

nf_conntrack_ipv6      18738  5 
nf_defrag_ipv6         34651  1 nf_conntrack_ipv6
nf_nat_ipv6            13279  1 ip6table_nat
nf_nat                 21798  4 nf_nat_ipv4,nf_nat_ipv6,ip6table_nat,iptable_nat
nf_conntrack          101024  8 nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,ip6table_nat,iptable_nat,nf_conntrack_ipv4,nf_conntrack_ipv6





Edit the grub file:
# vi /etc/default/grub

Search for the line “GRUB_CMDLINE_LINUX” and add the following at the beginning: “ipv6.disable=1′′ Will look like this:


GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto  rhgb quiet"
GRUB_DISABLE_RECOVERY="true"



GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto  rhgb quiet"
GRUB_DISABLE_RECOVERY="true"




Create a new configuration based on the currently running system using grub2-mkconfig command:
# grub2-mkconfig -o /boot/grub2/grub.cfg


Reboot the system:
# reboot

Once again, check the IPv6 on the system:
lsmod | grep -i ipv6





                    -------------------
                      End Of Document
                    -------------------

Monday, 9 February 2015

Recover or Reset MySQL root Password

------------------------------------------------------
Recover or Reset MySQL root Password
------------------------------------------------------



------------------------------------------------------
Step # 1 : Stop mysql service
------------------------------------------------------
# /etc/init.d/mysqld stop


------------------------------------------------------
Step # 2: Start to MySQL server w/o password:
------------------------------------------------------
# mysqld_safe --skip-grant-tables &


------------------------------------------------------
Step # 3: Connect to mysql server using mysql client:
------------------------------------------------------
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit


------------------------------------------------------
Step # 5: Stop MySQL Server:
------------------------------------------------------
# /etc/init.d/mysqld stop



------------------------------------------------------
Step # 6: Start MySQL server and test it
------------------------------------------------------
# /etc/init.d/mysqld start
# /etc/init.d/mysqld restart
# mysql -u root -p


------------------------------------------------------
END
------------------------------------------------------

Set Password Policy in Mysql 5.6


Set Password Policy in Mysql 5.6



-------------------------------------------------------------------------------------------
1) INSTALL PLUGIN loads the plugin, and also registers it in the mysql. plugins table
   to cause the plugin to be loaded for each subsequent normal server startup.
-------------------------------------------------------------------------------------------

mysql> INSTALL PLUGIN validate_password SONAME  'validate_password.so';


-------------------------------------------------------------------------------------------
2) Edit my.cnf file & Add following 2 parameters in my.cnf
-------------------------------------------------------------------------------------------
# vi /etc/my.cnf

[mysqld]
plugin-load=validate_password.so
validate-password=FORCE_PLUS_PERMANENT


-------------------------------------------------------------------------------------------
3) Login Mysql & Set Following parameters as per your requirement
-------------------------------------------------------------------------------------------
[root@maindb ~]# mysql -u root -p
Enter password:


mysql> SET GLOBAL validate_password_length = 8;
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL validate_password_number_count = 3;

Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL validate_password_special_char_count = 3;
Query OK, 0 rows affected (0.00 sec)


-------------------------------------------------------------------------------------------
4) Check Parameters
-------------------------------------------------------------------------------------------

mysql> SHOW VARIABLES LIKE 'validate_password%';

+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 3      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 3      |
+--------------------------------------+--------+
6 rows in set (0.00 sec)



-------------------------------------------------------------------------------------------
5) Test With Following Password
-------------------------------------------------------------------------------------------
select password('test');
select password('Test@12345');
select password('Test@123456789');
select password('Test@!#123456789');




[root@maindb ~]# mysql -u root -p

Enter password:

mysql> GRANT ALL PRIVILEGES ON demo.* TO 'devendra'@'localhost' IDENTIFIED BY 'Devendra@12345';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> GRANT ALL PRIVILEGES ON demo.* TO 'devendra'@'localhost' IDENTIFIED BY 'Devendra@!#12345';
Query OK, 0 rows affected (0.00 sec)





 

Sunday, 1 February 2015

Samba Server with Audit Log Facility


Samba Server with Audit Log Facility (Syslog) in CentOS 6.*



----------------------------------------------------------------------------------------
1) Stop unwamted Services or settings
----------------------------------------------------------------------------------------
# /etc/init.d/NetworkManager stop
# chkconfig NetworkManager off
Note: Make sure you have configured Network i.e. (IP Address/Netmask/Gateway/DNS)

# /etc/init.d/sendmail stop
# chkconfig sendmail off
# vi /etc/sysconfig/selinux
SELINUX=disabled


HOSTNAME=samba.deva.com



----------------------------------------------------------------------------------
2) Bashrc Setting
----------------------------------------------------------------------------------

#vi /etc/bashrc

#----------------------------------------------------------------------------------
#CHANGES START
#----------------------------------------------------------------------------------
alias c='clear'
alias df='df -Th'
export HISTSIZE=10000
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTFILESIZE=10000…


#----------------------------------------------------------------------------------
#CHANGES END
#----------------------------------------------------------------------------------


#. /etc/bashrc





----------------------------------------------------------------------------------------
3) Open Necessary Ports in iptables
----------------------------------------------------------------------------------------
# vi /etc/sysconfig/iptables

### deva Network ###
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 137 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 138 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 139 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 445 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 901 -j ACCEPT



Note :192.168.1.0/24 will be your Network

#/etc/init.d/iptables restart
#chkconfig iptables on


----------------------------------------------------------------------------------------
4) Install Require Packages and dependencies and verify
----------------------------------------------------------------------------------------
#yum update kernel

#yum install -y samba samba-commons cups-libs
#yum install samba* -y
#yum install xinetd samba-swat -y

----------------------------------------------------------------------------------------
5)Create Share , Group & User
----------------------------------------------------------------------------------------

[root@samba ~]# mkdir   /opt/data

[root@samba ~]# groupadd tech
[root@samba ~]# chgrp -R tech   /opt/data
[root@samba ~]# chmod -R 777   /opt/data

[root@samba ~]# useradd devendra.joshi
[root@samba ~]# usermod -G tech devendra.joshi
[root@samba ~]# smbpasswd -a devendra.joshi
New SMB password:
Retype new SMB password:
Added user devendra.joshi.







----------------------------------------------------------------------------------------
6)Backup smb.conf , Edit smb.conf & paste following config in smb.conf
----------------------------------------------------------------------------------------

[root@samba ~]# cp /etc/samba/smb.conf /etc/samba/smb.conf-ORG
[root@samba ~]# > /etc/samba/smb.conf





[root@samba ~]# vi /etc/samba/smb.conf



############################# Start of File #############################
[global]
 workgroup = MYGROUP
 passdb backend = smbpasswd:/etc/samba/smbpasswd.db
 log file = /var/log/samba/log.%m
 log level = 3
 idmap config * : backend = tdb

vfs objects = full_audit

# Audit settings
full_audit: prefix = %u|%I|%S
full_audit:failure = connect
full_audit:success = connect opendir mkdir rmdir open read pread write pwrite rename unlink chmodfchmod chown fchown ftruncate
full_audit:facility = local5
full_audit: priority = notice



[Tech Data]
 path = /opt/data
 vfs object = full_audit
 valid users = devendra.joshi
 write list = devendra.joshi
 read only = No
 create mask = 0777
 directory mask = 0777


############################# End of File #############################





----------------------------------------------------------------------------------------
7)Restart smb & nmb restart
----------------------------------------------------------------------------------------

[root@sambaserver ~]# /etc/init.d/smb restart && /etc/init.d/nmb restart

[root@sambaserver ~]# testparm




----------------------------------------------------------------------------------------
8) Configure samba server in GUI mode
----------------------------------------------------------------------------------------

[root@sambaserver ~]# yum install xinetd samba-swat -y



----------------------------------------------------------------------------------------
9) Configure SWAT
----------------------------------------------------------------------------------------

[root@sambaserver ~]# vi /etc/xinetd.d/swat

service swat
{
port = 901
socket_type = stream
wait = no
only_from = 127.0.0.1 192.168.1.0/24
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}




----------------------------------------------------------------------------------------
10) Restart samba and xinetd services
----------------------------------------------------------------------------------------

[root@sambaserver ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@sambaserver ~]# /etc/init.d/smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@sambaserver ~]# /etc/init.d/nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]


Open the web browser from any client syatems. In the address bar type “http://server-ip-address:901″ and press enter.
Now the console screen will open. You can start configure samba server here.





----------------------------------------------------------------------------------------
11) Install rsyslog
----------------------------------------------------------------------------------------

yum install rsyslog rsyslog-mysql

# service rsyslog start
# chkconfig rsyslog on



----------------------------------------------------------------------------------------
12) Edit rsyslog conf file & add following paramitters
----------------------------------------------------------------------------------------
[root@samba ~]# vi /etc/rsyslog.d/00-samba-audit.conf

local5.notice /var/log/samba/audit.log
&~


[root@samba ~]# vi /etc/rsyslog.d/50-default.conf

*.*;local5,auth,authpriv.none -/var/log/syslog

local5.notice /var/log/samba/audit.log



----------------------------------------------------------------------------------------
13) Log Rotation
----------------------------------------------------------------------------------------
[root@samba ~]# vi  /etc/logrotate.d/samba

/var/log/samba/audit.log {
   weekly
   missingok
   rotate 7
   postrotate
      /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
   endscript
   compress
   notifempty
}"


----------------------------------------------------------------------------------------
14 Restart Following Services
----------------------------------------------------------------------------------------
[root@sambaserver ~]# /etc/init.d/smb restart
[root@sambaserver ~]# /etc/init.d/nmb restart
[root@sambaserver ~]# /etc/init.d/rsyslog restart


[root@samba ~]# tail -f /var/log/samba/audit.log


----------------------------------------------------------------------------------------
    End of Document
----------------------------------------------------------------------------------------

Monday, 26 January 2015

SendMail on CentOS 6.4



----------------------------------------------------------------------------------------
 Install
Send Mail on CentOS 6.4 
----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------
2: Stop unwamted Services or settings
----------------------------------------------------------------------------------------

# /etc/init.d/NetworkManager stop
# chkconfig NetworkManager off
Note: Make sure you have configured Network i.e. (IP Address/Netmask/Gateway/DNS)

# /etc/init.d/postfix stop
# chkconfig postfix off
# vi /etc/sysconfig/selinux
SELINUX=disabled

------------------------------------------
3:  Upgrade Kernel Version
------------------------------------------
#

yum update kernel


Reboot The Server


----------------------------------------------------------------------------------------
4: Open Necessary Ports in iptables
----------------------------------------------------------------------------------------

# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT

#/etc/init.d/iptables restart
#chkconfig iptables on


----------------------------------------------------------------------------------------
5) Install Require Packages and dependencies and verify
----------------------------------------------------------------------------------------


[root@mail-server ~]# yum install sendmail sendmail-cf




----------------------------------------------------------------------------------------
6) Edit the file /etc/mail/sendmail.mc and add the following lines. Make sure you set
   your mail server domain name where it's bolded:
----------------------------------------------------------------------------------------


Most important part is to back up the MC macro file because that generates the CF file.

[root@mail-server ~]# cd /etc/mail

[root@mail-server ~]# cp sendmail.mc sendmail.mc.original
[root@mail-server ~]# cp sendmail.cf sendmail.cf.original



[root@mail-server ~]# vi /etc/mail/sendmail.mc

MASQUERADE_AS(yourdomain.com)dnl
MASQUERADE_DOMAIN(yourdomain.com)dnl
MASQUERADE_DOMAIN(alias.yourdomain.com)dnl


In the same file /etc/mail/sendmail.mc remove the "dnl" from the beginning of the lines so it will look like this:

LOCAL_DOMAIN(`localhost.localdomain')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl


(May B line num 119,120,121)
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=xxx.xxx.x.x, Name=MTA')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=xxx.xxx.xxx.xxx, Name=MTA')dnl




Note:
xxx.xxx.x.x =  Your Local IP
xxx.xxx.xxx.xxx =  Your Live IP



----------------------------------------------------------------------------------------
7) Save the file and compile it using m4:
----------------------------------------------------------------------------------------


[root@mail-server ~]# m4 /etc/mail/sendmail.mc > /etc/sendmail.cf

Send Sendmail a -HUP signal using kill or simply restart the daemon for the configuration changes to take effect:




----------------------------------------------------------------------------------------
8: Save the file and compile it using m4:
----------------------------------------------------------------------------------------


[root@mail-server ~]# service sendmail restart

Testing your configuration using sendmail
And that's it! you're done. Just send yourself a test email to make sure it is really working:

Check Sendmail Service is working or Not.

 



------------------------------------------------
[root@sendmail ]# ps ax|grep sendmail
------------------------------------------------

 9129 ?        Ss     0:00 sendmail: accepting connections
 9138 ?        Ss     0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
 9163 pts/0    S+     0:00 grep sendmail


------------------------------------------------
[root@sendmail ]# ps -aef |grep sendmail
------------------------------------------------


root      9129     1  0 16:20 ?        00:00:00 sendmail: accepting connections
smmsp     9138     1  0 16:20 ?        00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root      9166  8444  0 16:22 pts/0    00:00:00 grep sendmail



------------------------------------------------
[root@sendmail ]# lsof -i :25
------------------------------------------------


COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sendmail 9129 root    4u  IPv4  23017      0t0  TCP localhost:smtp (LISTEN)
sendmail 9129 root    5u  IPv4  23018      0t0  TCP sendmail:smtp (LISTEN)



Also check the maillogs if any errors.

[root@sendmail #  tail -f /var/log/maillog







----------------------------------------------------------------------------------------
9: Create a Mail User & set Password
----------------------------------------------------------------------------------------


[root@mail-server ~]# useradd --create-home -s /sbin/nologin devendra; passwd





----------------------------------------------------------------------------------------
10: Test Email with Following Script
----------------------------------------------------------------------------------------


[root@mail-server ~]# /usr/sbin/sendmail -t < mail.txt

Where the contents of the mail.txt file are:
Date: Mon Jan 26 14:52:30 2015
To: you@somewhere.com
Subject: The subject of the message
From: whatever@somewhere.com Body of message goes here





[root@mail-server ~]# vi mail.txt

Date: Mon Jan 26 14:52:30 2015
To: devendra.joshi@linukstricks.com
Subject: Test Mail From Sendmail
From: devendra@linukstricks.com Body of message goes here


Also check the maillogs

[root@sendmail #  tail -f /var/log/maillog

----------------------------------------------------------------------------------------
                    END
----------------------------------------------------------------------------------------

Monday, 1 December 2014

Linux file system structure

Linux file system structure

  





/ – The Root Directory

Everything on Linux system is located under the / or root directory. The meaning of / or root and root user are often confusing to new Linux users. In Linux, the root directory “/” (The tree of the file system starts at the trunk or slash, indicated by a forward slash /) is a separator between a file and a directory contains all underlying directories and files, yet root user is a super user or administrator user with has administrative privileges on the system vs Linux privileged users who only have limited privileges to protect system security.


/bin – Essential command binaries

The /bin directory is a place contains most commonly essential executable terminal binaries programs or file required during booting, repairing like cat, ls, mount, rm, du, df, tar, rpm, wc, etc.


/boot – Boot loader files

All of the required files to boot the system contains in /boot directory, including GRUB boot loader’s files, Linux kernels, the Linux initial RAM disk (initrd),


/dev – Device Files

All of the hardware devices on the machine like cdrom, cpu, hard drives, etc will be stored as special device files that represent all the devices in /dev directory. Device files are created during your Linux system installation.


/etc – Configuration Files

Contain host-specific files and directories, e.g. information about system and application configuration files like startup, shutdown, start, stop script for every individual program. In another word /etc data is very similar to Control panel in Microsoft Windows.


/home – Home Directory

Home directory of the users. Every time you create a new user, a new directory with user’s name is created in /home directory for users to store their own files within their own home’s directory. Most common automatic directories created within /home ‘s user are Desktop, Downloads, Documents, Music, Movie, etc. Most programs configuration file for a specific user will be saved in it’s users /home directory like web browser settings, web browser bookmarks, desktop wallpaper, themes, and passwords.


/lib – Essential Libraries

Similar to Windows ‘dll’ files, all Linux shared libraries and kernel modules files stores in /lib directory. These important Linux dynamic libraries are required to boot the system and run commands in the root file system.


/lost+found – Recovering Files

Sounds weird but yes we have lost+found in Linux file system structure. Every Linux file system and partitions has a lost+found in it’s directory. In the even your system is crashed or unexpected shutdown, you can run fsck command to check and repair the filesystem, fsck will turn any corrupted or almost-deleted files back into files that you can recover them later in /lost+found directory.


/media – Removable Media Devices

Every time you insert a removable device such as external hard drive, floppy disk, zip drive, CDs, DVDs, flash drive to a Linux system, a new directory will automatically be created inside the /media directory. /media directory is a temporary mount directory for removable devices.


/mnt – Temporarily mounted filesystems

While /media is where the system automatically mounts removable media, /mnt is for you to mount things (partitions, file systems, devices) manually and temporarily.


/opt – Optional software packages

The /opt directory is reserved to store addition software or extra and third-party software for your system, those addition software usually don’t follow the standard file system hierarchy and not handled by the package manager.


/proc – Kernel & Process Information

Similar to /dev, /proc directory contains information about running process, system resources and information. You can view information about any running process with a specific process-id (pid) or hardware’s information such as memory, cpu, io, etc…


/root – Root Home Directory

Don’t be confused with “/” or root directory, /root is a root account’s home directory determined by developer or local preference rather than /home/root to allow for booting the system even if /home/ is not available.


/sbin – System binaries

Similar to /bin, /sbin contains essential binaries that are generally intended to be run by the root user for system administration and maintenance purpose. For example: iptables, reboot, fdisk, ifconfig, swapon, init, ip, mount


/selinux – Security-Enhanced Linux

Selinux comes with RedHat based distro (fedora, centos), selinux is a security architecture integrated into the 2.6.x kernel using the Linux Security Modules (LSM). For some reason Centos 6 created an emtpry selinux directory in root directory, the real selinux directory with its configuration files are stored in /etc/selinux/ directory.


/srv – Service Data

Server (srv) contains data of services such as HTTP, FTP, rsync, cvs


/sys – virtual filesystem

Some newer Linux distros have /sys directory with sysfs virtual filesystem to store information and statistics about (physical and virtual) device and device names. /sys is newly added since Linux kernel 2.6 /sys contains similar information with /proc which display device information about the kernel’s view of the system.


/tmp – Temporary files

System’s Temporary Directory, all users and programs in your system can access/read/write in this directory. You should not save/store any important files/directories under /tmp since all files will be removed after system is rebooted.


/usr – binaries, documentation, source code, libraries

Pronounced as ‘user’, /usr contains the majority of user utilities, programs, libraries, documentation etc for all user-related second level programs rather than applications and files used by the system.


/var – Variable Files

Variable or /var contains data that is expected to change and grow as the system is running (log, mail, spool, temp)








Ref:http://www.namhuy.net/3230/linux-file-system-structure.html

Monday, 3 November 2014

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

 Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

 

Download epel Repo for CentOS 6:

 
[root@localhost]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@localhost]# rpm -Uvh epel-release-6*.rpm


[root@localhost]# yum repolist

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

You Will get above Error.

Then Follow the Following Steps.

Edit Repo & Change https to http for [epel],[epel-debuginfo] & [epel-source].

Only Replace https to http, rest all line keep as it is
 

[root@localhost]# vim /etc/yum.repos.d/epel.repo


[epel]
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

[epel-debuginfo]
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch

[epel-source]

mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch



[root@localhost]#  yum repolist

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                          | 5.2 kB     00:00    
epel-source/metalink                                                                                                   | 5.2 kB     00:00    
 * base: mirror.nbrc.ac.in
 * epel: kartolo.sby.datautama.net.id
 * epel-source: kartolo.sby.datautama.net.id
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
base                                                                                                                   | 3.7 kB     00:00    
base/primary_db                                                                                                        | 4.6 MB     00:06    
epel-source                                                                                                            | 3.7 kB     00:00    
epel-source/primary_db                                                                                                 | 1.8 MB     00:06    
extras                                                                                                                 | 3.3 kB     00:00    
extras/primary_db                                                                                                      |  19 kB     00:00    
updates                                                                                                                | 3.4 kB     00:00    
updates/primary_db                                                                                                     | 171 kB     00:00    
repo id                                       repo name                                                                                 status
base                                          CentOS-6 - Base                                                                            6,518
epel                                          Extra Packages for Enterprise Linux 6 - x86_64                                            11,148
epel-source                                   Extra Packages for Enterprise Linux 6 - x86_64 - Source                                        0
extras                                        CentOS-6 - Extras                                                                             15
updates                                       CentOS-6 - Updates                                                                           209
repolist: 17,890