Archive for November, 2010

3 Cant Access mysql Sever

Monday, November 29th, 2010

hi
When I am trying to run plesk , it does not open and and mysql server does not start.
the error i am seeing is :
# service psa start
Starting psa… done
Starting xinetd service… done
Starting named service… done
Starting mysqld service… failed
Starting postgresql service… failed
Starting psa-spamassassin service… done
Plesk: Starting Mail Server… already started
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Starting mail handlers tmpfs storage
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Starting psa… done
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

cahit

Linux:How to configure centralized yum repo server (Centos)

Friday, November 26th, 2010

Local yum repository is used for local network and to make sure that all your server has same rpm for benchmarking and patching purpose.Its also save bandwidth because all the rpm will be store in one server(Central Repo Server) and rest of the servers will install those rpm from local repo server. Hence they don’t have to download from public server.

For Creating Central Repo server, you will need a Apache server .

In our organization I have created Yum server directory under (Its for 64 bit server)
/usr/local/apache/htdocs/install/centos64/
But you can chose any Directory .

    Building the Base Repository:

Step 1 :# Copy all content from CD/DVD to Repository Directory

Copy all the files and directory from Centos 5.5 DVD or CD into /usr/local/apache/htdocs/install/centos64/
So your directory should look like bellow

[root@controlserver1 centos64]# ls
CentOS                 RELEASE-NOTES-de.html     RELEASE-NOTES-nl
EULA                   RELEASE-NOTES-en          RELEASE-NOTES-nl.html
GPL                    RELEASE-NOTES-en.html     RELEASE-NOTES-pt_BR
images                 RELEASE-NOTES-en_US       RELEASE-NOTES-pt_BR.html
isolinux               RELEASE-NOTES-en_US.html  RELEASE-NOTES-ro
kicks                  RELEASE-NOTES-es          RELEASE-NOTES-ro.html
ks.cfg                 RELEASE-NOTES-es.html     repodata
NOTES                  RELEASE-NOTES-fr          RPM-GPG-KEY-beta
RELEASE-NOTES-cs       RELEASE-NOTES-fr.html     RPM-GPG-KEY-CentOS-5
RELEASE-NOTES-cs.html  RELEASE-NOTES-ja          TRANS.TBL
RELEASE-NOTES-de       RELEASE-NOTES-ja.html

As you can see Centos Directory has all the rpm , So I decided to make Centos directory as my Centralized yum directory.

For Centralized yum repository , I need to create rpm headers for base repository , so execute bellow command

Step 2: Create the base repository headers

createrepo /usr/local/apache/htdocs/install/centos64/CentOS

Upper command will create repodata directory under Centos directory
the directory should be like bellow :

[root@controlserver1 CentOS]# cd repodata/
[root@controlserver1 repodata]# pwd
/usr/local/apache/htdocs/install/centos64/CentOS/repodata
[root@controlserver1 repodata]# ls -al
total 14252
drwxr-xr-x 2 root root    4096 Nov 26 15:20 .
drwxr-xr-x 3 root root  221184 Nov 26 15:20 ..
-rw-r--r-- 1 root root 3373682 Nov 26 15:20 filelists.xml.gz
-rw-r--r-- 1 root root 9813890 Nov 26 15:20 other.xml.gz
-rw-r--r-- 1 root root 1144150 Nov 26 15:20 primary.xml.gz
-rw-r--r-- 1 root root     951 Nov 26 15:20 repomd.xml
[root@controlserver1 repodata]#

Building repository for updating yum packages

Step 3: Create a directory call updates

[root@controlserver1 centos64]# pwd
/usr/local/apache/htdocs/install/centos64
[root@controlserver1 centos64]# mkdir updates

So it should be like this

[root@controlserver1 centos64]# pwd
/usr/local/apache/htdocs/install/centos64
[root@controlserver1 centos64]# ls
CentOS                 RELEASE-NOTES-de.html     RELEASE-NOTES-nl
EULA                   RELEASE-NOTES-en          RELEASE-NOTES-nl.html
GPL                    RELEASE-NOTES-en.html     RELEASE-NOTES-pt_BR
images                 RELEASE-NOTES-en_US       RELEASE-NOTES-pt_BR.html
isolinux               RELEASE-NOTES-en_US.html  RELEASE-NOTES-ro
kicks                  RELEASE-NOTES-es          RELEASE-NOTES-ro.html
ks.cfg                 RELEASE-NOTES-es.html     repodata
NOTES                  RELEASE-NOTES-fr          RPM-GPG-KEY-beta
RELEASE-NOTES-cs       RELEASE-NOTES-fr.html     RPM-GPG-KEY-CentOS-5
RELEASE-NOTES-cs.html  RELEASE-NOTES-ja          TRANS.TBL
RELEASE-NOTES-de       RELEASE-NOTES-ja.html     updates

Step 4: Select an rsync mirror to upload
Select any mirror from here:
http://www.centos.org/modules/tinycontent/index.php?id=31

Step 5 : Rsync the updates-released repository

 rsync -avrt rsync://rsync.mirrorservice.org/mirror.centos.org/5.5/updates/x86_64/RPMS/ --exclude=debug/ /usr/local/apache/htdocs/install/centos64/updates/

It will download all the rpms from listed website into my updates directory.

Step 6: Rsync the repodata from

Go into updates directory and download all the contents from repodata.

[root@controlserver1 updates]# pwd
/usr/local/apache/htdocs/install/centos64/updates
[root@controlserver1 updates]#
 
rsync -avrt rsync://rsync.mirrorservice.org/mirror.centos.org/5.5/updates/x86_64/repodata --exclude=debug/ /usr/local/apache/htdocs/install/centos64/updates/

Step 7:Edit yum.conf

Create a repo file under your : /etc/yum.repos.d directory.

[root@mysqlcluster2 yum.repos.d]# pwd
/etc/yum.repos.d
[root@mysqlcluster2 yum.repos.d]# ls
CentOS-Base.repo CentOS-Media.repo local.repo
[root@mysqlcluster2 yum.repos.d]

And disable other repos by inserting enabled=0 , Example :
[centosplus]
name=CentOS-$releasever – Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Insert the bellow lines into local.repo files

[base-local]
name=Centos $releasever - $basearch
failovermethod=priority
baseurl=http://10.0.0.55/centos64/CentOS/
enabled=1
gpgcheck=0
 
[updates-local]
name=Centos $releasever - $basearch - Updates
failovermethod=priority
baseurl=http://10.0.0.55/centos64/updates/
enabled=1
gpgcheck=0

Now try yum command

 yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@mysqlcluster2 /]# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
base-local                                               |  951 B     00:00
base-local/primary                                       | 1.1 MB     00:00
base-local                                                            3186/3186
updates-local                                            | 1.9 kB     00:00
updates-local/primary_db                                 | 1.0 MB     00:00
Setting up Update Process

Centralized Local repository is done!!..

Apapce 2: How to turn off directory listings

Monday, November 22nd, 2010

Directory listings can be a security threat .

By default apache has bellow lines:

 
Options Indexes FollowSymLinks

Delete indexes from that line, so it will be like bellow

 
Options  FollowSymLinks

Now restart apache daemon.

It will stop Apache to show directory listing .

Ticket listing

Sunday, November 21st, 2010

You can view the list tickets on this page.

The frontend ticket listing feature is only available in the premium release. Don't hesitate to order the premium release on http://www.ticket-system.net/order-now/

Ticket submission form

Sunday, November 21st, 2010

You can submit tickets on this page.

The frontend submission form feature is only available in the premium release. Don't hesitate to order the premium release on http://www.ticket-system.net/order-now/

1 Ticket Submission Form

Sunday, November 21st, 2010

You can submit ticket on this page

The frontend submission form feature is only available in the premium release. Don't hesitate to order the premium release on http://www.ticket-system.net/order-now/

Linux:How to install vncserver

Monday, November 15th, 2010

Ref: http://wiki.centos.org/HowTos/VNC-Server

(a)Install vnc-server packages

yum install vnc-server

(b)Create your VNC users

useradd user1

(c)Set your users’ VNC passwords:
Login to each user, and run vncpasswd. This will create a .vnc directory.

vncpasswd

(d)Edit the server configuration
Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

VNCSERVERS="2:root 3:user1"
VNCSERVERARGS[2]="-geometry 640x480"
VNCSERVERARGS[3]="-geometry 640x480"

(e)Create xstartup scripts/ Starting the server

 /sbin/service vncserver start

(g) Edit xstartup
Login each user’s home directory and Edit xstartup file

cd /root/.vnc
 vi xstartup
Uncomment bellow 2 lines 
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc

xstartup file should be like this

#!/bin/sh
( while true ; do xterm ; done ) &
 
# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

(g) Restart vnserver again

service restart vncserver

Linux: lsof command and its uses

Monday, November 1st, 2010

How to view only TCP Established connections

lsof -iTCP | grep ESTABLISHED

How to view traffic on specific port ( port 22)

Syntax is : lsof -i : port number
lsof -i :22  | grep ESTABLISHED

How to view traffic from specific ip address

lsof -i@ip.of.your.user

how to view open files by a individual users

lsof -u username

How to collect information about a process

lsof -p process_id