2007年11月11日 星期日

man hier

/usr/bin common utilities, programming tools, and applications

/usr/sbin system daemons & system utilities (executed by users)

/usr/include standard C include files

/usr/lib shared and archive ar(1)-type libraries

/usr/libdata miscellaneous utility data files

/usr/libexec system daemons & system utilities (executed by other programs)

/usr/share architecture-independent files

2007年11月10日 星期六

使用ppp無法開機啟動named

因為執行先後順序的關系,使得named在啟動的時候ppp還沒有運做,因此使用另一種方式在,在/etc/rc.d/ppp裡面加入

start() {
......
/bin/sleep 10
/etc/rc.d/named forcestart
}

而不在rc.conf裡面使用named_enable="YES"來啟動,讓ppp一直行完自動啟動named

build world

cd /usr/src
make update

......


make buildworld
make buildkernel KERNCONF=hsian
make installkernel KERNCONF=hsian
make installkernel KERNCONF=hsian KODIR=/boot/kernel.HSIAN
reboot
make installworld
mergemaster

2007年11月6日 星期二

freebsd web server

架設apache22 + mysql51 + php5 + php5-extensions + phpmyadmin

1.mysql server
cd /usr/ports/databases/mysql51-server
make -DWITH_CHARSET=big5 -DWITH_XCHARSET=all install clean

2.apache server
cd /usr/ports/www/apache22
make install clean

3.php5 language
cd /usr/ports/lang/php5
make config
[X] APACHE Build Apache module
make install clean

4.php extensions module
cd /usr/ports/lang/php5-extensions
make config
[X] MYSQL MySQL database support
[X] MYSQLI MySQLi database support
make install clean


5.mysql phpmyadmin
cd /usr/ports/databases/phpmyadmin
make install clean

以上都裝好之後開始設定
1. apache 設定
cd /usr/local/etc/apache22
設定httpd.conf
+ServerAdmin femc7488@gmail.com
+ServerName www.hsian.org:80
+DocumentRoot "/usr/local/www"
+<Directory "/usr/local/www">
+DirectoryIndex index.html index.htm index.php
+ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"

+Addtype application/x-httpd-php .php
+Addtype application/x-httpd-php-source .phps

+Include etc/apache22/extra/httpd-userdir.conf
+Include etc/apache22/extra/httpd-vhosts.conf

設定httpd-vhosts.conf
28 DocumentRoot "/usr/local/www/"
29 ServerName www.hsian.org
30
33 DocumentRoot "/usr/local/www/blog_img"
34 ServerName blogimg.hsian.org
35 ErrorLog /var/log/blog-error_log
36 CustomLog /var/log/blog-access_log common
37
40 DocumentRoot "/usr/local/www/blog"
41 ServerName blog.hsian.org
42 ErrorLog /var/log/blog-error_log
43 CustomLog /var/log/blog-access_log common
44
47 DocumentRoot "/usr/local/www/phpMyAdmin"
48 ServerName mysql.hsian.org
49 ErrorLog /var/log/mysql-error_log
50 CustomLog /var/log/mysql-access_log common

2. 開機啟動
apache22_enable="YES"
apache22_http_accept_enable="YES"
mysql_enable="YES"

3. 啟動
/usr/local/etc/rc.d/apache22 start
/usr/local/etc/rc.d/mysql-server start

4. phpmyadmin
cd /usr/local/www/phpMyAdmin
mkdir config
chmod o+w config/
cp config.inc.php config/
chmod o+rw config/config.inc.php

http://xxxxx/phpmyadmin/scripts/setup.php
Server->Add
set Connection type=socket
set Authentication type=http
set PHP extension to use=mysqli
Configuration->Save

這下剛剛建立的config裡面就有產生出來的設定檔了
cp config/config.inc.php .

2007年11月5日 星期一

freebsd named server

以master和slave架構實作

server:

/etc/namedb/named.conf
// listen-on { 127.0.0.1; };註解掉
//hsian.org master zone
zone "hsian.org" {
  type master;
   file "master/hsian.org.master";
   allow-transfer {
    140.138.145.192;
  };
};

/etc/namedb/master/hsian.org.master
$TTL 3600 ; 1 hour
@     IN SOA dns.hsian.org. root.hsian.org. (
              2007110603 ; serial
              3600 ; refresh (1 hour)
              900 ; retry (15 minutes)
              604800 ; expire (1 week)
              3600 ; minimum (1 hour)
              )
@     IN NS dns.hsian.org.
@     IN NS dns2.hsian.org.
dns    IN A 220.133.28.104
dns2    IN A 140.138.145.192
@     IN MX 10 mail.hsian.org.

@     IN A 140.138.145.192
blog    IN A 140.138.145.192
blogimg   IN A 140.138.145.192
www    IN A 140.138.145.192
ftp     IN A 140.138.145.192
mysql    IN A 140.138.145.192
freebsd   IN A 220.133.28.104
school    IN A 140.138.145.192

http://moon.cse.yzu.edu.tw/~s932361/hsian.org.txt

/etc/rc.conf
named_enable="YES"

/etc/rc.d/named start

Client:

/etc/namedb/named.conf
// listen-on { 127.0.0.1; };註解掉
//hsian.org master zone
zone "hsian.org" {
  type slave;
   file "slave/hsian.org.slave";
   masters {
    220.133.28.104;
  };
};

/etc/rc.conf
named_enable="YES"

/etc/rc.d/named start

2007年11月1日 星期四

使用者設定檔

/etc/master.passwd
透過pwd_mkdb來產生
/etc/passwd
要修改master.passwd使用
vipw來修改master.passwd檔

1001:1001: :0:0表示
UID:GID:登入群組(Class):密碼改變時間:失效時間

/etc/login.conf負責設定與使用者帳號相關的參數,其中也會設定群組中使用者帳號的參數。
當使用者登入時,/etc/master.passwd檔中的登錄群組欄會決定使用/etc/login.conf中的那個項目。

adduser
在 /etc/group 中加入使用者的群組
在 /etc/master.passwd 中加入使用者
在 /home 中建立使用者目錄,並建立 dotfile
在 /var/mail 中建立使用者郵件目錄

rmuser
如果該使用者有設定使用定時排程的工作,如 crontab 或 at,則先將它移除。crontab 的工作排程會被放在 /var/cron/tabs/username,而 at 的工作排程則放在 /var/jobs/username 中。
如果該使用者有正在執行的程式,則送出 SIGKILL 給該行程以將它停止。
以 vipw 移除讓使用者在 /etc/master.passwd 中的帳號。
使用者的家目錄 /home/username,使用指令 rm -rf /home/username。
再移除使用者郵件目錄 /var/mail/username。
如果暫存的目錄中 (/tmp 及 /var/tmp) 有該使用的暫存檔,則將它移除。
若該使用者所屬群組已無人使用,則編輯 /etc/group 來移除群組。

家目錄下
.login 設定終端機類型、設定環境變數
.cshrc 設定指令別名、設定搜尋路徑、設定umask等
.profile 對sh而言,類似.login .cshrc
.mailrc 定義個人郵件別名、設定郵件讀者選項
建立時復製來自於/usr/share/skel下的資料

umount查看行程是否使用

umount /usr會告訴你正忙
可以使用
fstat -f /usr來看那些行程或是檔案正在使用