Sunday 20 May 2018

SendMail & Dovecot Configuration ...!!!!!!!!


Sendmail configuration----

Install these packages for sendmail

#yum install sendmail sendmail-cf dovecot -y
(# vim  “/etc/mail/sendmail.mc”
(comment the DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA'dnl))

#useradd usernamme
#passwd usernamme 
(create and set the smtp user's)
#vim /etc/mail/virtusertable
(usernamme@domainname      usernamme.domainname)
(@domainname               usernamme.domainname)

#/etc/mail/local-host-names    (domain name entry)
#/etc/mail/sendmail.mc
 (Add the three line )
     FEATURE(masquerade_envelope)
FEATURE(genericstable, `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN_FILE(`/etc/mail/sendmail.gdf')

(Create these file and entry like that)

# /etc/mail/genericstable
(usernamme.domainname         usernamme@domainname)

(Create these file and entry the domainname)

#/etc/mail/sendmail.gdf 

#cd /etc/mail
#m4 /etc/mail/sendmail.mc /etc/mail/sendmail.cf
#make all

DoveCot Entry For sendmail

# yum install dovecot

vim /etc/dovecot/dovecot.conf

auth_mechanisms = plain login
mail_location = mbox:~/mail:INBOX=/var/mail/%u

vim /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no   -  (Uncommitted this line and provide "yes")
auth_mechanisms = plain login
User Permission for mail sending and receving in Sendmail mail server

cd /home/username.domain/
mkdir mail
cd mail
mkdir .imap
cd .imap
mkdir INBOX
chown -R username.domain:username.domain /home/username.domain/mail/
chmod -R 700 /home/username.domain/





Saturday 19 May 2018

MySQL Database & Basic Commands


Install MySQL Packege : -
yum install httpd mysql mysql-server -y

mysqlcheck -u root -p --check --optimize --all-databases

service mysqld start

chkconfig mysqld on
mysql_secure_installation
Enter current password for root (enter for none): press enter
give password
yes
yes
yes

Access Database : --

mysql -u root -p
mysql -u root -p

show databases;
create database name;
use name;
\q

/etc/init.d/mysqld restart

service mysqld restart
chkconfig mysqld on

Database Backup :-

mysqldump -uroot -ps23S32EG&^ bestgladiator > mysql.sql

Database Restore
mysql -u root -pJHYfgrXWL nelsonm < nelsonm.sql


top -u mysql
    
use databasename;
select * from email_lists;

MYSQL Update Query




Mysql Tuning :
Put following lines in /etc/my.cnf after user=mysql no spaces & blank lines

     innodb_log_file_size = 32M
     innodb_buffer_pool_size = 2048M
     innodb_log_buffer_size = 4M
     innodb_flush_log_at_trx_commit=2
     basinnodb_thread_concurrency=8

service mysqld restart


if get login issue in interspire after this

cd /var/lib/mysql
mv ib_logfile0  1ib_logfile0
mv ib_logfile1 1ib_logfile1

/etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
innodb_log_file_size = 64M
innodb_buffer_pool_size =1024M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit=2
innodb_thread_concurrency=8

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


#############  motofox is new..... greenatonn is old  ###############

select * from email_lists;

select * efrom email_lists limit 5;

UPDATE `email_lists` SET  `bounceemail` = 'bounce@wallstrilty.org';
UPDATE `email_lists` SET  `ownername` = 'info';



UPDATE `email_lists` SET  `bounceusername` = 'bounce.mindgolerme.com';

UPDATE `email_lists` SET `replytoemail` = 'info@mindgolerme.com' WHERE `replytoemail` = 'info@avanilograna.com';

UPDATE `email_lists` SET `bounceemail` = 'bounce@mindgolerme.com' WHERE `bounceemail` = 'bounce@avanilograna.com';

UPDATE `email_lists` SET `owneremail` = 'info@mindgolerme.com' WHERE `owneremail` = 'info@avanilograna.com';


---------- -------------------------------------
after login
SELECT emailaddress INTO OUTFILE 'getcopbhupendra.csv' FROM email_banned_emails;

direct from termital

mysql -uroot -pEdNzRT -e "show databases;"

mysql -uroot -pEdNzRT nopenjohn -e "show tables;" | grep banned
    
mysql -uroot -pEdNzRT nopenjohn -e "select emailaddress from email_banned_emails;" > supression.csv

mysql -uroot -pPasswd "DBname" -e "select emailaddress from email_list_subscribers where listid=10;" > listname.csv

Delete Email lists #######################3
use database;
DELETE FROM `email_list_subscribers` WHERE `listid` = 19;
DELETE FROM `email_lists` WHERE `listid` = 19;


export contact list

mysql -uroot -pedfgtGolF corwine_mnm -e "select emailaddress from email_list_subscribers where listid=10;" > US_TOTAL.csv

#####################################  garuda MTA add issue #########################################
use database;
ALTER TABLE `mta_group` CHANGE `mta` `mta` LONGTEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;

#########################################33
10.10.10.30 mysql hosted server
10.10.10.10 client machine

Step 1. Create a user which is admin of a database

mysql -p
> CREATE USER 'user'@'127.0.0.1' IDENTIFIED BY 'password';
> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
> GRANT ALL PRIVILAGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION ;
> GRANT ALL PRIVILAGES ON *.* TO 'user'@'127.0.0.1' WITH GRANT OPTION ;
> FLUSH PRIVILAGES;
> FLUSH HOSTS;
> select Host,User from mysql.user;
> quit

# mysql -u user –p password


Step 2. Create a user which is admin of a database

mysql -p
> CREATE USER 'user2'@'10.10.10.10' IDENTIFIED BY 'password';
> GRANT ALL PRIVILAGES ON *.* TO 'user2'@'10.10.10.10' WITH GRANT OPTION ;
> FLUSH PRIVILAGES;
> FLUSH HOSTS;
> select Host,User from mysql.user;
> quit

# mysql -u user -ppassword

vi /etc/my.cnf
write below symblic link
bind-adress=10.10.10.30

Define Port In Selinux :-

vi /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW,STABLISHED -m tcp --dport 3306 -j ACCEPT
service iptables restart

service mysqld restart

From client

#mysql -u user2 -h 10.10.10.30 -p


Change Password of Database

Changepass
mysql -uroot -pfkiasHDY
vim /etc/my.cnf
cd /var/lib/mysql/
mv ib_logfile0 1ib_logfile0
mv ib_logfile1 1ib_logfile1
service mysqld restart
mysql -uroot -pfkiasHDY
exit
cd /var/www/salihundam/admin/import/
ls

#######  CHECK DATABASE SIZE #############
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;

vim /etc/ssh/sshd_config
service sshd restart


Backup and restore all database 

#backup all databases in one file (eventually add the option --add-locks):
mysqldump -uroot -p -–all-databases > file.sql

#backup all databases in one gzipped file:
mysqldump -u username -p -–all-databases | gzip > file.sql.gz

#restore all databases:
mysql -u username -p < file.sql


Sunday 4 February 2018

How To Configure Postfix Mail server In Centos on Localhost...




How to Install Postfix Mail server :-


Install Postfix packages :

Before Installing check Port Number (POP3 Imap) 
Telnet service:
Hostname:
Ip range:

Then start :  # yum install postfix -y
# vi /etc/postfix/main.cf
## Line no 75 - Uncomment and set your mail server FQDN ##
myhostname = server.unixmen.local

## Line 83 - Uncomment and Set domain name ##
mydomain = unixmen.local

## Line 99 - Uncomment ##
myorigin = $mydomain

## Line 116 - Set ipv4 ##
inet_interfaces = all

## Line 119 - Change to all ##
inet_protocols = all

## Line 164 - Comment ##

#mydestination = $myhostname, localhost.$mydomain, localhost,

## Line 165 - Uncomment ##\
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

## Line 264 - Uncomment and add IP range ##
mynetworks = 192.168.1.0/24, 127.0.0.0/8

## Line 419 - Uncomment ##
home_mailbox = Maildir/

# service postfix restart
# chkconfig postfix on

# useradd sk
# passwd sk

# telnet localhost smtp

rying ::1...
Connected to localhost.
Escape character is '^]'.
220 server.unixmen.local ESMTP Postfix
 ## type this command ##
ehlo localhost
250-server.unixmen.loca
l250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
 ## Type this - mail sender address##
mail from:<sk> 
250 2.1.0 Ok
## Type this - mail receiver address ##
rcpt to:<sk>   
250 2.1.5 Ok

## Type this to input email message ##

data   
354 End data with <CR><LF>.<CR><LF>
## Enter the boddy of the email ##.

welcome to unixmen mail server   

     ## type dot (.) to complete message ##
250 2.0.0 Ok: queued as B822221522
quit     ## type this to quit from mail ##
221 2.0.0 Bye
Connection closed by foreign host.

check mail
# ls /home/sk/Maildir/new/

read mail
cat /home/sk/Maildir/new/1390215275.Vfd00Ie04f8M357080.server.unixmen.local

Dovecot for Postfix Mail server :-

# yum install dovecot

# vi /etc/dovecot/dovecot.conf
## Line 20 - umcomment ##
protocols = imap pop3 lmtp

# vi /etc/dovecot/conf.d/10-mail.conf
## Line 24 - uncomment ##

mail_location = maildir:~/Maildir


# vi /etc/dovecot/conf.d/10-auth.conf
## line 9 - uncomment##
disable_plaintext_auth = yes

## Line 97 - Add a letter "login" ##
auth_mechanisms = plain login
# vi /etc/dovecot/conf.d/10-master.conf
## Line 83, 84 - Uncomment and add "postfix"
   mode = 0600
   user = postfix
   group = postfix
# service dovecot start
# chkconfig dovecot on

# telnet localhost pop3

Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user sk     ## log in as user sk ##
+OK
pass centos     ## input user password ##
+OK Logged in.
retr 1
+OK 439 octets
Return-Path: <sk@unixmen.local>
X-Original-To: sk
Delivered-To: sk@unixmen.local
Received: from localhost (localhost [IPv6:::1])
    by server.unixmen.local (Postfix) with ESMTP id B822221522
    for <sk>; Mon, 20 Jan 2014 16:23:54 +0530 (IST)
Message-Id: <20140120105404.B822221522@server.unixmen.local>
Date: Mon, 20 Jan 2014 16:23:54 +0530 (IST)
From: sk@unixmen.local
To: undisclosed-recipients:;

welcome to unixmen mail server
.
quit
+OK Logging out.
Connection closed by foreign host.


Squirrel Mail for Postfix Mail server :-

first add this in 6.xxx
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install squirrelmail -y
cd /usr/share/squirrelmail/config/
./conf.pl



(incase mails are not sending then use this command)
# setsebool -P httpd_can_sendmail 1

I hope you Will be like this :

if you like it then kindly Comment and please share my Blog :

Thursday 2 April 2015

installing linux redhat 6


Overview Of RHEL 7

Linux file System .........Information

:- The Interpreter that executes commands typed as strings
   Ans : Shell

:- The visual cue that indicates an interactive shell is waiting for the user to type a command.
 Ans: Prompt

:- The name of the program to run.
  Ans: Command.

:-  The part of the command line that adjusts the behavior of a command.
 Ans: Option.

:- The part of the command line that specifies the target that the command should on.
 Ans : Argument

:- The hardware display and keyboard used to interact with a system.
 Ans : physical console.

:- One of the multiple logical consoles that can each support an independent login session.
 Ans:Virtual console.

:- An interface that provides a display for output and a keyboard for input to shell session.
 Ans : Terminal.

:-Jump to the beginning of the previous word on the command line.
 Ans:Ctr+left Arrow

:- Separate commands on the same line..
 Ans:  ;

:- Clear form the cursor to the end of the command line
Ans : Ctrl+K.

:- Re-execute a recent command by matching the command name.
 Ans : !string.

:- Shortcut used to complete commands files name and opetions.
 Ans : Tab.

:- Re-execute a specific command in the history list.
 Ans : !number.

:- Jump to the beginning of the commands line.
 Ans : ctrl+a.

:- Display the list of the previous commands.
 Ans : history.

:- Copy the last argument of  previous commands.
 Ans : ESC+.

:- This directory contains static , persistent system configuration data.
 Ans : /etc

:- This is the system's root directory .
 Ans :  /

:- User home directories are located under this directory.
 Ans : /home

:-This is the root account's directory.
 Ans : /root

:- This directory contains dynamic configuration data ,such as FTP and Websites.
: Ans : /var

:- Regular user commands and utilities are located here,
Ans : /usr/bin

:- System administration binaries ,for root use are here.
Ans : /usr/bin

:-Temporary files are stored here.
Ans : /tmp

:- Contains dynamic , non-persistent application run-time data.
Ans : /run

:- Contains installed software programs and libraries .
Ans : /usr

:-List the current user's home directory home directory in simplest syntax , when it is not the current location.
Ans : ls -|~

 :- Return to the current user's home directory
Ans : cd

 : - Determine the absolute path of the current location .
Ans : pwd

:-Return to the most previous working directory working directory.
Ans : cd -

:- Move up two levels from the current location.
Ans : cd../..

:- List the current location with hidden files.
 Ans : ls -a

:- Move to the binaries location from any current location.
Ans : cd /bin

:-Move up to the parent of the current location.
Ans : cd ..

:- Move to the binaries location ,from the root directory .
Ans: cd bin

:- only file names beginning with "b".
Ans:b*

:-Only file name ending in "b"
Ans:*b

:-only file names where first character is not "b".
Ans:*b*

:- Only file names at least 3 character in length.
Ans:???*

:-only files name that contain a number .
Ans:*[[:digit:]]*

:-only file names that begin with an upper-case letter.
Ans:[[:upper:]]*


:-Send commands outputs to file ; errore  to different file.
Ans : >file 2>file2


:-Display command output to terminal ,ignore all errors.
Ans :2>dev/null


:-Send output and error to the same new empty file.
Ans :&>file


:-Send output and error to the same file,but preserve exiting file content.
Ans :>>file 2>&1


:-Run command.but throw away all possible terminal displays.
Ans :&>/dev?null


:-Send command output to both the screen and a file at the same time.
Ans : | tee file


: -Run commands send output in a file discard error messages.
 Ans : >file 2 > /dev/null: -

:- A number that identifies the user at the most fundamental level.
 Ans : UID

:- The program that provides the user's command line prompt.
Ans ; login Shell

:- Location of the local group information.
Answer ; /etc/group

:-Location of the user's personal files.
Answer : home directory

:-A number that identifies that group at the most fundamental level.
Answer : GID

:-Location of local user account information.
Answer :/etc/passwd

:-The  fourth field of /etc/passwd.
Answer : Primary group .

:-Process has been stopped.
Answer: T

:-Process has released all its resources except.
Answer: Z

:-Process is running or warning to run on a CPU.
Answer: R

:- Process is sleeping until some conditions is met.
Answer: S

:-Process is waiting for I/O or some condition to be met and must not respond to signals.
Answer : D

:-
Answer

Saturday 15 November 2014

Partitions ...


Partitions: Planning Your Linux Installation

This article will explain some of the terms involved with partitioning your hard drive, as well as some concepts you will need to understand before installing Linux, and will help you determine what partitions you need to create for Linux.

What is a partition?

Imagine your company is moving into a new building that is set up like a warehouse. There are no internal walls, it’s just one big room for everybody to work in. Chances are, the first thing the boss is going to do is build himself an office (he wouldn’t want to associate with you workers), so he’ll have a partition set up, an internal wall to separate him from you. Next, each worker will get a cubicle in the big room with smaller partitions to separate you from the person next to you.
Hard drives work the same way. The disk gets partitioned into smaller, separate pieces which can belong to different owners. In our case, Windows might own some and Linux will own others. On hard drives though, the word “partition” does not refer to the wall itself, it refers to the separated space. So we say Linux is installed “on” the first partition.

What is a file system?

Ever go looking for a book in the library? In order to find what you’re looking for, you must understand the library’s file system, or method of organization. Fiction books are easy, they use a simple type of file system commonly known as alphabetical by author. Nonfiction books can be tougher because they use a different type of file system, the Dewey Decimal System. What if you don’t understand the Dewey Decimal System? What if you only know the title of a book and you don’t know whether it’s fiction or non-fiction? How can we find our book now? Luckily there is a librarian to help us, and she has created a card catalog (or in most libraries now, a computerized catalog) listing all the books available and where to find them.
Now, picture your hard drive as the library. Like the library, your hard drive can have different file systems. The operating system is your librarian, who has provided the directory tree (sometimes also referred to as “the file system”, with a slightly different meaning) as a catalog of the files available.
Unfortunately, the world of computers is not as standardized as our libraries. In computers, every librarian or operating system has its own type of file system, and other operating systems often don’t know how to read it. Lucky for us, Linux is a versatile operating system and it does understand the file system used by Windows 95 and Windows 98, as well as many others.

Planning your partitions

Each distribution’s installation guide contains (or should contain) a section on partitioning your hard drive. I have noticed, however, that the manuals often include far more detail than is necessary in a typical desktop installation, and can be confusing to new users.
Personally, I favor the KISS principle (Keep It Simple, Stupid), especially for beginners. If you are installing a server that will serve multiple user’s simultaneously and provide myriad services, you will want to read these manual sections as well as the Partition Mini-HOWTO, an excellent document detailing the reasons one might want to create the seven or more partitions sometimes recommended in these primers.
For a single-user desktop system, you can ignore just about all of that. Desktop systems for personal use don’t have most of the complications that require so many partitions. For a healthy Linux installation, I recommend three partitions: swap, root, and home.

Swap

You need one partition that will be used as Linux swap space. This is space on your hard drive that can be used as virtual memory. Virtual memory allows your computer to run large programs and perform complex tasks even if it does not have enough physical RAM to do the job. (It is a lot slower, but it works.)
The amount of swap space required is a matter of religious argument among geeks and hackers, and entire volumes could be written about the subject. To keep it simple, create one swap partition that is 50% to 100% the size of the physical RAM in your system. If you are short on RAM with plenty of drive space, go large. If you’re short on drive space and have lots of RAM, go small.

root (/)

The root file system is represented by a forward slash (/). It is the top of the directory tree, and contains Linux and everything that you install with Linux. (See The Linux (Virtual) File System for details). This is roughly equivalent to your “C:” drive under DOS or Windows. You must create a partition for the root directory. (Don’t confuse this with the “root” user account, who is the administrator of the system. That’s a different kind of root!)
The size of your root partition will vary depending on what you install or plan to install. Check your distribution’s documentation, and reserve enough space for a maximum installation, plus at least 100MB more for temporary space and installation of new software. If you plan to download and try out lots of software, leave more space. If you have a small hard drive, you can trim back on your installed packages to save space.
In general, you should be fine with a root partition between 2GB and 8GB.

/home

The third and final partition you should create will hold your /home directory. This is the place where all the user-specific files, your data in other words, are stored. It is roughly equivalent to the “My Documents” folder on a MS Windows desktop (if you have MS Office installed). On a multi-user system, each user will have her own directory under /home.
Strictly speaking, it is not necessary to create a separate partition for /home. If you do not, it will reside on the root partition like everything else. If you are cramped for space, you may need to configure your machine this way.
The reason I recommend creating a separate partition is that you are a new user. You are going to want to play with things, experiment, push the limits of your system. Before long, you will break something so badly that you will need to reinstall, or you’ll just want to reinstall with different options, or try a different Linux distribution. Having /home on a separate partition makes it very easy to wipe out and reinstall Linux without losing any of your data.
Don’t think to yourself, “I’ll be careful, I won’t need to reinstall.” Wrong. You will definitely hose up your system at least once, and for the novice, reinstalling is often the easiest way to fix it. I had ten years of computer experience and worked in technical support when I started with Linux, so I knew my way around a PC, and I had to reinstall twice. Just plan on it and make it easy on yourself. Keep your data on a separate /home partition, or keep it backed up on some other medium, and be sure to create the boot floppies when prompted to do so during the installation process. They have saved my system more than once.
And don’t get the wrong impression here. This reinstall problem is only because you are a new user, still learning. Six months from now your system will be purring like a nursing kitten, and you’ll go weeks or months without rebooting, let alone reinstalling.

About Me

Hi..

Just before one month me and my friend Keshav kashyap joined LITC(Linux international training Center) Institute Indore for learning Linux Redhat.
and also for clearing my RHCE Exam. that time We got so many Study martial for exam from Mr.Siv Sir and throw the internet
with the help of notes we created this blog for all the RHCE students.
if any body like this so please share this link.

Thank You
Chandan Pawar