Feeds:
Posts
Comments

Archive for the ‘Uncategorized’ Category

NIS (Network Information Service), setting up a NIS Server and client:

Install the next packages:

ypbind

ypserv

yp-tools

Setting up NIS Server:

Set the domainname in the master server by the command domainname, example:

#domainname nad810.org

Until this moment in /var/yp/ directory, there is two elements:

  1. bindings directory (which is empty) and
  2. nicknames file, which has this content:
  • passwd passwd.byname
  • group group.byname
  • networks networks.byaddr
  • hosts hosts.byname
  • protocols protocols.bynumber
  • services services.byname
  • aliases mail.aliases
  • ethers ethers.byname

Modify the Makefile to support:

    • Minimum UID 5000

    • Minimum GID 5000

    • Enable slave servers

    • Merge user password and group password

    • map files for passwd, group, hosts, rpc, and services

Run the command ypinit -m

* perhaps is neccesary to give the entire path for ypinit command and run it like this:

#/usr/lib/yp/ypinit -m

You will be prompt by this command to notify the names of any NIS servers. (important don’t get confuse in between server’s host name and domain name). So when the name of the server is in the list press Ctrl + D for finish.

Edit the files:

  • securenets

    In this file we specified which clients are valid for the server respond to. If nothing is specified in this file, the access is given to everyone. For security reasons is recommended specify the IP address or the networks allowed to use NIS.

    Note: In my case I have this file in /usr/share/doc/ypserv-2.19/securenets, and I configured it to allow any host in the network 192.168.7.0/24.

  • /etc/ypserv.conf

    This file is the configuration file for the ypserv daemon. It also may be used to control the behavior of the rpc.ypxfrd daemon if is being used.

    I decided leave the file without any change.

If there is any slave server:

# /etc/rc.d/init.d/ypxfrd start

Start the NIS server:

# /etc/rc.d/init.d/ypserv start

Initialize the rpc.yppasswdd daemon if you want to handle NIS passwords:

# /etc/rc.d/init.d/yppasswdd start

Initialize the maps files:

# /etc/rc.d/init.d/ypbind start

Now is necessary edit /etc/nsswitch.conf, this file tells the system where to look for database files.

I added “nis” to this entries in that file:

passwd files nis

shadow files nis

group: files nis

hosts: files dns nis

Setup a NIS client

Set the same domain name that the NIS server:

#domainname nad810.org

Edit the /etc/yp.conf file and add:

ypserver <NIS server IP> (or any other option explained in the file)

This file is used to control the behaviour of the client daemon. You are allowed to specify domains and/or servers in this file.

After that:

#service ypbind start

or

# /etc/rc.d/init.d/ypbind start

Setting NFS:

In the Server:

Modify the file /etc/exports/ adding this line:

/home 192.168.7.0/24(rw,sync)

Where 192.168.122.0/24 is my network.

In the Client:

Install autofs package

Edit the /etc/auto.master file and add this entry:

/home /etc/auto.home –timeout 600

Edit the /etc/auto.home file adding this entry:

* -fstype=nfs,soft,intr 192.168.7.33:/home/&

Edit the /etc/exports file adding:

/home *(rw, sync)

Restart the autofs service:

service autofs start

If you want to keep after reboot do:

service autofs start

Advertisements

Read Full Post »

Linux Terminal Server Project (LTSP) “is a free and open source add-on package for Linux that allows many people to simultaneously use the same computer. Applications run on the server with a terminal known as a thin client (also known as an X terminal) handling input and output. Generally, terminals are low-powered, lack a hard disk and are quieter than desktop computers because they do not have any moving parts.” (Wikipedia).

How it works?

When configured for network booting (PXE is not the only way, there is some more like Etherboot or NetBoot) the client first requests an IP address from the LTSP Server (which has a DHCP server running).

Once the IP has been gotten, the Linux kernel is transfer to the client by TFTP protocol, which is another server running in the LTSP server.

Then, the client mounts its root filesystem, by the NFS server running in the LTSP Server. After that loads Linux and starts the X window system. The client connects to the XDMCP login manager on the LTSP server.

I installed ltsp version 5.1, so in this version (and any newer that 5) the client first builds an SSH tunnel to the LTSP server’s X environment, through which it will start the LDM login manager (on the LTSP server). From this point forward, all programs are started on the LTSP server, but displayed and operated from the client.

………………………………………………………………………………………………………………………………………………………………………………………………………………………

To try this package I used my Laptop which have Fedora 10, following the steps that the guys from “K12Linux” (LTSP for Fedora) recommend in their Install Guide.

So, I installed the ltsp-server package:

# yum install ltsp-server

And since I want to test the client in the same machine but I can’t use KVM (my Laptop does not support virtualization very well) I don’t need to install ltsp-lvclient, instead of that, I will use a virtual machine on VirtualBox.

– This entry should have to be added to /etc/exports file:

/opt/ltsp *(ro,async,no_root_squash)

That will mount the files within ‘/opt/ltsp’ (server) into the client root filesystem with read-only permissions.

– We need a interface for handle the LTSP as well, we can use the ifup command for that:

# ifup ltspbr0

– This will bring this new interface up, run ifconfig command and the new interface will be there:

ltspbr0_interface

if you want to have it even after rebooting, need to have networking running (chkconfig network on)

– We need to turn on and start (by using ‘chkconfig servicename on’ and ‘service servicename start’) the next services:

xinetd

ltsp-dhcpd

rpcbind

nfs

sshd

And then, put the next servers on:

ldminfod

nbdrootd

nbdswapd

tftp

– Now the next step will take time (believe me, better do something else meanwhile….), execute this command to build the client:

# ltsp-build-client

When that be finish, you will see the next message:

ltsp-client-installation-completed

In my case I had some troubles with my machine so I had to do it twice, if that  happen to you, you have to erase the content of /opt/ltsp/ file before try to build the client again, otherwise it won’t let you do it.

Now is time to test it, open you VirtualBox (I assume that you have already one machine on it). Select the machine’s settings (because we need to specify that the interface used by our vm is ltspbr0) and in the Network tab change the interface like this:

Specifying the interface for Virtual the machine.

Specifying the interface for Virtual the machine.

Then, start the machine and press F12 to enable PXE (stand for Preboot eXecution Environment, also know as “pixie”). Through that we won’t let the system start the boot process from the local hard drive, but from the network interface.

If everything goes right, the authentication screen will appear:

k12linux

So you can authenticate with any valid user name in your machine.

I found this project useful since I have an extra machine at home, kind of old, but which can be useful for this purpose, so if I’m using my desktop computer, somebody else could use the old pc to connect as client of it and both work at the same time, nice…!, don’t you think?

Read Full Post »

Finally I got it…. ! I was scared about the fact that I had to read a Live CD and get the list of packages that it includes, but thanks to God is working.

Very long night, but with good results…

This is my code:  CorrespondingSource0.9

I tested it with a Fedora 10 Live CD, what it does is find the file system, mount it (for all the ones who knows how is a Live CD and all that mess with the images: yeah, was fun!), then access the rpm database of the CD and give a list of all the packages that are including in the disk.

I plan to merge this with the code that I already have done and hopefully be able to add more features to this project.

Read Full Post »

For my project I’m doing a bash script (for now) which is downloading a SRPM package from the CVS repository, and then it makes a ISO image of that… so, part by part I will explain what the script is doing.

This part is getting the name of the package that the user want to get the source.
#!/bin/bash
CURRENTDIR=$PWD
RPM=”$1″
echo “Getting SRPM for: $RPM”

Since the name of the package has dots (in the number of version/release) is necessary to replace those dots for underlines from the string… this line is doing it:
TAG=$(echo $RPM| sed “s/\.[^.]*$//” | tr “.” “_”)
echo “$TAG”

It will be necessary to have the name of the package (no version, no release, but the name of the package) so this line extract just that part.
PACKAGE=$(echo $TAG|sed “s/-[^-]*-[^-]*$//”)
echo $PACKAGE

For download the SRPM it creates a directory in /tmp/, the name of this dir is made up with the name of the package plus the number of the current process… (so it will be unrepeatable)
DIRECTORY=/tmp/$PACKAGE-$$
mkdir $DIRECTORY

… and this line will put us inside of the just created directory…
cd $DIRECTORY
echo “the package will be downloaded temporally in: $DIRECTORY”

Now, this line is important, because this made the connection to the CVS repository and it will ask download an specific package:
cvs -d :pserver:anonymous@cvs.fedora.redhat.com:/cvs/pkgs co -r “$TAG” $PACKAGE
where:
-d = cvs root directory
co = for check out
-r = to specify a version of a specific package
$TAG = the value of this variable is a string with the name of the package to download.
$PACKAGE = the value of this variable is a string with just the name of the package (no version, no release) so, in that way, the package will be downloaded in a directory with this name.

After downloading the package, we need to be inside the corresponding directory and creating the srpm…
cd $PACKAGE/F-*

In this point we need to run the make command, that will created a source rpm package….
make srpm

… and take name of the SRPM in a variable and the directory which it is kept, for later use…
SRPM=$(ls *src.rpm)
mkdir DIRforISO
cp $SRPM $PWD/DIRforISO/
DIRECTORY_CONTAINING_RPMS=$PWD/DIRforISO

The next line will create the .iso image of the srpm package…
genisoimage -o $SRPM.iso -R $DIRECTORY_CONTAINING_RPMS

after that it will be copied to original work directory:
mv $PWD/$SRPM.iso $CURRENTDIR/

The last step is to erase the work temporal directory, for be able to do that we need to move out of it…
cd
rm -rf $DIRECTORY

At the end of this process we will have an Iso image in our current directory for the requested package …

This is the preliminary version that I have, it will change a lot more, It was very interesting and because of that I have learned a lot more about scripting.

If somebody want to download it: Click on here

Read Full Post »