Linux Server Installation Configuration Manual
Linux Server Installation Configuration Manual
Partition:
boot 100 MB
/ 10 GB
home 10 GB
var 10 GB
swap Double of ram
profile 30 GB
Packages:
Select all servers packages.
Select all development packages.
Kernel source.
Do not select samba's and samba-swat packages.
DNS Configuration:
zone “hitech.com.zone” IN {
type master
file “hitech.com.zone”
allow-update {none;} ;
zone “100.168.192.in-addr.arpa” IN {
type master
file “named.local.hitech”;
allow-update {none;} ;
(1) hitech.com.zone
(2) named.local.hitech
ORIGIN hitech.com
@ 1D IN NS hitech.com
hitech.com. 1D IN A 192.168.100.1
mail IN A 192.168.100.1
hitech.com. IN MX 5 mail.hitech.com
5. vi /var/named/named.local.hitech
Contents of named.local.hitech
$TTL 86400
@ IN SOA hitech.com. root.hitech.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS hitech.com.
2 IN PTR hitech.com.
#vi /etc/resolve.conf
#host -t MX hitech.com
#host mail.hitech.com
#host 192.168.100.1
#host -a hitech.com
Note: If on client side error of dns lookup, then iptables should be off.
If we implement qmail and other packages then we have to change ip in dns file and
others configuration files.
Samba Configuration:
(1) First you have to remove all samba's old rpms if installed.
#rpm -e – nodeps samba
#rpm -e – nodeps samba-common
#rpm -e – nodeps samba-client
#rpm -e – nodeps samba-swat(if installed)
Samba-swat-3.0.0-15
samba-commom-3.0.0-14.3E from cd-2
samba-3.0.0-14.3E from cd-3
samba-client-3.0.0-14.3E from cd-2
If rpm is not found download from net and then followed this procedure.(If source rpm)
[global]
workgroup = HITECHEXPORT
server string = Hi-Tech Export PDC Server
#interfaces = eth0, lo
#bind interfaces only = Yes
obey pam restrictions = Yes
pam password change = Yes
hosts allow = 192.168.100. 127.
printing = cups
log file = /var/log/samba/%m.log
max log size = 0
unix password sync = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*password* %n\n *ReType*new*password* %n\n
*passwd:*all*authentication*tokens*updated*successfully*
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
add machine script = /usr/sbin/useradd -d /dev/null -g samba-clients -s
/bin/false -M %u
local master = Yes
os level = 99
domain master = Yes
preferred master = Yes
domain logons = Yes
logon script = %U.bat
logon path = \\%L\Profiles\%U
dns proxy = No
log level = 1
encrypt passwords = Yes
smb passwd file = /etc/samba/smbpasswd
veto files = /*.mp3/*.MP3/*.mpeg/
If any windows user's can not access other windows pc then fire this command on
pdc server.
#net groupmap modify ntgroup=“Domain Admins” unixgroup=admin
• Common Share
[netlogon]
comment = Network Logon Service
path = /home/samba/netlogon
readonly = No
browsable = No
share modes = No
[Profiles]
comment = User Profiles
path = /Profiles
readonly = No
inherit permissions = Yes
browseable = No
• Data Share
[NewSource]
comment = NewSource
path = /HDrive/Data/NewSource
valid users = @newsource, @admin
read only = No
inherit permissions = Yes
vfs objects = recycle:repository=.recycle
recycle:keeptree = Yes
recycle:exclude = *.tmp
recycle:repository = .recycle/%U
#groupadd samba-clients (If group file is copied directly from pdc server then no use of
this command)
To check users.
# vi /etc/passwd
Note: If smb password file is blank then and then fire this command.
# smbpasswd root
# smbpasswd -a user
Note: To copy SID from pdc to bdc give command net rpc getsid
We should also check this line in pdc smb.conf.
add machine script = /usr/sbin/useradd -d /dev/null -g samba-clients -s /bin/false
-M %u
If any machine does not join domain then you have to create trust manually :
#useradd -g samba-clients -d /dev/null -s /bin/false machinename$
#passwd -l machinename$
#smbpasswd -a -m machinename
If there is a secondary PDC, then (else it would create problem for login of users)
domain logons = NO
If while joinig domain if any error, then its possible that PDC may take 10min. to
broadcast SID.
If any user is not able to login then on PDC – chmod -R 777 /Profiles
You can delete partition of /Profiles , if any error found in it.
Note : Whenever you copy paste to original file of Server, kindly take backup of that
original file first and then copy / paste.
#addgroup surajn
Now find autocad group id in /etc/group and write down. To find autocad group id fire
this command.
Note: In this case xyz user's primary group is abc and secondary group is pqr.
HOME Directory :
If there is no home directory of a user then you can create his home directory :
#mkdir -p /home/sanjeevm
#chown -R sanjeevm /home/sanjeevm
#usermod -d /home/sanjeevm/ sanjeevm
This is useful for Webmail etc...
Note :
When you add new share in samba, then you have to do :
mkdir -p /NewFOlder/.recycle
chmod -R 2777 NewFolder(Sgid set on this Folder to maintain quota)
chmod -R 333 NewFolder/.recycle
chgrp -R groupname NewFolder
Swat
# vi /etc/xinetd.d/swat
disable = no
only from = 192.168.100.0/24
Quota
2. Now create 2 file in /Ddrive. This is quota database file never delete it.
#touch /Ddrive/aquota.user
#touch /Ddirive/aquota.group
3. Now check quota on disk.
#quotacheck -vgum /Ddrive
4. Now to on Quota.
#quotaon /Ddrive
6. To check quota:
# repquota -avg
Sgid:
To set Sgid on folder
#chmod -R 2777 /Path of share folder.
Note: In every share folder we have to set sgid for maintain quota.
Rsync
# vi /etc/xinetd.d/rsync
disable = no
Note :
In rsync script for backup when you take backup of whole folder then you have to
exclude : lost+found(Not necessary).
Fdisk
Using fdisk
#fdisk /dev/hdc
p – print
n – new
asked for extended – e
primary - p
Select e or p
Then give partition number.
First cyclinder press enter
last cyclinder +150000(150 gb)
If not formatting fire this command and then fire above command.
#partprobe
NIS Configuration
If we wants to linux desktop users logins on server we have to configure NIS server. In
oue scenario we do not use NIS server because there are lots of problem on client side
like desktop hang and Pc’s work slow.
# domainname
Note: ypdomain does not exit we have to create this file using above command.
# domainname
To move /etc/passwd file data in nis file type command (or update nis password file)
# /usr/lib/yp/init -m
next host to add – xyz.com
ctl + D
# rpm -qa | grep nfs-utlis
Syslog
Cron tab
# vi /var/spool/cron/root
MAILTO = mail id
You can forward mails coming to root to any other user by creating file in root :
vi .forward and write the mail address e.g. [email protected]
This will work only for sendmail and not for qmail or other.
For Qmail you will have to create the file as under (if it does not exists):
#vi /var/qmail/alias/.qmail-root
& then #echo emailid > /var/qmail/alias/.qmail-root
SSH Server
To login one server to another server without password we have to configure this server. We
are using this server for taking backup of data through rsync.
On Pdc server
# ssh-keygen -t dsa
Usermin
Password change procedure: with the help of usermin we can change password
samba,system and send mail.
Install webmin
Select usermin option.
Now click on install tab.
After installation of usermin rpm select module restriction.
Then adduser restriction
Then select all user.
Click on change password tab.
Apache
# vi /etc/httpd/conf/httpd.conf
uncomment this line:
NameVirtualHost server ip
Grub
File: etc/grub.conf
How to generate boot loader password after installation.
# grub-md5-crypt
# grub-install /dev/hdc
Lilo
# vi /etc/lilo.conf
Content of lilo.conf
prompt
timeout=50
default=Jay
boot=/dev/hdc
map=/boot/map
install=/boot/boot.b
restricted
password=redhat4299
message=/boot/message
linear
image=/boot/vmlinuz-2.4.20-8
label=Jay
initrd=/boot/initrd-2.4.20-8.img
read-only
append="root=LABEL=/"
Note: if we change lable then we must change default. Both lable and default are same.
Send Mail
Sendmail -8.12.8-4
sendmail-cf 8.12.8-4
we cant change directly in sendmail.cf file, so change in send mail macro file which is
sendmail.mc
define(`SMART_HOST',`mail.reliadat.com')
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
Note : Addr=0.0.0.0 – For External
FEATURE(`accept_unresolvable_domains')dnl (if this feature is enable we can send &
receive mail from any network)
LOCAL_DOMAIN (`mail.reliadat.com')dnl
# vi /etc/mail/access
192.168.100.0/24 Relay(In place of relay it canbe REJECT OR DROP )
Comment all lines and add : 127.0.0.1 RELAY
GNFC 3rd :
Squirrelmail
# cd /usr/share/squirrelmail/config/
# vi /etc/httpd/conf/httpd.conf
Note : give path Squirrelmail index.php (/usr/share/squirrelmail/index.php)
Content of httpd.conf
#</VirtualHost>
<VirtualHost 192.168.100.10>
ServerAdmin [email protected]
DocumentRoot /usr/share/squirrelmail/
ServerName reliadat.com
ErrorLog /var/log/mail.reliadat.com
# CustomLog logs/dummy-host.example.com-access_log common
Note : You have to change “disable = no” in /etc/xinetd.d/imap & /etc/xinetd.d/imaps &
Restart xinetd service.
IPTAbles service should be off in all runlevels.
Squid
Counfiguration:
Cache rebuild
#/usr/sbin/squid -f /etc/squid/squid.conf -z
Note:
#chmod 744 /etc/squid/squid_pass
#chmod 744 /etc/squid/squid.conf
#chown squid /etc/squid/squidpass
#chown squid /etc/squid/squid.conf
Introduction: This tool is used for block website by url and blocking website by user wise.
ex. If we wants to only directors and PM’s can surf gmail.com and others are not allowed to
surf gmail.com.
#vi /etc/squid/squidgaurd.conf
Note : We are remove key words like sex and Music from Gnfc6th proxy
server(Squid.conf) due to request of Anilthoria and vijaybhai.
Removed below sites from squidguard due to Hitesh Patel.
www.altavista.com
www.metacrawler.com
www.excite.com
Hotmail.com
Yahoo.com
Gmail.com
Rediff.com
Rediffmail.com
Indiatimes.com
Below modules that’s are same configured in Proxy and BDC Server.
1. Squid
2. Squidguard
3. Iptables rules and tcp wrappers
4. Squid report.
Gnfc 6
PDC = 192.168.100.2 - eth0
BDC = 192.168.100.3 - eth0
SMB WGRP = Hitechexport
DNS = hitech.com
Proxy = Icenet - 203.88.147.195 - eth2
Gilp - 203.77.194.67 – eth1
Local – 192.168.100.7 - eth0
Reliadat
PDC = 192.168.2.3 - eth0
BDC = 192.168.2.2 - eth0
SMB WGRP = Reliadat
DNS = reliadat.com
1.Server Configuration
Gnfc6 Server Configuration:
Pdc Bdc
Motherboard Intel865 gvsr Intel845 gvsr
CPU P4-3.0ghz P4-2.6ghz
Ram 1 Gb 1 Gb
HDD 1.Seagate 120gb 1.Seagate 120gb
2.Seagate 120gb 2.Seagate 120gb
To install a lan card of ASUS motherboard we have to compile kernel source code.
#cd DriverInstall
#./install.sh
# cd /usr/src
# make xconfig
Select the options you want to compile into the new kernel.
Select "Exit".
After booting the Linux kernel and compiling the driver as a loadable
kernel module (LKM), the driver needs to be loaded.
IPTables
Introduction:
With the help of iptables we can do block port, anonymous request, port
forwarding, routing and filtering.
Counfiguration:
There is a file /etc/rc.d/rc.local in which when the system starts, the line added in
/etc/rc.d/rc.local- will get executed. The line is : /root/icenet.sh
gipl.sh
ifdown eth0
ifdown eth1
ifdown eth2
ifup eth1
ifup eth0
/etc/rc.d/rc.gipl
icenet.sh
ifdown eth0
ifdown eth1
ifdown eth2
ifup eth1
ifupeth2
/etc/rc.d/rc.icenet
#!/bin/sh
#IPTABLES=/sbin/iptables
iptables -F -t nat
#####DMZ#############
#####Addison Pc######
iptables -I PREROUTING -t nat -d 203.77.194.104 -j DNAT --to-destination 192.168.100.41
iptables -I POSTROUTING -t nat -s 192.168.100.41 -j SNAT --to-source 203.77.194.104
###Comp 5############
iptables -I PREROUTING -t nat -d 203.77.194.101 -j DNAT --to-destination
192.168.100.35
iptables -I POSTROUTING -t nat -s 192.168.100.35 -j SNAT --to-source 203.77.194.101
###Comp 7############
iptables -I PREROUTING -t nat -d 203.77.194.102 -j DNAT --to-destination
192.168.100.37
iptables -I POSTROUTING -t nat -s 192.168.100.37 -j SNAT --to-source 203.77.194.102
###Comp 8############
iptables -I PREROUTING -t nat -d 203.77.194.103 -j DNAT --to-destination
192.168.100.38
iptables -I POSTROUTING -t nat -s 192.168.100.38 -j SNAT --to-source 203.77.194.103
iptables -I PREROUTING -t nat -s 192.168.100.0/24 -j ACCEPT
###################################
#########Ip Routing#########################
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0 gw 192.168.100.1
############################################
iptables -F -t filter
#port 135 DCE Endpoint Resolution
iptables -I INPUT -p tcp --sport 135 -j DROP
iptables -I INPUT -p udp --sport 135 -j DROP
iptables -I INPUT -p tcp --dport 135 -j DROP
iptables -I INPUT -p udp --dport 135 -j DROP
iptables -F -t mangle
iptables -t mangle -I PREROUTING -p tcp ! --syn -m state --state NEW -j DROP
iptables -t mangle -I PREROUTING -m state --state INVALID -j DROP
iptables -t mangle -I PREROUTING -m unclean -j DROP
Note: Last two lines of above file for,we don’t have to need change dns in resolve.conf
manually. It will take dns automatically when this script is run.
Ip Routing line is user for define static route on eth0.
FIREWALL
iptables -I INPUT -p tcp -s (IP of the machine which wants to access our machine) -i
(Ethernet of our machine) -j ACCEPT
For e.g.
#Iptables -I INPUT -p tcp -s 203.77.194.67 -i eth0 -j ACCEPT
To Flush rules.
#iptables -F -t filter
#iptables -F -t nat
#iptables -F -t mangle
To List rules :
#iptables -L -t nat
#iptables -L -t filter
#iptables -L -t mangle
To block ports
#iptables -I PREROUTING -p tcp –dport 136 -j DROP
This above can repeat for other ports also
Note: Above rule has should to be apply before our nating / squid / port
filtering rules.
We have to create alias of realip card with alloting new realip.
(i.e eth0 – Icenet IP , then eth0:1 – New Icenet IP)
To Define IP Route:
#route add -net 192.168.0.0 netmask 255.255.255.0 eth0 gw 192.168.100.1
Note:
This is only for Cisco 1751. If any request come from 192.168.0.0 network then
proxy use 192.168.100.1 gateway, not use xincom. This is special for NLDC line.
New Firewall
TCPWrapper :
This is another tool for increase security but it is not more power full then
Iptables. Tcpwrapper is used for block particular daemon/port/services.
In our scenario we block ssh service through tcp wrapper. Only selected ip’s are allowed to
connect our server using ssh service.
All this security like Tcpwrapper and Iptables are set in proxy server.
For Vastrapur
#vi /etc/hosts.allow :
sshd : 192.168.100.
sshd : 203.77.194.67
sshd : 203.77.194.93
sshd : 203.88.141.19
sshd : 203.88.141.18
#vi /etc/hosts.deny :
ALL:ALL EXCEPT 127.0.0.1 192.168.100.
#vi /etc/hosts.allow :
sshd: 192.168.100. 203.77.194.21 203.88.147.194
#vi /etc/hosts.deny :
ALL:ALL EXCEPT 127.0.0.1 192.168.100.
#vi /etc/hosts.allow :
sshd : 192.168.2.
sshd : 203.77.194.67
sshd : 203.77.194.93
sshd : 203.77.194.66
sshd : 203.77.194.94
sshd : 203.88.140.234
#vi /etc/hosts.deny :
ALL:ALL EXCEPT 127.0.0.1 192.168.100.
GNFC6:
GNFC 3rd
Note :
Fstab File:
In /etc/fstab the last column should be 0 0 and not 1 2
Tmp watch:
Tmpwatch checks access time of the files and it will remove the file as per the parameters.
As for e.g.
#/usr/sbin/tmpwatch –atime -v 48 /NewEDrive/Anil/.recycle
And do make an entry for the same in crontab's file as well by creating shell script for the
above. Give chmod 777 recycle.sh
Log rotate
daily
weekly
monthly
yearly
Note :
In our case logs rotate = Weekly
To check the logs : /var/log/secure
USB Device
This is a third party rpm which you can download and install :
#tar -zxvf chnangepasswd*.*
#cd chnangepasswd*.*
#./configure --enable-cgidir=/var/www/cgi-bin --enable-language=Portuguese
--enable-smbpasswd=/usr/local/samba/private/smbpasswd
--enable-squidpasswd=/etc/squid/passwd –enable-logo=opentech.jpg
Entry in httpd.conf:
<VirtualHost 192.168.100.2>
ServerAdmin [email protected]
DocumentRoot /var/www/webs/
ServerName reliadat.com
ErrorLog /var/log/mail.reliadat.com
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
Note:
DocumentRoot /var/www/webs/: This folder consists of file index.html where you can
put the path of Changepassword i.e. /var/www/cgi-bin/changepassword.cgi
Pwd will be changed of all at a time by help of “Change Password RPM” if we have:
Samba
System
Squid
Sendmail
Pwd will not be changed of all at a time by help of “Change Password RPM” if we have
but only Qmail will not be done:
Samba
System
Squid
Qmail
BACKUP KERNEL
IPTRAF:
#This is used for monitoring Protocols / Ports.
Troubleshooting:
Nmap
Netstat
Tcpdump
Nessus
portsentry
rootkit
snort
whisker
nikto
Swatch
#lsmod
#dmesg
Squid:
When pings get reply but we are not able to surfing kindly check gateway using command:
#netstat -ar
Add & remove Gateway:
#route add default gw 192.168.100.7
#route del default gw 192.168.100.7
To view cache.log:
#route -C
#tail -f /var/squid/cache.log
#tail -f /var/squid/access.log
SARG: Squid Analysis Report Generator is a tool that allows you to view "where" your users
are going to on the Internet.
Installation Notes:
/boot 100MB
/home 10GB
/Var 10GB
/ 10GB
Swap 4GB
/Profiles 30GB
/DDrive 78GB
/EDrive 57GB
/FDrive 78GB
/Gdrive 57GB
1. Ddrive
Addison
Champak
DTP
Heart
Sanjeev
2. EDrive
BhaskarHome
HMHome
KetanHome
NDHome
Vijay
BinojHome
HR
KPHome
PBHome
VijayHome
HeratHome
ItMatch
ManishHome
TapanHome
3. Fdrive
Auction
Eoffice
Finance
GAD
Shared
Software
Technical
4. Gdrive
Accounts
CAD
Marketing
5. HDrive
NewSource
1. Ddrive
Addison 05GB
Champak 25GB
DTP 10GB
Heart 25GB
Sanjeev 10GB
2. EDrive
BhaskarHome 01GB
HMHome 02GB
KetanHome 01GB
NDHome 01GB
Vijay 25GB
BinojHome 01GB
HR 05GB
KPHome 01GB
PBHome 02GB
VijayHome 01GB
HeratHome 01GB
ItMatch 05GB
ManishHome 01GB
TapanHome01GB
3. Fdrive
Auction 02GB
Eoffice 03GB
Finance 05GB
GAD 05GB
Shared 20GB
Software 10GB
Technical 10GB
4. Gdrive
Accounts 10GB
CAD 25GB
Marketing 10GB
5. HDrive
NewSource (-)
No. of Hard-Disk.
1. 40GB IDE
Device = /dev/hda
/boot = 100MB.
/ = 10GB.
/Var = 05GB.
/home= 10GB.
Swap = 04GB
2. 120GB IDE
Device = /dev/hdb
/DDrive = 78GB
/Profiles = 30GB
3. 120GB IDE
Device = /dev/hdc
/EDrive = 60GB
/GDrive = 51GB
4. 120GB IDE
Device = /dev/hdd
/Fdrive = 78GB
/Hdrive = 33GB
Share Details of each Drive on BDC Server.
1. Ddrive
Addison
Champak
DTP
Heart
Sanjeev
2. EDrive
BhaskarHome
HMHome
KetanHome
NDHome
Vijay
BinojHome
HR
KPHome
PBHome
VijayHome
HeratHome
ItMatch
ManishHome
TapanHome
3. Fdrive
Auction
Eoffice
Finance
GAD
Shared
Software
Technical
4. Gdrive
Accounts
CAD
Marketing
5. HDrive
NewSource