Total Pageviews

Sunday, October 3, 2010

Linux Basics

to find a file:

[root@18691 ~]# find / -name 'access.conf'
/etc/security/access.conf

apache httpd
ftp proftpd
dns named
mysql mysql
mail exim

**************************************************************************************************

DNS

port 53

to check if bind is there, +versions
rpm -qa |grep bind

to delete bind
rpm -e --nodeps 'bind version'

to install bind
yum install bind

OR

rpm
http://www.howtoforge.org/bind-installation-on-centos

conf
/etc/named.conf

logfiles
/var/log/messages

nslookup www.***.com
host [IP]--------- (reverse)

history
   1  passwd
    2  rpm -q grep
    3  rpm -q |grep bind
    4  rpm -qa |grep bind
    5  rpm -e --nodeps bind-utils-9.3.4-10.P1.el5_3.3
    6  rpm -e --nodeps bind-9.3.4-10.P1.el5_3.3
    7  rpm -e --nodeps bin-libs-9.3.4-10.P1.el5_3.3
    8  rpm -e --nodeps bind-libs-9.3.4-10.P1.el5_3.3
    9  yum install bind
   10  ps aux |grep named
   11  service named status
   12  rpm -qa bind*
   13  yum install bind-utils-9.2.4-2
   14  yum install bind-utils
   15  cat /etc/resolv.conf
   16  vi /etc/resolv.conf
   17  vi /etc/named.conf
   18  vi /var/named/sujime.com.zone
   19  vi /var/named/2.168.192.rev
   20  vi /etc/named.conf
   21  vi /var/named/2.168.192.rev
   22  vi /etc/named.conf
   23  vi /etc/hosts
   24  nslookup www.sujime.com
   25  dig www.sujime.com
   26  vi /etc/hosts
   27  vi /var/named/sujime.com.zone
   28  nslookup www.sujime.com
   29  service named restart
   30  nslookup www.sujime.com
   31  vi /var/named/sujime.com.zone
   32  service named restart
   33  nslookup www.sujime.com
   34  vi /var/named/2.168.192.rev
   35  service named restart
   36  host 192.168.2.135
   37  history

http://computer.howstuffworks.com/dns5.htm
http://www.howstuffworks.com/web-server.htm
domain name status code: http://whois.domaintools.com/domain-help/status-codes.php

***************************************************************************************************


********
*APACHE*
********

*yum
http://www.thegeekstuff.com/2008/09/how-to-install-or-upgrade-lamp-apache-mysql-and-php-stack-on-linux-using-yum/

log files
/var/log/httpd

config
/etc/httpd/conf/httpd.conf



*source----------->http://dan.drydog.com/apache2php.html
http://httpd.apache.org/download.cgi
-wget link location
/etc/init.d/httpd status-if running stop it
cd /
unzip
tar -xvf
cd apache version
./configure --help
./configure --prefix=/usr/local/apache --enable-module=rewrite --enable-module=so --enable-suexec --suexec-safepath=/usr/local/bin --enable-module=cgi
make
make install
cd /
vim /usr/local/apache/conf/httpd.conf
->server root /usr/local/apache
->user nobody
->group nobody
->directory index index.html
->VirtualHost ip:80
->comment Disable UserDir
{doc root /home/userhttp://www.centos.org/modules/newbb/viewtopic.php?topic_id=24235&forum=38
server name domain.com}
save quit
servive httpd stop
/usr/local/apache/bin/apachectl start
cd document root
vim index.html
/usr/local/apache/bin/apachectl restart
dig abc.com
lynx http://domain.com

log--->/usr/local/apache/logs/error_log
conf-->/usr/local/apache/conf/httpd.conf



*******password protection************

cd /home/<user>/public_html
htpasswd -c .htpasswd <user>
new password:
retype password:
vi /etc/httpd/conf/httpd.conf

<Directory "location of public_html">
  options Follow SymLinks
  Allow Override All
</Directory>

vi /home/<user>/public_html/.htaccess

  AuthUserFile /home/<user>/public_html/.htpasswd
  AuthName "Enter Password"
  AuthType Basic
  require user <username>



****************redirection*******************

vi /etc/httpd/conf/httpd.conf
inside virtual host:
Redirect Permanent / http://www.google.com


******************CGI***************************

<Directory /var/www/cgi-bin>

  Option +ExecCGI

</Directory>

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

********************************************************************************************

FTP
port 21
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=24235&forum=38

conf--> /etc/proftpd.conf
/etc/init.d/proftpd restart
to check connectivity to a particular site
telnet servername 21
to establish ftp connection
FTP nodeipaddress(192.168.2.135)
Name (192.168.2.135:sujatha.s):
passwd:

ftp> put filename
ftp> get filename
ftp> mput *.jpg

to access in browser
ftp://username@IP/
ftp://username:password@IP/


*****************************
to start pure ftp
/etc/init.d/pure-ftpd status

/usr/sbin/pure-config.pl

/etc/pure-ftpd/
*****************************

****************************************************************************************

MAIL

yum install exim

/etc/init.d/exim start

netstat -plan | grep :25

telnet localhost 25    ------------------check whether ESMTP exim or sendmail exim,if sendmail stop it using
/etc/init.d/sendmail stop

vim /etc/exim/exim.conf
->1.domainlist local_domain=@ : localhost : localhost.localdomain: (specify the domain to which u hv to send msgs, eg: www.sujatha.com)
->2.check local_user
        transport=local_delivery
->3. in local_delivery change the file
        file=/home/$local_part/MBOX
->4.local_interfaces= 0.0.0.0

restart exim
useradd username
passwd password

New Terminal::::)
telnet IP 25
helo type a string
mail from:abc@gmail.com
rcpt to:username@domain.com
data (press enter)
type ur msg
.   (put . to end msg)
quit

go back to previous terminal
cd /
cd /home/username
ls
cat MBOX


*******************************************************************************************

DOVECOT

yum install dovecot
vim /etc/dovecot.conf
(we have to change only mail_location)
mail_location=mbox:~mail:INBOX=/home/%u/MBOX

TO START DOVECOT:

/etc/rc.d./init.d/dovecot start
netstat -plan | grep :110

New terminal

telnet IP 110
user username
pass password
list
retr 1(if there is 1 msg in inbox)
quit


********************************************************************************************



SQUIRREL

INSTALL Squirrelmail
yum install squirrelmail
vim /etc/httpd/conf/httpd.conf
(add Alias  /sqmail/ "/usr/share/squirrelmail/")
save n quit
/usr/local/apache/bin/apachectl restart
/usr/local/apache/bin/apachectl stop
/etc/init.d/httpd start
In browser------http://IP/sqmail/

***************************************************************************************************

MYSQL

port 3306

yum install mysql*

OR

http://www.nparikh.org/unix/mysql.php

folder under database name is created under /var/lib/mysql

conf file /etc/my.cnf
error log /var/log/mysqld.log
log file /var/lib/mysql/hostname.err

#mysql
mysql>
mysql>show tables;
mysql>mysqladmin exrend-status

GRANT ALL PRIVILLEGES ON poornam.* TO bob@localhost IDENTIFIED BY 'password'
FLUSH PRIVILLEGES
(commands from slide23)

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html


**********************************************************************************************

PLESK

location of each file: /etc/psa/psa.conf
passwd: /etc/psa/.psa.shadow
root dir: /usr/local/psa
version: /usr/local/psa/version
default plesk scripts: /usr/local/psa/bin

   
home dirsctory
/var/www/vhosts
user home dir
/var/www/vhosts/<domainname>/httpdocs
domain logs
/var/www/vhosts/<domainname>/statistics/logs
domain statistics
/var/www/vhosts/<domainname>/statistics
error pages
/var/www/vhosts/<domainname>/error_docs

backend files

apache domain specific conf files
/var/www/vhosts/<domainname>/conf/httpd.include

named records

/var/named/run-root/etc
db record---> /var/named/run-root/var/<domainname>

mysql
/var/lib/mysql

qmail
/var/qmail

mail folders
/var/qmail/mailnames/<domainnames>/<acct>/Maildir

ftp records
/etc/proftpd.conf


logfiles

location of logfiles: /etc/syslog.conf
psa: /usr/local/psa/admin/logs
ftp: /var/lrpm -e --nodepsog/xferlog
httpd: /etc/httpd/logs
httpd per log: /var/www/vhosts/<domainnames>/statistics/logs
mysql: /var/log/messages
horde: /tmp/horde.log

starting services
httpd- /etc/rc.d/init.d/httpd
ftp,smtp- /etc/rc.d/init.d/xinet.d
pop- /etc/rc.d/init.d/courier-imap
psa- /etc/rc.d/init.d/psa
qmail- /etc/rc.d/init.d/qmail



plesk vs cpanel- slide 26

*************************************************************************************************

7 comments:

  1. ************PHP***************

    php-5.2.14.tar.gz
    http://dan.drydog.com/apache2php.html
    path of php /home/sujy/public_html/phpinfo.php
    put it first in dir index
    /usr/local/apache/logs/error_log
    /usr/local/apache/logs/access_log
    http://192.168.2.135/phpinfo.php

    ReplyDelete
  2. if

    [root@18691 ~]# service httpd restart
    Stopping httpd: [FAILED]
    Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    [FAILED]

    [root@18691 ~]# /etc/init.d/httpd status

    [root@18691 ~]# kill -9 15447

    kill all pids

    ReplyDelete
  3. PHP
    yum install libxml*
    yum install gdbm-devel

    ReplyDelete
  4. forum (wordpress)

    put wordpress in public_html
    write ip instead of localhost in url and wp-config.php

    http://192.168.2.135/wordpress/wp-admin/

    ReplyDelete
  5. php graphy

    wget http://sourceforge.net/projects/phpgraphy/files/phpgraphy/0.9.13b/phpgraphy-0.9.13b.tar.gz

    ReplyDelete
  6. Is Allow url Fopen is disabled for the domain sankar.com ? How can I
    disable it for the domain ?
    php -i | grep php.ini
    php_flag allow_url_fopen off
    /usr/local/cpanel/bin/rebuild-php.conf --current

    ReplyDelete