Friday, January 22, 2010

Find out who is using your port

Many a times I forget this command. I have no Idea why.
So here it is, to your rescue the mighty lsof command

Just type this and you will have all the ports with their PID
# lsof -nl | egrep "TCP|UDP"

And then use ps for rest of your work. :)

UPDATE:
Since this was all good...there is even simpler way
adding -p option to netstat gives you the pid.


# netstat -anp | grep 'port number'

And again use ps for rest of your work.. :)

Yum repository on FC11

I was trying to create a yum repository for 389 directory and its dependencies

Setting up YUM repository:
Skip to next part if you already know the 389 directory repository.

This part explains the creation of yum repository for 389 directory server. Once created, this repository can be used for any fresh installation of 389 directory server.

1.Freshly install Fedora 11 on the machine. (Please refer the document OS Install & Config doc for security and OS hardening points)
2. edit the yum.conf file presently most of the time at /etc/yum.conf
replace the lines
keepcache=0 to keepcache=1
This will keep all the rpm's downloaded in next part at a location
/var/cache/yum/packages/

3.run yum install 389-ds
4.This will install 389 directory server and its dependencies. These packages will also be saved at /var/cache/yum//packages/
5.Save the packages at a secure location. e.g. /mnt/nfs_mounted_repo/
6.go to the directory where the rpm's are saved and run
$> createrepo -v .
This will create the necessary files for repository
7.Since 389-ds is already installed from step 3 you need not install it again.
8.Check out the section Configuration of 389 DS.






Update Yum to use new repository

Assuming that the repository is already prepared using the steps from section setting up repository, This section will describe configuration of yum to point to the new repository and installation of 389 DS.

We will assume that the repository is created and mounted at location /mnt/nfs_mounted_repo/

1.Create a repo file in /etc/yum.repos.d/ directory (you can name anything to your file make sure a .repo extension is added)
vim /etc/yum.repos.d/ds.repo
2.Add following data in that file
[DSrepo]
name=DSrepo
baseurl=file:///mnt/nfs_mounted_repo/
enabled=1
gpgcheck=0
3.disable the fedora.update repository
open the file /etc/yum.repos.d/fedora-updates.repo
and replace enable = 1 with enable = 0 in the file.

4.Now run following commands
$> yum clean all
This will clean yum database
$> yum list
This will list the files / packages available on that directory
5.The repository is now set and yum is ready to use the new repository.

Installing 389 directory server

Simply run
$> yum install 389-ds

And this will do the task

To setup the 389-ds run
$> setup-ds-admin.pl

answer the questions and voila you are up and ready to go...

Want to check if all is working fine ???
run the 389 console

$> 389-console

Disclaimer

The only intention of this blog is to help remember myself.
I don't take responsibility of any of the tips mentioned in this blog.