Monday, January 30, 2012

Copy, Remove, Tar, Change Owner, Change mod, Clear History

How to check size folder
#du -h
#df -h

tar files
#tar -cjvf sha.tar.bz2 fold1 fold2 fold3 fold4
c- create j-tar.bz2 v-show process f-files
# tar cvzf archive_name.tar.gz dirname/


copy file tar to another server
#scp sha.tar.bz2 shariha@162.12.12.22:
ni dia akan pi ke home shariha di server 162.12.12.22

untar
#tar -xjvf sha.tar.bz2
#tar -zxvf sha.tgz
#tar -xvzf sha.tar.gz

katakan nak move file tuh ke /data/mms
#cd /data/mms
#mv /home/shariha/sha.tar.bz2 ./
./ means current path

Change ownership
#chown -R www-data:www-data fold1 fold2 fold3 fold4

Change mod
#chmod -R 755 fold1 fold2 fold3
| 7 | 5 | 5 |
|rwx|r-x|r-x|
|owner|group|world|

Copy
#cp -rp /home/shariha/sha.tar.bz2 /data/mms

copy name folder start from 3** (30, 300, 301, 321..etc)
#cp -rp /../data/3* ./
so dia akan copy apa2 yang foldername start 3... kepada current path

Clear History
#history -c
kalu laa tertype password.. leh argh nak clearkan.. 

Find / Whereis 
#find /path/want/to/search -name mysong.php (ubuntu)
or
#find /path/want/to/search -name *.php
or
#whereis

Sunday, January 29, 2012

Problem cannot ping hostname but can ping ip

Setting /etc/rc.conf
ifconfig_dco="DHCP"
hostname="fw.company.com"
defaultrouter="192.168.1.1"

Setting /etc/resolv.conf
search carolina.rr.com
nameserver 24.25.5.60
naemserver 24.25.5.61

Setting /etc/hosts
::1 localhost.company.com localhost
127.0.0.1 localhost.company.com localhost

Tapi tak leh ping jugak... pelik2.. Sifoo solution... Idupkan deamon
Caranya.. tambahkan kat /etc/rc.conf
named_enable="YES"
Pastu... idupkan dengan # /etc/rc.d/named start

Dan tiba2 ia idup... hoyeee... five star for sifu zaman..


Thursday, January 19, 2012

Cluster Ubuntu - DRBD

Before I start sharing my knowledge here, I would like to give my best reward to Bro John who teach me and sis salina.. :)

Hoyeee... let start writing..

What is cluster.. ???
A group of the same or similar elements gathered or occurring closely together.

Why need cluster..
Because it is for backup purposes and will reduce the possibility for a site to down since the both server are working together.


update the package
#apt-get update

Untuk install cluster, kena ada 2 server at least... Kalu nk buat all the steps... Make sure do it the both server for each step before go to another step :

1. Install apache2
#apt-get install apache2
-> check idup ke tk -> pi browser //ip

2. Install php5
#apt-get install php5

3. Install libapache2-mod-php5

4. Restart Apache
#/etc/init.d/apache2 restart

5. Check package info
#dpkg --get-selection

6. Install php extension
#apt-get -y install php5-cli php5-common php5... etc
-y untuk dia terus pilih yes..
tambah jerk php extension yang lain untuk install serentak


Untuk Present Hardisk
pi kat vmware - add hardisk
7. #fdisk -l
kalau tak jumpa #reboot

8. Install drbd
#apt-get install drbd8-utils
check samada yang nih yang paling update kat web dia atau browsing pasal drbd

9. nano /etc/drbd.conf

- install drbd file refer here http://dev.mysql.com/doc/mysql-ha-scalability/en/ha-drbd-install-drbd.html

- now ubuntu 10.04 using only this apt-get install drbd8-utils
example on drbd.conf :

global {
usage-count no;
}
resource r0 {
protocol C;
startup {
become-primary-on both;
}
net {
allow-two-primaries;
cram-hmac-alg "sha1";
shared-secret "k3n4Tuk4r";
after-sb-0pri discard-least-changes;
after-sb-1pri violently-as0p;
after-sb-2pri violently-as0p;
rr-conflict violently;
}
syncer {
verify-alg md5;
al-extents 257;
rate 40M;
}

on pm-vst-drbd01 {
device /dev/drbd0;
disk /dev/sdb;
address 172.18.33.33:7788;
flexible-meta-disk internal;
}

on pm-vst-drbd02 {
device /dev/drbd0;
disk /dev/sdb;
address 172. 18.33.34:7788;
flexible-meta-disk internal;
}
}

10. Install OCFS (Oracle Cluster Site System)
#apt-get -y install ocfs2-tools ocfs2console
create folder ocfs2 and touch cluster.conf inside the folder

example :

#nano /etc/ocfs2/cluster.conf
cluster:
node_count = 2
name = mysqlocfs

node:
ip_port = 7777
ip_address = 172.18.33.33
number = 0
name = pm-vst-drbd01
cluster = mysqlocfs
node:
ip_port = 7777
ip_address = 172. 18.33.34
number = 1
name = pm-vst-drbd02
cluster = mysqlocfs

11. Check status ocfs2
#/etc/init.d/o2cb status

12. add HDD to each server and reboot the server to detect the HDD but do not format it just leave it.

13. Run OCFS
#dpkg-reconfigure -p medium -f readline ocfs2-tools

example :
Would you like to start an OCFS2 cluster (O2CB) at boot time? yes
Name of the cluster to start at boot time: ocfs2
The O2CB heartbeat threshold sets up the maximum time in seconds that a node
awaits for an I/O operation. After it, the node "fences" itself, and you will
probably see a crash.

It is calculated as the result of: (threshold - 1) x 2.

Its default value is 31 (60 seconds).

Raise it if you have slow disks and/or crashes with kernel messages like:

o2hb_write_timeout: 164 ERROR: heartbeat write timeout to device XXXX after NNNN
milliseconds
O2CB Heartbeat threshold: 31
Loading filesystem "configfs": OK
Mounting configfs filesystem at /sys/kernel/config: OK
Loading stack plugin "o2cb": OK
Loading filesystem "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Setting cluster stack "o2cb": OK
Starting O2CB cluster ocfs2: OK

14. Buat DRBD partition
#drbdadm create-md all
- run drbdadm create-md all (If you see error please check your drbd.conf and edit disk conf. Make sure you have invalid HDD path)

15. Start DRBD
#/etc/init.d/drbd start -> yang nih kena buat serentak utk dua2 server.. sbb nnti dia akan cari yang lg satu

16. Overwrite data
#drbdadm -- --overwrite-data-of-peer primary all

17.Format hardisk (p/s: JANGAN BUAT SERENTAK.. buat satu2... !!!!!!!!!!)
#mkfs -t ocfs2 -N 2 -L ocfs2_drbd0 /dev/drbd0
- create drbd filesystem mkfs.ext3 /dev/drbd0 or mkfs -t ocfs2 -N 2 -L ocfs2_drbd0 /dev/drbd0

18. ada lg step... to be continued.. :)












Wednesday, January 18, 2012

RAID 1+0

(Step A) How to add new hardisk and make it mirror.
1. Shutdown the server..
2. F8 to configure the logical drive
3. View the logical drive first.. (new setup doesnt have any logical drive setting)
4. Choose RAID 1+0 -> and unselect second drive as backup.
5. Save the configuration
6. Done..

If the hardisk corrupted and you want to copy the hardisk.
1. Add new hardisk with OS inside the physical server. (Configure it as step A)
2. Mount the corrupt hardisk to bay 3.
3. Configure it (1. View logical drive 2. Choose Raid0 3. Save Configuration )
4. Then you can see the hardisk that already mount to the server. (Sometimes it take time..)
5. Backup everything.


Warghh... it is look easy to list the step but the actual always diff... hehehe

Tuesday, January 10, 2012

Create Multisite Setup for Wordpress

I feel like crazy to setup wordpress with multisite features. Wargh.. :(

First step is almost done.. But still facing big problem where i cannot change the ip to domain name. It is not simple as setting up at vhost and it is also not simple as register to dns.. Huuhh.. There is a lot of thing to learn.. keep learning and keep learning..

Here is some step to setup multisite in Wordpress.


Wednesday, January 4, 2012

FreeBSD Security Advisories

FreeBSD Security Advisories has announced multiple remote and local vulnerabilities recently . Kindly take necessary action to prevent our server from become a victim of these vulnerabilities. Your cooperation are highly appreciated . Thanks and regards.

http://security.freebsd.org/advisories/FreeBSD-SA-11:06.bind.asc

http://security.freebsd.org/advisories/FreeBSD-SA-11:10.pam.asc

http://security.freebsd.org/advisories/FreeBSD-SA-11:08.telnetd.asc

http://security.freebsd.org/advisories/FreeBSD-SA-11:09.pam_ssh.asc

http://security.freebsd.org/advisories/FreeBSD-SA-11:07.chroot.asc



cth laa...

so.. ikut jerk step dia..

buat folder patch kat mana2..

#mkdir patch

#cd /patch

# fetch (link yang dia kasi)
pastu pi kat /usr/src

#cd /usr/src

#patch < /path/to/patch8888

*************

(----) mean file yang lama yang akan di buang

(++++) mean file yang baru yang akan di tambah

done.. :)