Archive for August, 2009

SBDavid

Change priority of swap files

Change priority of swap files

You can check the current priority of the swap file from /proc/swaps.

$ cat /proc/swaps

Inorder to change the priority of the swap partitions, you need to edit the “fstab” and append the new priority. If you have the fstab entry for your swap file /swap1 as:

/swap1 swap swap defaults 0 0

then append the following:

/swap1 swap swap pri=x,defaults 0 0

where x is the new priority you have set.

You can re-mount it by using ‘mount -a’ command.

SBDavid

Install VNC in VPS server with Gnome

Install VNC in VPS server with Gnome

VNC, or Virtual Networked Computing, is a way of controlling a remote server just as though you are sitting in front of it. Like RDP remote desktop connection in Windows we have VNC for Linux. You can connect using a VNC client to a remote server system running the VNC server, then an image of the remote desktop is transmitted to your local computer and you can see and control the desktop.

Usually Linux servers are not installed with graphical interface(only text mode). However, for VNC to gain access of the user friendly interface like windows, Gnome or KDE have to be installed.

Note : Please make sure you have at least 128MB of unused ram to allocate for VNC. Also, YUM and its required libraries are installed (python, sqlite, etc) on the server.

Installation :

1. Login as root to your server and run the following:

yum -y groupinstall gnome (”yum -y groupinstall kde” for KDE )
yum -y install vnc vnc-server firefox x11-xorg

This will install Gnome and neccesary applications (VNC, FireFox, X11 libraries, etc) in the server.

2. Start up the vnc server with the ‘vncserver’ command and it will prompt you to enter a desired password. Just type what you want to use in and then confirm it. (if running as root, it will be in /.vnc or /root/.vnc or /home/root/.vnc)

3. Now, you’ll see VNC server is running by executing:

ps -ef |grep vncserver

Now kill the VNC processes,

pkill -9 vnc
rm -rf /tmp/.X1*

4. Edit xstartup file

vi /root/.vnc/ xstartup

Replace the last line(usually ‘twm & ‘ ) with ‘gnome-session & ‘ (without quotes of course). you can use ’startkde &’ for KDE

This tells VNC to startup GNOME instead of the default window manager, twm (or whatever the last line was).

5. Create users to VNCServer as follows,

Edit the lines below in the file /etc/sysconfig/vncservers and add a user (user should be a valid user created on your server and not just simply a name).

VNCSERVERS=”1:root”
VNCSERVERS=”2:newuser”

You can change the password of the VNCServer as :

vncpasswd homedir/.vnc/passwd

If you want to change the password for the VNC user root, run the following
command from konsole,

vncpasswd /root/.vnc/passwd

6. Go ahead and execute the command ‘vncserver’ again, and VNC will startup, using the password specified earlier and create a default VNC instance on VNC port 1.

7. Start up your RealVNC client on your PC, and put in :1, and it should ask for your password that you put in earlier.

Checking disks for errors using the badblocks command

Read-only test using the badblocks command.

This is a non-destructive read-only test which can be run on disk even if it contains a mounted filesystem. It simply verifies that each block can be read; it does not test for write errors.

sudo badblocks -s -v -c 10240 /dev/sdx
-s = show progress
-v = verbose mode
-c 10240 - check 10K blocks at a time
SBDavid

Network Information System

Network Information System

On of the important use for NIS is to keep vital data such as user account information (e.g. /etc/hosts, /etc/passwd and /etc/group files) synchronized between all hosts.Let us see how we can configure NIS. NIS is a server-client based architecture. There will be a NIS server and then a NIS client. Let us see how we can configure this both

NIS SERVER:

You must first check whether we have a package called ypserv installed in the server. Once the package is installed then start the service called ypserv. Then you must give a NIS domain name for the server which can be provided

nisdomainname test

Also you can verify your domain name by just typing “nisdomainname:. Also there should be entry in the file /etc/sysconfig/network like this

NISDOMAINNAME=test

The next thing you have to do is you have to share the directory where you user accounts are residing. For example lets suppose that you creat a directory called home1 and you want to the NIS users home directory to be home1 then you can do this like,

mkdir /home1
useradd -d /home1/test test

where test is the NIS user. Once created you have to export this file through nfs.This can be done like this

by putting entries in the /etc/exports file

/home1 *(rw,sync)

Once you have put these entries make sure that the services portmap and nfs are started. Once you have done this we have to make the yp file which can be done like this,

/usr/lib/yp/ypinit -m

Then restart the ypserv services. Also make sure that the service called yppasswdd is also turned on These are the things that has to be done on the server side.

NIS CLIENT: To make a NIS client check whether the package ypbind is installed in the system. Also check that the service called autofs is also turned on.Then there are two important files that we need to consider that is /etc/auto.master and /etc/auto.misc . The service autofs is used so that the directory that we use or shared through nfs is automatically mounted and also see that when a nisuser login then a directory is also automatically created.In /etc/auto.master file give the entries like this

/home1 /etc/auto.misc –timeout=60

Then an entry about our nis server should be given auto.misc like this

* -rw,soft,intr :/home1/&

Also you have to tell the client which is the NIS server which can be told like this. In the command prompt

authconfig

Select NIS then select next then give the nisdomain name and the ip of the NIS server and then exit. If it listenx to the NIS server then there wil be no errors shown. now if everything goes well you should be able to login as test in all the NIS clients.

« Prev