Somebody asked me to post this information, and I will try to make it as simple as
possible; first of all, we need to start with some very basic commands:
cd: change directory example: cd /usr/bin/folderA
cp: copy a file
ls: remember MSDos "dir" command? is pretty much the same. This command list the
files and folders in the current directory
df: check file system disk space; to see the whole output more clearly, type df -h
man: not sure what a specific linux command does? try "man" followed by the command
you want to go over.
more: when you type more followed by the name of a text file, you'll be able to see
the file’s contents. But is has to be a text file, otherwise you will only get a
bunch of symbols without any logic.
ifconfig: configure ethernet settings, a real life example is: # ifconfig eth0
10.1.1.5 netmask 255.255.255.0 up : this configures a native A class address with a
default mask for a C class (but this is another topic).
Also...to get everything up and runnig you'll need the gateway:
# route add -net default gw 10.1.1.1 and voila!, got Internet!
cat: similar to more but more powerful and with a lot of options and works very nice
with pipes. You can also create a new file from 2 previous ones: cat fileA.txt
fileB.txt > fileC.txt (the new file!!).
large content files? I've seen, specially in log files, how hard is to find a clue
of what is going on, so cat can help if you combine it with grep, lets say that you
want to look for the word "error" in a log file with 1000000000 characters:
cat logfile.txt | grep -i error, in this case the "i" is important when you don't
know if the word is error or ERROR, basically the "i" stands for case-insensitive.
shutdown: when you're done working in the console, turn the computer off with this
command.
NOW SEND MAIL:This is just a guide, in real life you will face many variables, obstacles or
different ways to configure sendmail.
Assuming that you already downloaded the installation file and extracted
everything,and that you have a DNS server ready to use, lets continue with the next
step:
choose a domain name I.E.: domainforme.com
Define a primary name server for your domain, cool if you have 2.
Go to where the folder with the extracted file is:
[root@mymachine src]# ls
sendmail-8.14.3 sendmail.8.14.3.tar.gz
Go to the sendmail-8.14.3 directory and build it:
[root@mymachine sendmail-8.14.3]# sh Build
.
.
.
[root@mymachine sendmail-8.14.3]#
we need now a config.cf file and then move it to /etc/mail, if it doesn't exist,
create it with the mkdir command.
[root@mymachine sendmail-8.14.3]#cd cf/cf
[root@mymachine cf]
Here if you execute the "ls" command will see may files with mc and cf extension,
choose the more appropriate to the OS you are using, usually should be
"generic-linux".
Now:
[root@mymachine cf]#cp generic-linux.mc config.mc
[root@mymachine cf]#sh Build config.cf
Lets generate the sendmail.cf file:
[root@mymachine cf]#sh Build sendmail.cf
Next:
[root@mymachine cf]#cp config.cf /etc/mail/sendmail.cf
Now that you have all the files organized, go back to the sendmail directory:
[root@mymachine sendmail-8.14.3]# sh Build install
How to start the MTA:
[root@mymachine cf]/usr/sbin/sendmail -L sm-mta -bd -q30m
We are using version 8.14.3, so we need to start the Mail Submission Program:
[root@mymachine cf]/usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
Now: SENDMAIL!!
Sending a mail from the command line is easy:
[root@mymachine cf]/usr/sbin/sendmail realuser@realdomain.com, right after this
you'll type your test message, after you finish, press enter, type a dot "." and
press enter again. Voila!
after this, everything should work, Im not including all steps here, this is more a
brief outline, not a "how to" guide.
Anyway, you can check the activity in the server:
[root@mymachine sendmail-8.14.3]#cat /var/log/maillog
you will see something like:
Mar 24 23:21:38 myserver sendmail[4201]: f8KGhi786543: from=, size=302, class=0,
nrcpts=1, msgid=<300205773672.f8kghi12844@itsme.domainforme.com>, proto=ESMTP,
daemon=MTA, relay=mymachine.domainforme.com
Hope this helps!!