2011年2月10日 星期四

DNS

DNS就是hostname + domain 對應到IP的轉換
透過DNS的查找, 就能知道host.domain所對應到的IP位置

要在Internet上有合法的domain,必須要到相關單位申請, 並擁有一個domain, 必須告訴該單位你所要掌管的domain的server IP, 或是domain託管

一個domain有一筆domain record是放在上層的DNS server上(google.com這個domain的domain record放在.com的DNS server上, google.com是.com的一個host), www.google.com是google.com的一個host

A record : host與IP address對應
MX record: 指定mail server的位置
CNAME record: Alias設定

http://www.aboutdebian.com/dns.htm

2011年1月20日 星期四

CentOS下vnc與local畫面同步 & xrdp (可用Windows遠端桌面連線)

1. 確認vnc-server已安裝

2. 用vncpasswd產生/root/.vnc/passwd

3. 編輯/etc/X11/xorg.conf
增加Section "Module"
Section "Module"
Load "vnc"
EndSection

在Section "Screen"增加此行
Option "passwordFile" "/root/.vnc/passwd"

4. 把port 5900打開

==================
xrdp安裝設定 (可用Windows遠端桌面連線)

1. 安裝EPEL repositories (以下link search EPEL)
http://wiki.centos.org/AdditionalResources/Repositories
a. download rpm
>wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
b. install rpm
> rpm -ivh epel-release-5-4.noarch.rpm

2. install xrdp
>yum install xrdp

3. 設定/etc/xrdp/xrdp.ini, 新增此session
[xrdp2]
name=Desktop
lib=libvnc.so
ip=127.0.0.1
port=5900
username=
password=ask

4. 把Firewall port 3389打開

5. restart xrdp & vncserver
>service vncserver restart
>service xrdp restart

6. 在Remote windows測試
開啟"Winodws遠端桌面連線" mstsc.exe
IP:remtoe端的IP

7.連進去後Module欄, 下拉選"Desktop"
keyin密碼就OK了!

參考資料:
1. http://it-specialists.org/pages/posts/howto-installation-of-xrdp-under-centos-5.5-10.php
2. http://blog.yam.com/linkatzelda/article/27398655
3. http://www.vixual.net/blog/archives/tag/xrdp

2011年1月13日 星期四

2010年12月1日 星期三

customize LiveCD

1. put LiveCD iso to home directory


3. make a temporal directory for mount ISO
# mkdir /tmp/LiveCD/

4. mount LiveCD ISO
# mount -o loop ~/CentOS-5.5-x86_64-LiveCD.iso /tmp/LiveCD/

5. make a tempral directory for custom LiveCD (for pack back into ISO)
# mkdir -p ~/livecd/cd

6. copy all file except squashfs.img
# rsync --exclude=/LiveOS/squashfs.img -a /tmp/LiveCD/ ~/livecd/cd/

7. make a temporal directory for mounting squashfs.img
# mkdir /tmp/squashfs/

8. mount squashfs.img
# mount -t squashfs -o loop /tmp/LiveCD/LiveOS/squashfs.img /tmp/squashfs/

9. make a temporal directory for ext3fs
# mkdir ~/livecd/ext3fs/

10. copy all file of squashfs.img to ext3fs (there is an ext3fs.img)
# rsync -a /tmp/squashfs/ ~/livecd/ext3fs/

11. make a temporal directory for custom LiveCD's /
# mkdir ~/livecd/custom/

12. mount ext3fs.img
# mount -t ext3 -o loop ~/livecd/ext3fs/LiveOS/ext3fs.img ~/livecd/custom/

13. chroot to ~/livecd/custom
# chroot ~/livecd/custom

14. mount /proc and /sys
# mount -t proc none /proc/
# mount -t sysfs none /sys/

15. you can customize your new LiveCD Now!!

16. umount /proc and /sys and exit
# umount /proc/
# umount /sys/
# exit

17. create a new empty ext3fs file and import all files in custom/
# dd if=/dev/zero of=~/livecd/ext3fs.img bs=1M count=4096
# mkfs.ext3 ~/livecd/ext3fs.img
# mkdir ~/livecd/newfs
# mount -o loop ~/livecd/ext3fs.img ~/livecd/newfs
cp -dpR ~/livecd/custom/* ~/livecd/newfs

18. umount ext3fs and newfs
# umount ~/livecd/custom
# umount ~/livecd/newfs

19. replace original ext3fs to new ext3fs file
# cp -f ~/livecd/ext3fs.img ~/livecd/ext3fs/LiveOS/ext3fs.img

20. umount squashfs
# umount /tmp/squashfs

21. umount ISO
# umount /tmp/LiveCD/

22. pack squashfs.img
# mksquashfs ~/livecd/ext3fs ~/livecd/cd/LiveOS/squashfs.img

23. pack iso
# cd ~/livecd/cd
# mkisofs -r -V "CentOS-5.5-x86_64-LiveCD-Custom" -b isolinux/isolinux.bin -c isolinux/boot.cat -cache-inodes -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/CentOS-5.5-x86_64-LiveCD-Custom.iso .

Congratulation! you did it.

參考資料:
http://osdir.com/ml/linux.redhat.fedora.livecd/2008-07/msg00003.html
http://jeffreywt.com/open-source/linux/modifying-a-livecd-with-squashfs-tools

2010年10月12日 星期二

進入single user mode

在開機選單grub裡,
kernel那行最後加上 -s開進去就是single user mode了, 可以passwd改密碼之類的
1. 當grub倒數時, 讓他停在選單

2. 按e, 編輯

3. 選到kernel那行 按e 編輯

4. 最後面加上-s, 然後Enter

5. 選到kernel那行 按b

2010年10月1日 星期五

在RHEL 建立 postgreSQL database

在RHEL5.4下 postgreSQL要先安裝好並啟動

service postgresql start

1. 不能直接用root來建立資料庫, 所以另外create一個OS的user
adduser jack
passwd jack

2. 建立/更改 OS user "postgres"的密碼
passwd postgres

3. 建立role (postgreSQL的)
su - postgres
createuser -d -a -P jeoff
logout

4. 建立資料庫 createdb
createdb jack

http://blog.vinceliu.com/2008/02/looking-for-postgres-configurations.html