Wednesday, June 18, 2008

/lib/modules/2.6.18-6-686/build: No such file or directory.

kalau dapat error ni bila running

#make all


/lib/modules/2.6.18-6-686/build: No such file or directory.




cuba buat :-


aptitude update
aptitude install build-essential module-assistant
m-a update
m-a prepare


Tuesday, June 17, 2008

E: The package avast4server needs to be reinstalled

sudo gedit /var/lib/dpkg/status
in the document find this...
Package: avast4server
Status: deinstall reinstreq half-configured
Priority: extra
Section: alien.....
and change it to...
Package: avast4server
Status: install ok installed
Priority: extra
Section: alien....
Next go to the .deb installation package that you downloaded and open it in archive manager. Extract to your hard disk. You can now browse to these files to find the 'data.tar.gz' file which is another archive. Open this as 'root' and find the file 'avastd' -- it's in the directory (within the archive) called '/./etc/init.d/' As 'root', create in your filesystem a directory called /etc/sysconfig/ and then extract 'avastd' to that directory.
Start Synaptic. It will identify a broken link which is the 'avast4server' package. You can select this to do a 'Complete Removal'
Removal proceeds without error!

Wednesday, June 11, 2008

Sync data between 2 servers with rsync and ssh

Have you ever wanted to know how to easily synchronize the data between multiple servers automatically?
In this article I’ll explain how to setup 2 Linux servers to automatically synchronize data between a specific directory on each server. To do this we will use rsync, ssh key authentication, and a cron job.

Let’s call the 2 servers ‘SOURCESERVER’ and ‘DESTSERVER’ for
SOURCESERVER = Source server (the server we’re connecting from to upload the data)
DESTSERVER = Destination server (the server we’re connecting to receive the data)


Part 1 - Setting up SSH key authentication

First, we need to make sure the DESTSERVER has the ability to use key authentication enabled. Find your sshd configuration file (usually ‘/etc/ssh/sshd_config’) and enable the following options if they are not already set.

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

If you edit the file be sure to restart sshd afterwards.

# /etc/init.d/sshd restart

Next, on the SOURCESERVER we will create the public / private key pair to be used for authentication with the following command.

# ssh-keygen -t rsa

*Note: Do not enter a passphrase for this, just hit enter when prompted.

This should create 2 files, a public key file and a private key file.
The public key file (usually [homedir]/.ssh/id_rsa.pub) we will upload to the DESTSERVER.
The private key file (usually [homedir]/.ssh/id_rsa) we will keep on the SOURCESERVER.
*Be sure to keep this private key safe. With it anyone will be able to connect to the DESTSERVER that contains the public key.

Now we will plant the public key we created on to the DESTSERVER.
Choose the user account which you will use to connect to on DESTSERVER, we’ll call this user ‘destuser’ for now.
In that account’s home directory, create a ‘.ssh’ subdirectory, and in that directory create a new text file called ‘authorized_keys’. If it already exists, great, use the existing file.
Open the ‘authorized_keys’ file and paste in the contents of the public key you created in the previous step (id_rsa.pub). It should look something like the following

ssh-rsa sourceuser@SOURCESERVER

Save the file and change the permissions to 600 for the file and 700 for the ‘.ssh’ directory.

Now to test that the keys are working.
From the SOURCESERVER try logging in as normal using ssh to the DESTSERVER.

# ssh destuser@DESTSERVER

If all is working you should not be prompted for a password but instead connected directly to a shell on the DESTSERVER.


Part 2 - Creating the rsync script

Now for the rsync script.
I use a simple script such as the following

——————————————-

#!/bin/bash

SOURCEPATH=’/source/directory’
DESTPATH=’/destination’
DESTHOST=’123.123.123.123′
DESTUSER=’destuser’
LOGFILE=’rsync.log’

echo $’\n\n’ >> $LOGFILE
rsync -av –rsh=ssh $SOURCEPATH $DESTUSER@$DESTHOST:$DESTPATH 2>&1 >> $LOGFILE
echo “Completed at: `/bin/date`” >> $LOGFILE

——————————————-

Copy this file into the home directory of the sourceuser on the SOURCESERVER
and modify the first 4 variables in the file.
SOURCEPATH (Source path to be synced)
DESTPATH (Destination path to be synced)
DESTHOST (Destination IP address or host name)
DESTUSER (User on the destination server)
Save it as something like ‘rsync.sh’
Set the permissions on the file to 700.
# chmod 700 rsync.sh

Now you should be able to run the script, have it connect to the DESTSERVER, and transfer the files all without your interaction.
The script will send all output to the ‘rsync.log’ file specified in the script.


Part 3 - Setting up the cron job

Assuming everything has worked so far all that’s left is to setup a cron job to run the script automatically at a predefined interval.

As the same sourceuser use the ‘crontab’ command to create a new cron job.

# crontab -e

This will open an editor where you can schedule the job.
Enter the following to have the script run once every hour

——————————————-
# Run my rsync script once every hour
0 * * * * /path/to/rsync.sh
——————————————-

Your 2 servers should now be syncing the chosen directory once every hour.

Sunday, June 8, 2008

Debian lenny/sid dan VLANs ( cara aku )

emm.. aku kalu ikut teori tu memang tahu pasal VLANs dan kegunaannya.. sbb dah biasa guna kat managed switch dan pernah juga jeling-jeling kat cisco tapi dalam linux? emm tak pernah buat lagi.. apa pun memang blog ni untuk nota aku je.. supaya mudah aku buat rujukan..budak hingusan laa katakan... ok tanak citer lebar meh tgk camna nak buat simple vlans

Senario:-

deb server ( masquerade server )
eth0: xxx.xxx.xxx.xxx ( ip wan )
eth1 : 192.168.1.1/255.255.255.255
eth1 ( vlan1 ) : 100.100.100.1/255.255.255.0
eth1 ( vlan2 ) : 121.1.1.1/255.255.255.0

deb server memang dah dapat online ke internet.. jadi aku nak buat 2 vlan untuk 2 group yang boleh menampung 254 user setiap group. Jadi dengan adanya 2 vlan ini boleh kembangkan network menjadi 508 users.. ramai tu.. nak buat ape banyak tu? hehe ntah laa.. saje je kut..kelebihan vlan adalah untuk asingkan network contoh group makmal komputer, group pejabat, group staf dan lain-lain. VLAN dan IP aliases berfungsi hampir sama tapi berbeza dari sudut struktur. Secara ringkasnya untuk mudah faham VLAN interface adalah clone dari physical interface manakala ip aliases adalah alias kepada physical interface tersebut.. lihat output ini:-

eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.255
inet6 addr: fe80::21e:e5ff:fe29:edaf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:492 (492.0 B)

vlan1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
inet addr:121.1.1.1 Bcast:121.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::21e:e5ff:fe29:edaf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:492 (492.0 B)

eth1:1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
inet addr:122.1.1.1 Bcast:122.1.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1


ok jom mula..

1. Pastikan eth0 dan eth1 dah up

2. update dulu dan install vlan package

#apt-get update
#apt-get install vlan

siap?

3. edit /etc/network/interfaces

######### VLAN ###############


auto vlan1

iface vlan1 inet static
address 121.1.1.1
netmask 255.255.255.0
network 121.1.1.0
broadcast 121.1.1.255
mtu 1500
vlan_raw_device eth1
up /skrip/vlan1-up
down /skrip/vlan1-down

auto vlan2
iface vlan2 inet static
address 100.100.100.1
netmask 255.255.255.0
network 100.100.100.0
broadcast 100.100.100.255
mtu 1500
vlan_raw_device eth1
up /skrip/vlan2-up
down /skrip/vlan2-down


save dan exit

4. Buat ni

#mkdir /skrip

buat fail /skrip/vlan1-up dan masukkan ni :-

route del -net 121.1.1.0 netmask 255.255.255.0 dev vlan1
route add -net 121.1.1.0 netmask 255.255.255.0 dev eth1

buat fail /skrip/vlan1-down dan masukkan :-

route del -net 121.1.1.0 netmask 255.255.255.0 dev eth1

buat fail /skrip/vlan2-up dan masukkan :-

route del -net 100.100.100.0 netmask 255.255.255.0 dev vlan2
route add -net 100.100.100.0 netmask 255.255.255.0 dev eth1

buat fail /skrip/vlan2-down dan masukkan :-

route del -net 100.100.100.0 netmask 255.255.255.0 dev eth1

#chmod 755 /skrip/vlan*

5. Hehe.. senang je... skrang ni perlu buat masquerade rule pulak.. guna iptables

buat fail /skrip/masq kemudian masukkan ni save dan exit

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -F
iptables -t nat -A POSTROUTING -s 121.1.1.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 100.100.100.0/24 -j MASQUERADE

#chmod 755 /skrip/masq

untuk jadikan skrip packet forwarding ni running setiap kalu system up perlu masukkan dalam /etc/rc.local

edit /etc/rc.local kemudian masukkan :-

/skrip/masq

save dan exit.. sekarang reboot... APA? tanak reboot yea... ok... buat camni..

#/skrip/masq
#/etc/init.d/networking restart

ok sekarang cuba ifconfig vlan1 dan ifconfig vlan2 dah ada ke? ok kalau dah ada boleh laa configure client utk testing mana2 range ip vlan..

abis dah... goodbye!

Friday, June 6, 2008

Debian Etch Netinstall dan Linksys WMP54G Ver 4.1

hak hak hak.. lagi-lagi pening kepala.. lagi-lagi pening.. aduss.. sakit kepala aku.. aku baru nak up satu pc lama pakai debian netinstall dan cuba nak configure WMP54G ni.. tiba-tiba default kernel 2.6.18 yang mai dengan deb ni tak detect.. tak de dalam dmesg plak.. dah laa gitu.. lspci lak tak de aduss... kat bios ada lak detect network controller.. ingatkan kad aku tu dah mati... sakit wooo... last skali cuba install pciutils.. internet tak de.. dalam cd netinstall pun tak de package tu..teruk... jadi kene pi cari internet.. download pciutils dan wireless-tools debian package.. dapat je install aku buat lspci -v

01:00.0 Network controller: RaLink RT2561/RT61 802.11g PCI
Subsystem: Linksys WMP54G ver 4.1
Flags: bus master, slow devsel, latency 32, IRQ 5
Memory at d4000000 (32-bit, non-prefetchable) [size=32K]
Capabilities: [40] Power Management version 2

jejeje... RaLink tu ape mende? cari kat google.. dapat lee address ni..

http://www.ralinktech.com/ralink/Home/Support/Linux.html

apa lagi.. aku download.. dan make && make install lah... driver yang aku download mestilah yang support model RT2561 .. ni ha RT2501PCI/mPCI/CB(RT61:RT2561/RT2561S/RT2661)

bila dah download tu.. by default script tadi akan tambah alias ra0 rt61 kat /etc/modprobe.conf tapi kat deb.. tak pakai benda tu.. jadi kita kena rename /etc/modprobe.conf ke nama lain... kemudian tambah alias ra0 rt61 dalam /etc/modprobe.d/aliases

pastu?

#depmod -a
#ifconfig ra0
#iwconfig ra0 mode Managed
#iwconfig ra0 essid "korang punye laah"
#dhclient ra0

wa... dapat akhirnya... tapi aku tanak buat skrip.. terus letak benda ni sbg auto bila system up

aku edit /etc/network/interfaces

tambah benda alah ni:-

auto ra0
iface ra0 inet static
address 192.168.1.14
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
up \
/sbin/iwconfig ra0 mode Managed && \
/sbin/iwconfig ra0 essid MakKoMakAku

save dan exit lee.. reboot utk test.. dah

dah ilang dah sakit kepala aku.. bye

Tuesday, June 3, 2008

Plesk : Tired of the awful Horde skin?

So, get the WPS Sober theme/skin for Horde which is really nice and more into the "XP" style.
WPS Sober Theme for Horde

To install it:
- extract all the files of the archive to the /usr/share/psa-horde/ directory (! Exctract files directly to that dir, not to /usr/share/psa-horde/wps_sober !)
- if you want your users to use this theme by default, edit the file /etc/psa-horde/horde/prefs.php and check for the line 299 -> put 'wps_sober' in replacement of 'bluewhite'.

That's it! You got a really better-looking skin that won't scare your users.

Sunday, June 1, 2008

SAMBA - mudah dan sering lupa

aiyaaaa... aku lupa laaa pulak pasal samba.. lama tak buat..tapi tak kisah.. paling senang nak buat sambal ni kene tumbukcili sama itu mempelam.. pasti best.. tapi tu sambal.. ni SAMBA.. korang carik laa sendiri apa benda tu..

untuk samba share.. paling mudah dan paling senang...

1) Mesti jadi 'root'

2) apt-get install samba-common smbclient smbfs samba ( ni utk debian. lain distro ko install je janji dapat jalan )

3) create user

#adduser mamat

4) smbpasswd -a mamat ( masukkan password utk samba.. nak tukar passwd lain pun boleh.. )

5) pico /etc/samba/smbusers ( create file baru ) masukkan ni :-

mamat = "mamat"

kemudian save dan exit

6) pico /etc/samba/smb.conf

ok di sini ada 4 perkara korang kene buat security = user map username = /etc/samba/smbusers

bawah share [homes] tukarkan writeable = yes

save dan exit

7) restart samba


beres... skrg ni user boleh akses ke home shared masing-masing dengan memasukkan password tersebut.. ok.. tq

err... macammana nak akses ke share tu? alamakkkkkkkkkkkkkkkk...... korang ni pun satu laaa.. pakai windows kan?heh.. kalau tak pakai windows memang korang tak tanye dah camtu.. pakai windows.. ko pegi kat my computer taip ni je

\\ip-server-ko

kalau dari linux... pakai mount -t smbfs -o username=mamat,password=apaapeje //server-ko /mnt/serveraku

bukak /mnt/serveraku utk tgk file... tq

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...