>------------------------------------------------------------------------< > < > ### 著 作 權 聲 明 ### < > < > 鄭文吉 jwj@mail.kdais.gov.tw < > < >  本文件允許任何個人自行下載閱讀,或者將之轉載在任何網路服務資源,例如 < > FTP/Gopher/WWW/BBS等站臺上﹔亦可在不刪改作者原作情況下,自行由印表機列 < > 印。以上行為均不需經過本人授權同意(但若能告知一下我會更高興)。 < > < >  本著作權規範並不限制您列印數量,但若作為商業性出版使用及轉排版印刷等 < > 則不被允許。另外,本著作權聲明是本著作的一部份,任何將本聲明與本著作分 < > 離的動作已經侵權並違法。如有意見,請與作者聯繫。 < > < >------------------------------------------------------------------------<   Installing and Running a Usenet News Server with INN and FreeBSD 在 FreeBSD 上使用 INN 來安裝及執行 News Server    原作者:John Kozubik - john@kozubik.com - http://www.kozubik.com June 6, 1999 亂譯者:鄭文吉 - jwj@mail.kdais.gov.tw - http://farmer.iyard.org/jwj/jwj.htm October 9, 2002 Introduction 前言 This document is intended for users who have a basic understanding of loading, configuring, and maintaining a FreeBSD 3.x or 4.x server, and wish to run such a server as a Usenet news server.   本文是寫給那些已經知道如何下載安裝、設定和維護 FreeBSD 3.x 或 4.x 以上版本伺服器,並且準備要在上面弄個news server的人看的。(還不會的人, 麻煩回去練一練。) These step by step instructions are accompanied by some explanation and background information / theory. However, this document is not a comprehenzive tutorial on the care and feeding of every type of Usenet news server. The reader is encouraged to study the other references listed in Appenix A.   以下我將逐步介紹,並且偶而提供一些解說和基本觀念與理論。不過,這可 不是一份可以涵蓋所有類型 news server 介紹的萬能講義,建議你可以參考一下 附錄 A 裡面所列的參考資料。 These instructions are applicable to the INN 2.2.x news server software, and the FreeBSD 3.x and 4.x operating system revisions.   本文適用於 INN 2.2.x 版的 news server 軟體,以及 FreeBSD 3.x 或 4.x 以上版本的作業系統。 These instructions assume that you have control of the server you plan to run this on (you are root) and that you have an upstream news feed that you are authorized to use.   本文假定你具有該主機的控制權(就是說你是root),並且已經得到上游 news 的餵信許可。 Concepts 概念 In the simplest sense, we will be performing the following steps:   簡單來說,我們將要做到下面幾個步驟: 1. Configuring a disk subsystem that will handle a news feed 1. 設定用來處理news資料餵送的磁碟子系統 2. Installing the news server software 2. 安裝 news server 軟體 3. Configuring the news server software to receive news from the upstream newsfeed 3. 設定 news server 軟體來從上游接收資料 4. Configuring the news server to spool news to disk in an acceptable manner 4. 設定 news server 軟體採用可以接受的方式來儲存資料 5. Configuring the news server to send articles to news reader clients 5. 設定 news server 軟體把文件傳送到使用news讀信軟體的一般使用者 6. Instructing the server to run certain maintenance commands on a regular basis 6. 讓伺服器[正常]地執行特定的維護管理指令 This document is in a step by step format, but there are a few concepts that the reader should understand right away:   本文是採用逐步說明的方式來寫的,但有一些概念是你必須馬上知道的: The Disk Subsystem 磁碟子系統 Usenet news fills up disk quickly. It is entirely possible that your newsfeed could send you 4 megabytes of news per minute (or even much more). Therefore, it is essential that you configure a large amount of disk space for news in addition to the amount of disk space that you use for normal operating system installation and use. News會很快的把硬碟空間灌滿,你的上游可能會每分鐘送來4 MB的資料 (搞不好 還更多)。因此,在正常的作業系統的安裝和運作之外,你需要另外準備很大的硬碟 空間給 news 用。 RAID storage methods are generally not needed - for reasons that will become clear in the next section where we discuss 'Overview vs. Articles'. However, if fault tolerance is important to you (if news is a mission critical appliation in your organization) I would recommend RAID level 1+0 (a stripe of mirrored pairs) over RAID level 5, because of the poor performance of RAID 5. 雖然如此,通常我們不需要用到磁碟陣列這種儲存方式,原因等後面討論到[概 要和本文]時就知道了。不過,假如系統容錯能力對你很重要 (假如這個news對你的 公司來說非常重要的話),建議你採用1+0級的磁碟陣列 (就是當鏡像磁碟來用),而 不要用到第五級,因為第五級的磁碟陣列效率不是很好。 Overview vs. Articles 概要和本文 In this document, we will be using something called the CNFS storage method. This means that we will set aside a number of large files (usually each file is the size of an entire disk) and then collecting all of these large files into one large pool of space for articles. 在本文中,我們會用到所謂的CNFS儲存方式。這表示我們會保留好幾個很大的檔 案 (通常每個檔案的大小都跟整顆硬碟一樣大),然後把這些大檔案集中起來,形成 一個用來蒐集文件的巨大儲存空間。 This is the reason that RAID is not particularly important. Although our total article storage space might be 100 gigabytes or more, it can be made up of 25 different 4 gigabyte drives, each with a 4 gigabyte spool file on it. When the news server is configured, it is told about each spool file, and when it runs, it spools articles across each of these files in a distributed manner. This is why RAID is not necessary to create a large pool of disk space - the news server aggregates the disks on its own. 這就是為何磁碟陣列系統並不是特別重要的緣故。雖然整個文件儲存量可能超過 100GB以上,但我們可以虛擬25個不同的4GB硬碟,每個硬碟裡都有一個4GB的檔案。 當安裝news server時,每個檔案都會被告知﹔而當它執行時,文件就會分別派送到 個別的檔案裡。這就是為何不需要用磁碟陣列的方式來建造一個巨大的硬碟庫∼news server會自己把各個硬碟整合起來。 This large spool space is just for articles though - and articles cannot be given to clients without an accurate index of where those articles are in the spool space. This index is known as the 'overview' and the overview resides on the /var filesystem. Because the overview is simply a collection of pointers to news articles in the spool, it is much smaller - however, it can still grow quite large. 由於整個巨大硬碟庫只是給文件存放用的,因此如果沒有一個精確的索引說明文 件在哪,就沒法把指定的文件提供給使用者。這個索引稱之為「概要(overview)」, 存放在 /var 這個檔案系統中。因為概要本身只是簡單地收錄硬碟庫裡的文件所在位 置的指標,因此自然小很多∼不過,它還是可以長得非常大。 When the spool space becomes filled, the earliest articles in the spool are expired and go away to make room for new articles. Therefore, you do not need to worry about running out of spool space. When these articles go away, their corresponding links in overview also go away. 當硬碟庫的空間滿了以後,最早的文件就會被擠出去,把空間留下來給新文件用﹔ 而在概要裡,它的對應連結也會被刪掉。因此,你不用擔心硬碟庫會爆掉。 There will be a problem, though, if you run out of space in /var for overview before the spool fills up. So the important question is: "how do I know how big to make my /var filesystem to hold overview, given a certain amount of spool space". This is a very hard question to answer. For instance, if your server only receives articles from the alt.binaries heirarchy, then your spool space will fill with these large articles before your overview space will fill with the pointers to them. On the other hand, if you receive articles from everything except the alt.binaries heirarchy, then you may have plenty of spool space for these small articles, but your overview may fill up. 但這樣還是有個問題,萬一在硬碟庫爆滿前,概要檔就把 /var 裡的空間灌爆了 怎麼辦? 因此就有個重要的問題:「我怎麼知道要作多大的 /var 檔案系統來擺概要 檔?」 這很難說,如果你的news server只收來自 alt.binaries 裡的東西(註:這部 分新聞群組的文章大多含有附件檔,因此每一篇都很大),那麼你的硬碟庫就會概要 檔的硬碟空間還早爆滿。反之,如果你什麼都收,只不收 alt.binaries 裡的東西, 那麼就算你有很大的硬碟庫來放這些小文件,你的概要檔還是可能爆滿。 It is generally agreed that servers receiving a complete news feed (all available newsgroup heirarchies) should have a 9:1 ratio of spool space to overview space. This means that if you normally like to have one gigabyte of space for your /var file system, and you have 50 gigabytes of spool space, you should atually make your /var filesystem the original one gigabyte _plus_ 5.5 gigabytes (50 divided by 9) for overview. 對一個接收所有已知的新聞群組的news server來說,硬碟庫與概要檔通常會採 用 9:1 的比例。也就是說,如果你想留 1GB 給 /var 用,而硬碟庫總容量為 50GB, 那麼你應該留原來 /var 的 1GB + 概要檔需要的 5.5GB (50/9) 來作給 /var 檔案 系統。 Finally, there are additional files that grow alongside your spool and overview that reside in the /usr filesystem - I would recommend a /usr filesystem that is one half the size of the space reserved for overview (in addition to whatever space you normally set aside for /usr). 最後,因為有一些位於 /usr 中的附加檔案也會隨著硬碟庫和概要檔而長大。個 人建議,/usr 應該有保留給概要檔的空間大小的一倍半那麼大。因為 /usr 還得放 一些其他檔案。 Our Imaginary System 我們的虛構系統 Our imaginary system that we will use throughout this document is an Intel-based PC server with 10 four gigabyte hard drives attached. 在全文中,我們所使用的虛構系統,是一台 Intel CPU 架構、擁有 10 顆 4GB 硬碟的PC伺服器。 Our imaginary system is named news.example.com, and has an IP address of 10.10.10.10. Our newsfeed is named news.upstream.com and has an IP address of 20.20.20.20. Our client has a workstation with an IP address of 209.209.209.209. 這台虛構系統的名稱是 news.example.com,IP位址 10.10.10.10。上游news 伺 服器是 news.upstream.com,IP位址 20.20.20.20。使用者的IP位址 209.209.209.209。 Step By Step Instructions 逐步說明 1. Given that we have 10 disks of 4 gigabytes each, we will set up our file system as follows: 1. 已知我們擁有 10 顆 4GB 硬碟,將之設定成下列的檔案系統: Mount Disk Size ------------------------------------ / da0 500 (swap) da0 128 /usr da1 2000 /var da2 4000 /mnt/da3 da3 4000 /mnt/da4 da4 4000 /mnt/da5 da5 4000 /mnt/da6 da6 4000 /mnt/da7 da7 4000 /mnt/da8 da8 4000 /mnt/da9 da9 4000 If you are using the normal FreeBSD installation process (known as /stand/sysinstall) then you can create this collection of mount points by doing the following: 如果你是使用標準的 FreeBSD 安裝步驟(也就是 /stand/sysinstall),接著你 可以用下列方式作出設備的集合: After the operating system boots from the 'kern' and 'mfsroot' floppies, you will arrive at the '/stand/sysinstall Main Menu'. Select #4, custom, and press 'enter'. 在作業系統利用 kern 和 mfsroot 磁片開機後,你會進入 /stand/sysinstall 主畫面,選擇 #4(custom) 然後按 enter。 Select choice 2, Partition, and press 'enter'. 選擇 2 (Partition) 然後按 enter。 If all of your disks are correctly attached to your SCSI chain, and are working, you will see a list of all 10 disks, with a check box next to each. Select the first disk - you will be taken inside of the 'FDISK Partition Editor'. Delete any existing partitions and then press the 'A' key - you will be asked about 'dangerously dedicated disks' - answer 'No'. Then press 'Q'. 如果所有的硬碟都正確的連結到你的 SCSI 串列上並且開始運作,你會看到所有 10顆硬碟的列表,每個旁邊都有一個核對框。選擇第一顆硬碟,就會進入硬碟分割編 輯(FDISK Partition Editor)裡。請將所有現存的硬碟分割刪除,然後按 A 鍵,你將 會被詢問關於危險的專用硬碟(dangerously dedicated disks)的問題,請回答 No, 然後按 Q。 Do this for each of the ten disks. 請對這10顆硬碟一一進行同樣動作。 You will now be back at the 'Choose Custom Installation Options' screen. Choose 'Label' and press 'enter'. 接著你會回到 'Choose Custom Installation Options' 的畫面,請選 Label, 然後按 enter。 You will now be inside the 'FreeBSD Disklabel Editor'. In this interface, you can choose each disk one at a time, and press the 'C' key to create a partition. First, you will choose da0 and press the 'C' key - you will be asked to enter a size - enter '500M' for 500 megabytes, then press enter. You will be asked if this is a filesystem or a swap partition - choose filesystem and press enter. You will then be asked to enter a mount point. You should enter '/' and press return. 現在你進入 FreeBSD 磁碟標籤編輯器 (Disklabel Editor)裡,在這個介面, 你可以一次選擇一顆硬碟,然後按 C 鍵來建立一個分割。首先你選擇 da0,然後按 C 鍵,接著要求你輸入大小,請輸入 500M 代表 500MB,然後按 enter。接著會問你 這是檔案系統還是作虛擬記憶體交換(swap)的分割,選擇檔案系統(filesystem),然 後按 enter。接下來會要你輸入設備的指標,你必須輸入 / ,然後按 enter。 You should do this for each partition that is listed in the table above. 請依照上面那個列表,對每一個硬碟分割作上面的動作。 2. Install the ports collection. If you are installing from scratch, this is easy to do - if you have already installed, you can also add them. 2. 安裝 ports 集合。如果你是從小惡魔(scratch)安裝的,這會很簡單。如果你已經 安裝好了,你也把它們再加進去。 NOTE: It is highly recommended that you install the INN port and install INN using the port - you can, of course, pkg_add the INN package, but you will find that this method does not create all of the directories and file permissions that this document and the instructions in here assume exist. Further, the process of creating all of the structures that the pkg_add method leaves out is long and prone to errors. Installing the INN package via the pkg_add tool is beyond the scope of this document. 注意:強烈建議你安裝 INN 的 port,並及使用 port 來安裝 INN。當然,你也可以 用 pkg_add 來安裝 INN 套件,但你會發現,這樣沒法建構出本文裡所假定會 存在的所有的次目錄與檔案許可權限。此外,使用 pkg_add 法來安裝所有的 結構,會花很長的時間,而且很容易出問題。用 pkg_add 來安裝 INN 套件已 經超過這份文件的範圍了。(按:意思就是說,想玩的自己去找資料吧?) 3. Install INN. Do this by issuing the commands: 3. 安裝 INN 系統程式 (become root) cd /usr/ports/news/inn-stable make install 4. use the 'vipw' command and check the entry for the 'news' user. Make sure the entry looks exactly like this: 4. 使用 'vipw' 指令檢查 'news' 這位使用者的登錄碼,確定它看起來像下面這樣: news:*:8:8::0:0:News Subsystem:/usr/local/news:/bin/sh If it does not, change it so that it does. 如果不是的話,就把它改成那樣子。 5. Place your active file into /usr/local/news/db 5. 把你的執行中檔案 (active file) 放到 /usr/local/news/db 次目錄 Note: the file named 'active' is something that you need to get from your upstream news feed. Sometimes they have the file available via ftp on whatever machine the news feed is on, and sometimes you need to contact your feed and request it. 註:這個叫做[執行中(active)]的檔案你必須從你的上游news取得,有時也可以從透 過 ftp 從上游那邊的機器上取得,但有時你必須與上游管理員聯繫請他提供。 Note: You may wish to edit the active file that your news feed gives to you. 註:上游給你的這個執行中檔案你可能需要修改一下。 Note: Remember to use binary mode when transferring the active file via ftp. 註:如果你是透過 ftp 來傳送執行中檔案,記得要使用二進位模式傳送。 If you have no way of getting an active file, but would like to get the server up and running, you can just make a file containing the following lines: 如果你沒有管道可以取得執行中檔案,但又想要讓news server可以運作(誰不想?) 你可以自己做一個檔案,裡面包含下面兩行: control 0000000000 0000000001 n junk 0000000000 0000000001 n 6. Issue the command: chown news:news /usr/local/news/db/active 6. 執行這個指令: chown news:news /usr/local/news/db/active 7. Issue the command: chmod 0664 /usr/local/news/db/active 7. 執行這個指令: chmod 0664 /usr/local/news/db/active 8. Issue the commands: 8. 執行這幾個指令: cd /usr/local/news/db /usr/local/news/bin/makeactive -m -o >active.new touch /usr/local/news/lib/history su news -c "/usr/local/news/bin/makehistory -n -f history.n || echo bad" su news -c "/usr/local/news/bin/makehistory -r -i -f history.n && echo good" mv history.n history mv history.n.dir history.dir mv history.n.pag history.pag 9. We now need to make a spool file on each of the spool disks. In our example, the first spool disk is mounted at /mnt/da3 - the following commands will create the spool file for that disk: 9. 現在,我們要在硬碟庫中的每顆硬碟製作一個儲存檔。在範例中,第一顆儲存硬碟 指向 /mnt/da3,下面的指令可以做出這個硬碟的儲存檔: dd if=/dev/zero of=/mnt/da3/1 bs=1k count=4000000 Next, we make a spool file on /mnt/da4 接著,再作 /mnt/da4 硬碟的儲存檔: dd if=/dev/zero of=/mnt/da4/2 bs=1k count=4000000 And so on, until all of our spool disks have a single file that is roughly the size of the disk. 依此類推,直到所有儲存硬碟裡都有一個幾乎跟硬碟一樣大的儲存檔為止。 Note: There are a few things to keep in mind when creating these files. First, note that although we are operating on 'da3', the name of the file we create is '1'. On 'da4' the name of the file we create is '2'. This is completely arbitrary - we could very well name them 'one' and 'two', or 'green' and 'blue'. Second, I entered 4000000 as the size, but most likely the space available on your disk will not be exactly 4000000 kilobytes - issue the 'df' command and look at the space available on the disk, and then use that number. 註:再建立這些儲存檔時,有些事情必須注意一下。首先請注意,雖然我們是對 da3 作業,但我們所建立的儲存檔名稱是 1,在 da4 上建立的儲存檔是 2。這是隨 我們高興的,我們也可以把它們命名為 one 及 two,或者 green 及 blue。 其次,我輸入 4000000 當作檔案大小,但是你的硬碟上面的空間不會剛好就是 4000000KB,你可以用 df 指令來看硬碟的可用空間,然後再用那個數字。 10. edit the file /usr/local/news/etc/inn.conf and edit the following lines: 10. 編輯 /usr/local/news/etc/inn.conf 檔案的下面幾行: organization = (put the name of your organization here) server = news.example.com pathhost = news.example.com moderatormailer = news@example.com domain = example.com fromhost = news.example.com storageapi = true (not all of these values are right next to each other - you may have to search for them) (You can leave all the rest of the values at their defaults) (這幾行不會剛好都排列在一起,你得自己找一下) (其他的你可以保留預設值) 11. edit the file /usr/local/news/etc/newsfeeds 11. 編輯 /usr/local/news/etc/newsfeeds 檔案 Find the ME\ line and replace it with this: 找到 ME\ 這一行,然後改成這樣: ME\ :*,!junk,!local*,\ /world,usa,na,gnu,bionet,pubnet,u3b,eunet,vmsnet,inet,ddn,k12\ :: Find the innfeed!:\ line and replace it with this: 找到 innfeed!:\ 這一行,然後改成這樣: innfeed!:\ !*,\ :Tc,Wnm*,S30000:/usr/local/news/bin/startinnfeed Add the following to the end of the file: 在檔案最後面加上這幾行: news.upstream.com/news.upstream.com\ :\ :Tm:innfeed! Make sure this line exists, or is uncommented if it already exists: 確定這一行存在,或者雖存在但是沒有標註: overview!:*:Tc,Ao,WhR,S30000:/usr/local/news/bin/overchan Note: If you wish to customize these rather generic values I have for ME\ and innfeed!:\, please read the man page for newsfeeds (there is one - man newsfeeds) 註:如果你想自己修改我在 ME\ 與 innfeed!:\ 這部分設定的常用值,請自行參考 newsfeeds 的 man 說明頁。 (這樣就有一份了 - man newsfeeds) 12. edit the file /usr/local/news/etc/motd.news 12. 編輯 /usr/local/news/etc/motd.news 檔案 (place whatever you would like in your news server message of the day) (把它改成你希望你的 news server 一整天裡面會出現的訊息) 13. edit the file /usr/local/news/etc/incoming.conf 13. 編輯 /usr/local/news/etc/incoming.conf 檔案 Add these lines: 加上這幾行: peer verio { hostname: "news.upstream.com, 20.20.20.20" } 14. edit the file /usr/local/news/etc/innfeed.conf 14. 編輯 /usr/local/news/etc/innfeed.conf 檔案 Add these lines: 加上這幾行: peer verio { ip-name: news.upstream.com } 15. edit the file /usr/local/news/etc/nnrp.access 15. 編輯 /usr/local/news/etc/nnrp.access 檔案 nnrp.access allows you to specify what hosts and address classes are allowed to talk to your news server. If you would like only a few IPs to be able to read news using your server, then just list those servers like this: 這個 nnrp.access 檔允許你指定哪個主機或IP等級可以與你的 news server 對 話。如果你希望只有少數幾個 IP 可以使用你的 news server 讀取資料,就只要 像下面這樣把它們列出來就行了: 192.168.2.3 192.168.99.34 sdca-dialup.line48.pool2.home.com If there is an entire address class that you would like to allow to use the server, you can enter address classes like this: 如果你想讓整個 IP 網段都能使用你的 news server,你可以這樣設定: 192.168.5.0/24 192.168.7.96/27 Or you can mix and match, like this: 或者你也可以像這樣混合起來用: 192.168.99.34 sdca-dialup.line48.pool2.home.com 192.168.7.96/27 Note: if the news server is currently running, you can add new addresses and address classes to the nnrp.access file without restarting the server. They will take affect immediately after the file is saved. This is not true for most of the configuration files in /usr/local/news/etc 註:如果 news server 正在運作中,你也可以在 nnrp.access 檔裡加入新的網址或 網段,而不需要重新啟動伺服器,在存檔後就會立刻生效。這個對於大部分的 /usr/local/news/etc 裡的設定檔可不一定適用。 16. edit the file /usr/local/news/etc/cycbuff.conf 16. 編輯 /usr/local/news/etc/cycbuff.conf 檔案 The cycbuff.conf is where you list all of the spool files that you created in step #9. There are two sets of entries in cycbuff.conf. The first set of entries is a listing of spool files where you define a logical name (alias) for each spool file. The second set of entries is where you define one or more 'meta buffers' (collections of spool files that will work together) 這個 cycbuff.conf 檔讓你放置在步驟 9 中所設的儲存檔清單。cycbuff.conf 檔中有兩組記錄,第一組記錄你定義在每個儲存檔的邏輯名稱(alias)所在位置 清單,第二組記錄則定義一或多個異緩衝區(meta buffers,是一群會一起作業 的儲存檔的集合)。 So, in our example, we have 7 disks that have spool files on them (that we made in step #9). We define each of these in cycbuff.conf as follows: 因此,在範例中,我們有 7 顆上面有儲存檔的硬碟(在步驟 9 製作的),在 cycbuff.conf 檔中對這些硬碟定義如下: cycbuff:1:/mnt/da3/1:4000000 cycbuff:2:/mnt/da4/2:4000000 cycbuff:3:/mnt/da4/3:4000000 cycbuff:4:/mnt/da4/4:4000000 cycbuff:5:/mnt/da4/5:4000000 cycbuff:6:/mnt/da4/6:4000000 cycbuff:7:/mnt/da4/7:4000000 In this example, we have given a logical name of '1' to the spool file /mnt/da3/1, and we specified that it has a size of 4000000 kilobytes. (remember what we said about the size of these files - your actual 'dd' commands from step #9 may be with a smaller size, even if you have a 4 gigabyte disk) 在此範例中,已知有個邏輯名稱為 1 的儲存檔 /mnt/da3/1,而我們指定它的大 小為 4000000 KB。(記得我們前面提到關於檔案大小的事,就算你的硬碟真的是 4GB,在步驟 9 中你在 dd 指令裡實際設的值可能也會比較小。) The next set of entries in cycbuff.conf are the meta buffers. In this example, we are going to dedicate four disks to all news _except_ the alt.binaries heirarchy, and dedicate three disks to _only_ the alt.binaries heirarchy. cycbuff.conf 的下一組記錄是異緩衝區。在範例中,我們提供 4 顆硬碟給除了 alt.binaries 的所有群組,3 顆硬碟只給 alt.binaries 的群組使用: metacycbuff:NOTBINRY:1,2,3,4 metacycbuff:BINARIES:5,6,7 The logical names 'NOTBINRY' and 'BINARIES' are completely arbitrary - you can name them anything you want - it is in the next step that we will show you how to tell the news server which groups should go in which meta buffer. 這裡的邏輯名稱 NOTBINRY 和 BINARIES 看你高興怎麼設都可以,下一個步驟我 會說明,如何告訴 news server 哪些群組應該丟到哪個異緩衝區才對。 Note: there is a bit of folklore going around regarding the size of the logical names that you can use for cycbuffs and metacycbuffs in the cycbuff.conf file - apparently there were several buggy versions of INN that misbehaved if these logical names were larger than eight or nine characters. I suspect this is no longer the case, but I have tested the eight character metacycbuff names in the example above and they did work. It is not really an issue for the cycbuff names above, as they are only one character long. I really doubt this bug still exists, but if you want to be safe, make your logical names shorter or equal to the example given here. 註:關於你可以在 cycbuff.conf 檔使用 cycbuffs 與 metacycbuffs 等邏輯名稱的 大小有個傳說∼邏輯名稱若超過 8 或 9 個字以上就會出問題,這顯然是幾個有 問題的 INN 版本所造成的。我懷疑現在是否已經沒有這個問題了,因為我曾利用 上面的範例測試過八個字元的 metacycbuff 名稱,而且確實可用﹔但對 cycbuff 名稱來,當它只有一個字元長度時就會有問題。因此我懷疑這個問題仍然存在, 如果你希望安全一點,請將你的邏輯名稱設為跟上面的範例一樣或更短。 17. edit the file /usr/local/news/etc/storage.conf 17. 編輯 /usr/local/news/etc/storage.conf 檔案 storage.conf is where we specify what groups should be spooled into which meta buffers that we defined (NOTBINRY and BINARIES) in step #16. storage.conf 可以讓我們指定哪個群組的資料應該放到我們在步驟16利用 NOTBINRY 和 BINARIES 所定義的哪個異緩衝區裡面。 method cnfs { newsgroups: alt.binaries.* class: 1 size: 0,1000000 options: BINARIES } method cnfs { newsgroups: * class: 2 size: 0,100000 options: NOTBINRY } Both should have a method of 'cnfs' specified, size is in kilobytes, and the options field should have the name of the meta buffer. The class field has a non-zero integer value that specifies in which order these methods should be interpreted. News articles are sifted through these rules like a sieve - if an article goes through the whole list andd matches nothing, it is just dropped and not accepted at all. For instance, in this example, if an article from the alt.binaries heirarchy were larger than 1000000 kilobytes, it would fail the first rule, then move onto the second rule - as far as newsgroups are concerned (*) it passes the first rule, but again, it fails the size test which is even smaller in that rule than in the first rule. The article is not accepted. In this case, the class field is not very important, because of how simple this ruleset is, but there are more complex rulesets where certain articles might be accepted by more than one ruleset, and it is important to make sure they sift through the rulesets in the correct order. 在上面的例子中都指定使用 cnfs 法,大小單位是 KB,而 options 欄位則為異 緩衝區的名稱。class 欄位中有個非 0 的整數值,以標明這些方法的先後順序。 News的文章會像通過篩子一樣的被這些規則所過濾,如果某篇文章通過整個規則 表而沒有符合其中任何一項,它就會被丟棄而不被接受。例如,假設有篇來自 alt.binaries 的文章,大小超過 1000000 KB,它就不符合第一個規則,而套用 第二規則。但雖然它通過群組(*)的要求,卻還是無法通過大小的要求,因為第二 規則比前面要求的大小範圍更小,因此這篇文章就不被接受。在這個例子中,class 欄位並不很重要,因為規則實在太簡單了,但規則可以定得很複雜,使得文章可 能同時符合好幾個規則,這時提供一個正確的篩選順序就很重要了。 18. For each spool file you created with the 'dd' command in step #9, chown the file to news:news and chmod it to 0664. For example: 18. 對每一個你在步驟 9 利用 dd 指令所建立的儲存檔,將之 chown 為 news:news, 並且將之 chmod 為 0664。例如: chown news:news /mnt/da3/1 chmod 0664 /mnt/da3/1 Do this for all of your spool files. 對每個儲存檔都要這樣做。 19. Run this command: 19. 執行此指令: /usr/local/news/bin/inncheck Make sure to fix any problems that this program reports. 這個程式會回報錯誤訊息,確定都排除了。 20. Run this command to start your server: 20. 執行這個指令來啟動你的 news server: /usr/local/news/bin/rc.news If the log reports that there was a problem with initialization, stop the INN programs (innd, inncheck, innwatch, etc.) and run just innd by itself: 如果 log 檔出現在起始化時有問題的紀錄,停止執行 INN 程式(如 innd, inncheck, innwatch等),然後只執行 innd 本身就好了: /usr/local/news/bin/innd then kill it after a while and retry rc.news. After starting it up a few times it should run without complaints. 接著,執行過一陣子後將它殺除,然後重新執行 rc.news。 在啟動幾次之後, 應該就不會再有什麼問題了。 The news server is now running, and should immediately begin collecting news from the upstream news server. At this time you should be able to connect with a news client and read articles.   現在 news server 已經在運作了,馬上就會開始從上游收集文章過來。這時你應 該可以用 news 軟體連上來讀取文章。 NOTE: Remember that the IP you are running the client on needs to exist in the nnrp.access file. 註:記住,你執行 news 軟體的位址必須出現在 nnrp.access 檔中。 There are certain maintenance activities that must occur on a daily basis to keep the news server running smoothly. These activities are contained in the program /usr/local/news/bin/news.daily   要維持 news server 運作順暢,必須收集每天的運作狀況,這些活動資訊放在這裡: /usr/local/news/bin/news.daily The following steps will set this maintenance up:   以下步驟將設定這個維護的動作: 1. make a shell script called 'news.maintenance' with the following lines in it: 1. 製作一個叫 news.maintenance 的殼層 script 檔,裡面包含下面幾行: /usr/local/news/bin/news.daily /usr/local/news/bin/shrinkfile /var/log/news/news date >> /usr/local/news/news.maintenance.log save this file in /usr/local/news 將這個檔案儲存到 /usr/local/news 裡。 2. execute the following command: 2. 執行下列指令: chmod +x /usr/local/news/news.maintenance 3. create the file /usr/local/news/crontab with the following line: 3. 製作一個 /usr/local/news/crontab 檔案,裡面包含這一行: 1 1 * * * /usr/local/news/news.maintenance 4. execute the following command: 4. 執行下列指令: crontab -u news /usr/local/news/crontab Now news.daily will run at 1:00 every day, and will enter a time and date into the file 'news.maintenance.log' when it completes. This is helpful because this log of completion time will let you know how long this daily process is taking - and allow you to make changes if you feel it is taking too long.   現在,news.daily將會在每天凌晨 1 時執行,當執行完畢後就會在 news.maintenance.log 檔裡面輸入時間和日期。這是很有用的,因為這個完成時間的紀錄可以讓你知道這個 每天定期處理的過程花了多久的時間,如果你覺得時間太久了,也可以讓你做改變。 Appendix A: References 附錄 A:參考文獻 (I only list references that I personally have used, so please do look for information sources on your own if you find this list lacking) (這邊我只列了一些個人用過的文獻,因此如果你覺得不夠的話,請自己去找你需要的吧) man pages 系統提供的 man pages Almost every file listed in this document, in addition to the commands, have man pages. When you install INN, man pages are added for each configuration file covered by this document (nnrp.acccess, storage.conf, etc.) 在本文件中所提到的檔案,除了命令外,幾乎都有 man pages 可以參考。當你安裝 INN 時,man pages 會附加到本文所提到的每個檔案中,像是 nnrp.acccess, storage.conf 等等。 books 參考書籍 Configuration and Capacity Planning for Solaris Servers Brian Wong ISBN: 0133499529 Although this is a book on Solaris servers, there is a chapter that covers capacity planning for news servers. It is a small amount of information, so if you do not have the book, I would not suggest buying it for just this purpose - however if you do have the book, you might check the chapter that deals with Internet Servers - News is one of them. 雖然本書是為 Solaris 伺服器寫的,但其中有一章提到了對於 news server 的容 量規劃。這部分並不多,所以如果你沒有這本書,我並不建議你只為了這部分去買。 不過如果你弄到這本書,你可以看看關於網路伺服器的那個章節,News 是其中之一。 web references 網路資源 http://www.isc.org/products/INN/ This is the official page for the INN package. 這是 INN 軟體的官方網頁 mailing lists 電子通訊 http://www.isc.org/services/public/lists/inn-lists.html Appendix B: Notes 附錄 B:備註 We mentioned the 9:1 ratio of spool space to overview space, and although we did not use that ratio in our example (we used a 7:1 ratio which is even better). 9:1 should be fine, given a mixed article set (see the comments in the section Overview vs. Articles). However, if you get the ratio wrong, and you find that your overview (/var filesystem) is about to fill up, you can do the following as an emergency action: 前面我們提到 9:1 的硬碟庫與概要檔大小比例,雖然在範例中我們並沒有使用這個比例(我 們用的是 7:1 的比例),但 9:1 的比例對於混合型的文件來說,應該是比較適合的(請參閱 概要與文件那部分的說明)。然而,如果你用了錯誤的比例,並且發現你的概要檔 (/var) 快 爆滿了,你可以利用下列步驟作為應變措施: 1. kill all of the news processes 1. 終止所有執行中的 news 程序 2. set a small expiration time in /usr/local/news/etc/expire.ctl 2. 在 /usr/local/news/etc/expire.ctl 設定較短的截止時間 It is usually set to /remember/:10 by default - set it to something like /remember/:5 預設值通常設為 /remember/:10,可以改為 /remember/:5 之類的值。 3. run the command: 3. 執行此指令: /usr/local/news/bin/news.daily notdaily flags='-v1 -n -N' 4. restart the news processes: 4. 重新啟動 news 程序: /usr/local/news/bin/rc.news This is not a good way of dealing with the problem - it _will_ clean out your overview and give you some more space to work with, but there are some negative effects of this action. Disk space is cheap and plentiful, so if you don't want the headache, set a 7:1 ratio. 這並非處理問題最好的方法,這樣將會清除你的概要檔,然後給你較多的空間,但會有一些 副作用。現在硬碟其實便宜又大碗,因此如果你不希望日後傷腦筋,還是用 7:1 吧。 John Kozubik - john@kozubik.com - http://www.kozubik.com