Hiển thị các bài đăng có nhãn Tips. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Tips. Hiển thị tất cả bài đăng

16.5.15

Những Web chia sẻ torrent hàng đầu

https://heomephim.wordpress.com
Đối với tất cả những người đam mê phim thì phương thức chia sẻ file bằng torrent đã không còn xa lạ, nhưng không phải ai cũng biết cách tìm file torrent một cách nhanh nhất và chất lượng nhất. Bài viết đầu tiên của tôi trong mục “Sub – torrent – mẹo” này sẽ giới thiệu với các bạn những trang web chia sẻ torrent tốt nhất mà tôi đã từng dùng qua.
Trang web đầu tiên mà không ai có thể bỏ qua là : http://thepiratebay.se/
Pirate-Bay
Tuy nhiên trang web này lại là một mớ hổ lốn với đủ thứ thể loại, gần như muốn kiếm cái gì cũng có với mọi chất lượng khác nhau. Điều này sẽ khiến cho newbie gặp nhiều rắc rối khi down phim về, đặc biệt là bản phim sẽ không khớp time với Sub. Để chắc chắn thì các bạn nên đọc các comment của những người đã down bản phim này về trước đã.
Trang web thứ 2 là: http://torrentz.eu
Đây là một trang web khá tốt, tôi cũng từng tìm file torrent từ trang web này, tuy nhiên tôi thấy bản chất nó chẳng phải là một trang web chia sẻ một đúng nghĩa. Nó giống như GOOGLE vậy, nhưng lĩnh vực của nó chỉ trong phạm vi tìm kiếm các torrent file. Khi bạn tìm kiếm một bộ phim tại trang web này thì nó sẽ đưa cho bạn rất nhiều đường dẫn tới những trang web chia sẻ torrent “đích thực khác”.
Đứng thứ 3 là: http://kickass.to
Trang web này cũng khá tốt, nó có giao diện khá dễ nhìn khi bạn muốn tìm một torrent nào đó. Khi bạn đánh tên của một bộ phim nào đó thì nó sẽ hiện lên một list những cái tên gần giống (kiểu tìm kiếm của google vậy), vì vậy bạn chỉ cần nhớ những chữ cái đầu tiên của bộ phim thôi cũng đủ rồi.
Đứng thứ 4 là: http://extratorrent.com, trong thời kỳ đầu khi tôi làm quen với torrent thì tôi cũng vào trang web này, tuy nhiên gần đây tôi chưa vào lại nó lần nào – chỉ vì nó quá xấu. File torrent tại trang web này cũng khá phong phú, không thua kém các trang web ở trên là mấy.
Thứ 5 là: http://yify-torrents.com/ hoặc một tên miền khác là https://yts.re/
Movies4free
Trang web này không nằm trong cùng nhóm với những trang web ở trên (những trang web trên là tập hợp một mớ hổ lốn lấy từ nhiều chỗ khác nhau), tại trang web này khi bạn tìm một bộ phim thì nó sẽ chỉ hiện lên cho bạn có tối đa là 3 kết quả (một bản 720p, một bản 1080 và một bản 3D – nếu có). Điều đáng chú ý là những bộ phim ở đây đều là những bộ phim có lượng seed và leed rất cao, dung lượng của một bản phim bản 720p giao động giữa 550Mb tới 900Mb, rất nhẹ nhưng chất lượng thì lại khá tốt; đương nhiên là nó sẽ không sắc nét như các bản 720p có dung lượng tới 4Gb; nhưng tôi dám chắc các bạn sẽ khó nhận thấy sự khác biệt này nếu xem phim bằng laptop. Hiện nay hầu như tôi chỉ down phim từ web này!
Và cuối cùng là hai trang phim khá nổi tiếng của Việt Nam là http://kitesvn.com và http://kst.vn, Filie torrent tại hai trang web này không phong phú như những trang web ở trên, tuy nhiên chất lượng của các bộ phim tại đây khá tốt, đặc biệt là sub tiếng Việt sẽ được add sẵn vào phim, bạn sẽ không phải lăn tăn vào việc tìm sub khớp time. Tại hai trang web này bạn thường chỉ có thể down những bộ phim bom tấn hoặc được phát hành trong thời gian gần đây.
Bài viết này chủ yếu dựa trên những kinh nghiệm cá nhân vì vậy sẽ không tránh khỏi thiếu sót, rất mong có được sự góp ý của các bạn.
NOTE QUAN TRỌNG
Vì các trang web chia sẻ torrent có rất nhiều link vi phạm bản quyền, nên nó là cái gai trong mắt những nhà kinh doanh phim, nhạc, chính quyền một số nước,… Vì vậy tên miền của chúng có thể bị thay đổi. Ví dụ như link Thepiratebay.se không còn tồn tại mà sẽ thay thế bằng Thepiratebay.cr hoặc Thepiratebay.te, hayKickass.to đổi thành Kickass.so chẳng hạn. Trong trường hợp bạn không thể tìm tền miền đúng của nó, hãy comment tại topic này, mình sẽ hỗ trợ trong khả năng có thể. :)
***Bài viết này là sản phẩm cá nhân, nếu có copy sang các forum hay blog khác làm ơn ghi rõ nguồn!
ĐÓNG GÓP CỦA BẠN ĐỌC – MÌNH RẤT MONG CÓ THẬT NHIỀU ĐÓNG GÓP CỦA CÁC BẠN :)
Thứ 6 là: http://phimtorrent.com/ (Do đóng góp của bạn Hien)
“Gần đây mình hầu như chỉ dùng trang này để down phim, phim cập nhật nhanh, chất lượng cao với nhiều mức chất lượng khác nhau cho bạn lựa chọn và hầu hết có subviet đầy đủ.http://phimtorrent.com/
Gần đây mình hầu như chỉ dùng trang này, phim cập nhật nhanh, 2D 3D có cả, chất lượng cao với nhiều mức chất lượng khác nhau cho bạn lựa chọn và hầu hết có subviet đầy đủ.”
Đánh giá của HMP về trang web này: Thực chất ra là nó lấy phim từ các trang torrent nước ngoài sau đó việt hóa nó rồi up lại lên mạng. Uhm, một công việt rất đáng hoan nghênh. Nó sẽ rất tiện cho các bạn, không phải tìm sub và lăn tăn việc sub lệch time. Tuy nhiên cũng có điểm hạn chế là lượng seed hạn chế, do gần như chỉ được chia sẻ trong cộng đồng người Việt, phim bom tấn chắc chắn sẽ vẫn nhanh nhưng những bộ phim đã cũ thì tốc độ download sẽ chậm, thậm chí không bao giờ có thể download được 100%. Thêm một cái nữa là sub đã được add sẵn nên sẽ khiến một số khán giả khó tính không hài lòng về chất lượng dịch thuật lẫn văn phong, bạn vẫn có thể tìm sub khác add vào nhưng nó sẽ đè lên hard sub có sẵn trong phim, xem khá khó chịu. Nhưng mình tin là hầu hết tất cả sub phim đều được khảo sát qua kỹ càng nên sẽ không làm bạn thất vọng đâu. Chúc vui!
Thứ 7 là: http://btdigg.org/ (Do đóng góp của bạn nguyen)
“lâu nay mình chỉ tìm phim torrent ở trang http://btdigg.org. giao diện đẹp, dễ nhìn và vì là trang tổng hợp nên nội dung phong phú hơn hẳn thepiratebay va kickass.”
Đánh giá của HMP về trang web này: Giao diện rất đơn giản, khi bạn tìm một tên phim nó sẽ hiện ra một danh sách rất nhiều torrent và ưu tiên file torrent phổ biến nhất lên đầu, bạn có thể chọn những cách sắp xếp khác như theo số file, kích cỡ,… Ngoài phim ra nó cũng chia sẻ cả sách, phần mềm,… Khi tìm kiếm thông tin về trang web này trên mạng HMP thấy rất ít thông tin về nó, nhìn chung đây không phải là một trang web nằm trong top đầu, vẫn chưa down file nào của nó về xem thử nên bạn nào đã dùng qua trang này thì cho mình xin thêm ít thông tin và cảm nhận của bạn nhé. Cảm ơn nguyen nhiều nhé :)
Thứ 8 là: http://torrentbutler.eu/ (Do đóng góp của bạn Quốc Anh)
“trang này có giao diện đẹp,dễ sử dụng và lựa chọn lắm =)) nhưng nó chỉ là trang tổng hợp phim torrent của các web khác,mình dùng thấy Ok nên chia sẻ vs mấy bạn”.
Đánh giá của HMP về trang Web này: Chỉ cần nhìn qua đã biết là chuyên trang về torrent phim rồi, giao diện thoáng nhìn qua cũng thấy khá hấp dẫn. Trên trang chủ của nó toàn là danh sách những bom tấn không à. Đúng như Quốc Anh nói, đây à trang tổng hợp phim, và sử dụng rất dễ dàng, khi bạn tìm một bộ phim nó sẽ hiện lên cho bạn những link torrent có nhiều người chia sẻ nhất, điều này rất đảm bảo cho các bạn sẽ tìm được một bản phim chất lượng trong thời điểm hiện tại – chất lượng khộng có nghĩa là HD, mặc dù nó quảng cáo là như vậy, bởi trên trang chủ của nó có một số link bom tấn HD nhưng mình cũng đã khảo sát qua những trang torrent lớn khác và chỉ thấy có bản Cam mà thôi. Nếu bạn là một khán giả không quá khó tính thì cũng có thể tải nó về, chính bản thân mình cũng đã từng xem những bản quay lén trong rạp, chất lượng âm thanh hình ảnh một số bản vẫn có thể nghe và xem rõ. Cảm ơn Quốc Anh vì chia sẻ của bạn. :)
Click vào những Link dưới đây để khám phá kho tàng của HeoMePhim :)


15.6.12

Chuẩn viết code và thiết kế giao diện trong C#

CHUẨN VIẾT CODE VÀ THIẾT KẾ GIAO DIỆN TRONG C#

(Bản tóm tắt)

I.      QUY ĐỊNH ĐẶT TÊN

- Pascal                      BackColor
- Camel                      backColor
- Uppercase               BACKCOLOR

1.1.           Tên biến

- Kiểu Camel

1.2.           Tên hằng số

- Sử dụng Uppercase
- Gạch nối giữa các từ

1.3.           Tên kiểu Enum

- Tên kiểu Pascal
- Không tiền, hậu tố

1.4.           Tham số


- Tên kiểm Camel

1.5.           Tên thuộc tính

- Tên kiểu Pascal

1.6.           Tên phương thức

- Tên kiểu Pascal

1.7.           Sự kiện

- Kiểu Pascal
- Thường có hậu tố: EventHandler

1.8.           Tên lớp

- Tên kiểu Pascal
- Không sử dụng gạch chân

1.9.           Giao diện

- Tên kiểu Pascal
- Bắt đầu bằng tiền tố “I”

1.10.       Không gian tên

- Cú pháp: [Tên công ty].[Tên Công nghệ][.Đặc trưng][.Thiết kế]
Ví dụ: SDGVN.Web.Utility
SDGVN.Web.ModuleBase

1.11.       Tên tiền tố của các điều khiển

Control type Prefix Example
Panel pnl pnlGroup
Check box chk chkReadOnly
Combo box, drop-down list box cbo cboEnglish
Command button btn btnExit
Common dialog dlg dlgFileOpen
Control (used within procedures when the specific type is unknown) ctr ctrCurrent
Data dat datBiblio
Data-bound combo box cbo cboLanguage
Data-bound grid grd grdQueryResult
Data-bound list box lst lstJobType
 Repeater rpt drpLocation
Date Time Picker dtp dtpPublished
Form frm frmEntry
Frame fra fraLanguage
DataGridView dgv dgvPrices
GridView grd grdProduct
DataList dtl dtlOrders
Horizontal scroll bar hsb hsbVolume
Image img imgIcon
ImageList ils ilsAllIcons
ImageButton ibt ibtNext
HyperLink hpl hplHome
LinkButton lbt lbtClick
Label lbl lblHelpMessage
List box lst lstPolicyCodes
ListView lvw lvwHeadings
Menu mnu mnuFileOpen
Option button opt optGender
Picture box pic picVGA
Picture clip clp clpToolbar
ProgressBar prg prgLoadFile
RichTextBox rtf rtfReport
Slider sld sldScale
Spin spn spnPages
StatusBar sta staDateTime
Text Box txt txtLastName
Timer tmr tmrAlarm
Toolbar tlb tlbActions
TreeView tre treOrganization
UpDown upd updDirection
Vertical scroll bar vsb vsbRate
SqlDataSource sql sqlAccounts
LinqDataSource linq linqCategories

II.      THIẾT KẾ GIAO DIỆN

2.1.            Thiết kế form

Thiết lập Option Layout Settings của Form như sau:



  • Quy định kích thước Form
Luôn cố gắng đảm bảo tỷ lệ 4×3: Form rộng 4 thì cao 3 để đảm bảo cân xứng với màn hình.
  • Quy định kích thước Control
    • Chiều cao: sử dụng chiều cao mặc định sẵn của Control.
Trường hợp đặc biệt:
  • TextBox multi-lines: đảm bảo không bị che 1 phần của dòng
  • Button có image: đảm bảo hiển thị vừa đủ image 16×16 pixel
  • Độ rộng: tùy độ rộng của text
    • Đảm bảo nguyên tắc các TexBox, Combo trên cùng một Form có độ rộng thống nhất.
    • Đảm bảo nguyên tắc các Button trên tất cả các Form có độ rộng thống nhất, text trên Button không nên vượt quá 2 từ.
    • Nếu text trên Button gồm 2 từ trở xuống: bắt buộc sử dụng độ rộng mặc định (75).
    • Đối với những trường có độ rộng cố định hoặc ít khi thay đổi (ví dụ như trường có kiểu dữ liệu là Date thì độ rộng là cố định là 10 ký tự), tuân thủ theo quy định sau:
      •  Độ rộng control được binding với trường này chỉ được phép rộng đủ để hiện thị hết thông tin trong đó.
  •  Không được để độ rộng control vượt quá độ rộng của trường.
  • Lưu ý: Label đặt AutoSize=FALSE, TextBox đặt AutoSize=TRUE
  • Quy định khoảng cách giữa các Control
    • Các Control cách mép Form 01 ô grid (cả 4 phía).
    • TextBox, ComboBox cách Label dài nhất 01 ô grid
    • Các Control cách nhau 01 ô grid cả chiều dọc và ngang.
Riêng trường hợp sử dụng GroupBox có caption thì các Control bên trong GroupBox cách mép trên của GroupBox 02 ô grid. GroupBox không có caption khoảng cách vẫn là 1 ô grid. 
  • Diện mạo Control
    • Font & Color: sử dụng thiết lập mặc định. Chỉ thay đổi khi yêu cầu thiết kế chỉ rõ.
    • Hot track: thiết lập Hot track cho Button, Combo và DropDown.
    • Căn lề Text trên Control:
      • Chiều ngang (HAlign):
        • Chữ căn trái
        • Số căn phải
        • Riêng với Button thì luôn căn giữa.
        • Chiều dọc (VAlign): căn giữa (Middle)
  • Dóng Control
    • Label: dóng trái
    • Textbox, Combo: dóng đều hai bên
  • Tab Order:
    • Phải thiết lập Tab Order trên mọi giao diện (Form, Control, …) theo nguyên tắc: từ trái sang phải, từ trên xuống dưới.
    • Yêu cầu bắt buộc thiết lập TabOrder theo đúng thứ tự cho mọi Control trên Form, kể cả Control không focus vào được như Label, GroupBox, hay Control invisible. Lưu ý tuân thủ tuyệt đối quy định này vì nó phục vụ nhiều mục đích quan trọng như tạo shortcut key, valid required data, …
  • Anchor & Dock: phải thiết lập Anchor và Dock cho Control trên các Form, Container không cố định kích thước (Sizable).
  • Với thông tin yêu cầu người dùng không dược bỏ trống mà bắt buộc nhập (AllowNull = FALSE) thì Label cho thông tin đó phải sử dụng ký hiệu “(*)” ở cuối và thiết lập shortcut key.

2.2.           Quy định khi tạo MessageBox

- Caption: sử dụng Application.ProductName
- Icon:
  • MessageBoxIcon.Exclamation: dùng cho các trường hợp sau
    • Cảnh báo lỗi
    • Cảnh báo xóa dữ liệu
    • Cảnh báo nhập thiếu, nhập sai dữ liệu
    • MessageBoxIcon.Information: dùng cho các thông báo không có tính chất cảnh báo, ví dụ Kết quả Import, Thông tin về CSDL, …
- Nội dung Message: không được phép viết trực tiếp nội dung message mà phải dùng Resource (sử sụng hàm String.Format để truyền tham số cho Resource nếu cần).

2.3.           Quy tắc viết mô tả (comment) cho code

Sử dụng tiếng Việt có dấu (Unicode) để viết comment.
Comment cho Module, Class
Mỗi Module, Class cần có mô tả ngắn về mục đích của Module hay Class đó. Nội dung gồm:
Mục đích: Module hay Class thực hiện những công việc gì.
Người lập: Người tạo Module hay Class
Những biến/hàm quan trọng (không bắt buộc): Liệt kê tên các biến và hàm quan trọng trong Module/Class
Comment cho Method và Event
-      Tất cả các Method và Event phải có comment.
-      Comment cho Method/Event gồm hai phần:
  • Phần 1 (không bắt buộc): mô tả mục đích và diễn giải ngắn gọn ý nghĩa các tham số đầu vào, đầu ra.
Lưu ý: mô tả Method đó làm gì (What), không mô tả Method đó thực hiện thế nào (How).
Từ  VC# 2005 trở đi, Microsoft cung cấp sẵn một macro dành cho việc viết comment mục đích. Sử dụng như sau: gõ liên tiếp 3 dấu nháy đơn (‘) trên đầu mỗi Method.
Lập trình viên có thể không cần viết phần mô tả mục đích này với các Method/Event đơn giản, không phức tạp.
  • Phần 2 (bắt buộc): ghi thông tin về history tạo và sửa Method/Event đó (người tạo/ngày tạo, người sửa/ngày sửa). Thông tin này bắt buộc phải có với mọi Method/Event.
-      Mẫu comment cho Method/Event đơn giản:
// Created by (người tạo) – (ngày/tháng/năm tạo): diễn giải ngắn gọn mục đích// Modified by (người sửa 1) – (ngày/tháng/năm sửa 1): diễn giải việc sửa 1 // Modified by (người sửa 2) – (ngày/tháng/năm sửa 2): diễn giải việc sửa 2
//…
// Modified by (người sửa n) – (ngày/tháng/năm sửa n): diễn giải việc sửa n
Ví dụ
    // Created by lhhoa – 20/02/2008: hàm lấy khoảng thời gian là ngày đầu và ngày cuối của tháng trước// Modified by nvkieu – 25/02/2008: sửa lỗi gì đó // Modified by nqhoang – 27/02/3008: bổ sung gì đó
private void GetDateLastMonth(fromDate datetime, toDate datetime, currentMonth int, currentYear int)
{
if (currentMonth == 1)
{
fromDate = DateSerial(currentYear – 1, 12, 1);
toDate = DateSerial(currentYear – 1, 12, DaysInMonth(currentYear – 1, 12));
}
else
{
fromDate = DateSerial(currentYear, currentMonth – 1, 1);
toDate = DateSerial(currentYear, currentMonth – 1, DaysInMonth(currentYear, currentMonth – 1));
}
…………………………….
}
-      Mẫu comment cho Method/Event phức tạp:
/// <summary>/// Diễn giải mục đích ///</summary>
///<param name=”Tham số 1″>Diễn giải cho Tham số 1</param>
///<param name=”Tham số 2″>Diễn giải cho Tham số 2</param>
/// …
/// <param name=”Tham số n”>Diễn giải cho Tham số n</param>
/// <remarks>Nhận xét (nếu có)</remarks>
/// Created by (người tạo) – (ngày/tháng/năm tạo)
/// Modified by (người sửa 1) – (ngày/tháng/năm sửa 1): diễn giải việc sửa 1
/// Modified by (người sửa 2) – (ngày/tháng/năm sửa 2): diễn giải việc sửa 2
/// …
/// Modified by (người sửa n) – (ngày/tháng/năm sửa n): diễn giải việc sửa n
Ví dụ:
    /// <summary>/// Hàm lấy khoảng thời gian là ngày đầu và ngày cuối của tháng trước. /// </summary>
/// <param name=”fromDate”>Ngày đầu tháng trước</param>
/// <param name=”toDate”>Ngày cuối tháng trước</param>
/// <param name=”currentMonth”>Tháng hiện tại</param>
/// <param name=”currentYear”>Năm hiện tại</param>
/// <remarks></remarks>
/// Created by lhhoa – 20/02/2008
/// Modified by nvkieu – 25/02/2008: sửa lỗi gì đó
/// Modified by nqhoang – 27/02/3008: bổ sung gì đó
private void GetDateLastMonth(fromDate datetime, toDate datetime, currentMonth int, currentYear int)
{
if (currentMonth == 1)
{
fromDate = DateSerial(currentYear – 1, 12, 1);
toDate = DateSerial(currentYear – 1, 12, DaysInMonth(currentYear – 1, 12));
}
else
{
fromDate = DateSerial(currentYear, currentMonth – 1, 1);
toDate = DateSerial(currentYear, currentMonth – 1, DaysInMonth(currentYear, currentMonth – 1));
}
…………………………….
}
Comment cho đoạn Code
-      Những đoạn code phức tạp cần có comment gắn liền bên trên để chú giải.
-      Những đoạn code được sửa đổi (modified), bổ sung (added) hoặc rem (removed) bởi người không phải tác giả cần có comment rõ ngay tại nơi sửa đổi, bổ sung: người sửa, ngày sửa, mục đích.
-      Comment cho đoạn code áp dụng bắt buộc với các Base Form/Base Class/Base Control.

2.4.           Quy tắc phân nhóm (region) khi coding:

Phải sử dụng Region phân nhóm code để tiện cho việc sửa đổi, bảo trì.
Phân nhóm code theo cấu trúc như sau: (theo thứ tự bắt buộc, nhưng không bắt buộc có đủ tất cả các region)
      Declaration
      Constructor
      Property
      Method/Function
      Event
Tùy theo yêu cầu của các form, class và module, lập trình viên có thể chia nhỏ các Region chính trên thành các sub-region. VD: region Method/Function có thể chứa các region con sau:
Method/Function
Public
Overridable (trường hợp là base form/class)
Override (trường hợp là derive form/class)
Private
Other
Trường hợp form hoặc class có sử dụng các component độc lập (Security, Document, MassEmail,…) thì phải tạo các Region riêng cho từng component, chứa toàn bộ code liên quan đến việc tương tác với các component đó.

2.5.           Quy định bẫy lỗi khi coding

-      Bắt buộc bẫy lỗi (sử dụng try … catch) trong tất cả các Event của Form và Control trên Form.
-      Nghiêm cấm sử dụng cú pháp try … catch để che dấu lỗi (không xử lý gì sau từ khóa catch).

Bad!!!

Good!!!

2.6.           Quy định thiết kế Dataset:

-      Tên của Dataset khi visual design đặt như sau: “Dataset” + Mục đích. VD: DatasetDictionary, DatasetCAPayment, …
-      Số lượng DataTable trong một Dataset: quy định từ 10 trở xuống. Mỗi Dataset chỉ được phép có tối đa 10 DataTable. Khi thiết kế phải tách Dataset để đảm bảo nguyên tắc này. Nếu một Dataset có nhiều DataTable thì tốc độ load/save dữ liệu sẽ bị ảnh hưởng nghiêm trọng.

Nguồn: Internet

16.9.11

Fedora 14 FAQ

Fedora 14 FAQ

  1. What is this Fedora thing?
  2. What is the difference between Fedora and Red Hat Enterprise Linux?
  3. Is it unstable?
  4. Has it been released?
  5. Where can I find a list of all the programs that come with Fedora (a package list)?
  6. When is the next version of Fedora coming out?
  7. How can I help out the Fedora Project?

Installing Fedora

  1. Where do I get it?
  2. Can I install on ReiserFS or JFS?
  3. Can Fedora run on a 64-bit (AMD-64 or Intel-64) computer?
  4. Can I run Fedora on a Mac?

Using Fedora and Installing Software

  1. Where can I get software for Fedora?
  2. How do I install software in Fedora? (How to use yum or an RPM)
  3. Is there anything like apt for Fedora?
  4. How do I install a working Java plugin for my web browser?
  5. How can I install Flash in Firefox?
  6. How can I see PDF files inside my browser?
  7. How can I watch movies in my web browser?
  8. Can I use MSN Messenger/AIM/ICQ/Yahoo instant messaging in Fedora?
  9. Can I install the standard Windows fonts on Fedora?
  10. Where can I get drivers for my hardware for Fedora?
  11. How do I read my NTFS (Windows NT/2000/XP/2003) drive in Fedora?
  12. How do I edit the menus in the panel?
  13. How do I install Wine?
  14. How do I play DVDs in Fedora?
  15. How do I play MP3s in Fedora?

Problems and Their Solutions

  1. I get a NOKEY warning from RPM, or I get a gpg signature error when using yum!
  2. How do I enable 3D support for my ATI Radeon card in Fedora?
  3. How do I enable 3D support for my nVidia graphics card in Fedora?
  4. The installer's media check says all my CDs are bad!
  5. I have strange installation problems.
  6. I can't access my Windows network shares anymore! People tell me to use the smbmount command, but it doesn't work!
  7. Y is ur f4q so dum n bad?

The FAQ

About Fedora

  1. Q: What is this Fedora thing?
    A: First, read About Fedora. You can also read the Fedora Project FAQ, if you want. Now, I'll give you a summary:
    Fedora is a Linux distribution from Red Hat that doesn't cost any money, includes only open-source software, and always includes the latest versions of software.
    Fedora is a community-supported project. That means that you can be involved in creating Fedora, if you want.
    A new version of Fedora comes out every six months or so. When a new version comes out, the previous version becomes unsupported about a year later. This means re-installing your OS every 6 - 8 months (currently upgrades between Fedora versions don't go so well).
    The advantage of using Fedora is that you're always on the cutting edge of Linux development, more so than any other major distro, while still having a stable operating system.
    Red Hat Enterprise Linux is based on Fedora, so if you want to learn a little about RHEL for free, use Fedora. RHEL6 was based on Fedora 13.
  2. Q: What is the difference between Fedora and Red Hat Enterprise Linux?
    A: Red Hat Enterprise Linux is officially supported by Red Hat for 7 years. It's a better choice if you're running important machines in production, and you don't want to upgrade your OS all the time. It also has many nice features that are useful if you are running more than a few servers. Also, you can (sometimes) actually call Red Hat and get support for RHEL, which you will never be able to do for Fedora.
    Fedora is distributed for free, and RHEL costs money.
    Fedora is much more cutting-edge than RHEL is, and Fedora has a larger community of users willing to help out and give free support (like this web page).
    Red Hat also has a cool page that answers this question.
  3. Q: Is it unstable?
    A: No!
  4. Q: Has it been released?
    A: Yes! Fedora 14 was released on November 2, 2010. To see when new releases are coming out, see the release schedule.
  5. Q: Where can I find a list of all the programs that come with Fedora (a package list)?
    A: There's a list of the main Fedora packages over at the Distrowatch Fedora Page. You can see a list of all the Fedora 14 packages in the Fedora Package Database.
  6. Q: When is the next version of Fedora coming out?
    A: A new version of Fedora is released every 6 - 8 months. Specific dates are usually in the Release Schedule. (Thanks to Tom Van Vleck for suggesting this question.)
  7. Q: How can I help out the Fedora Project?
    A: The Fedora Project needs a lot of people to help in a lot of areas! Can you write documentation? Can you code? Do you know anything about bugs? Can you translate? Would you like to learn about any of these? Are you artistic? Do you just want to help out in any way you can? The Fedora Project has a great page that describes how you can help. Check it out!

Installing Fedora

  1. Q: Where do I get it?
    A: The Fedora Download Page. There are many versions:
    The "Live Media" is a LiveCD--you can just put the CD into your computer and start the OS without installing it. You can also use the LiveCD to install a very basic version of Fedora, if you want.
    The "Install Media" contains all the Fedora packages, and you can install from that without having an Internet connection.
    Then there's the choice between i686 and x86_64. Here's how to figure out which one you need:
    • i686 - If you have a Pentium or Celeron (meaning any Pentium or Celeron, including a Pentium 4, Pentium M, etc.) or the original Core Duo or Core Solo (not a Core 2 Duo or Core 2 Solo).
    • x86_64 - If you have a Core 2 Duo, Core 2 Solo, Core i7, i5, i3, Opteron, Athlon 64, Turion 64, Sempron, or anything newer than these. (This also includes most new "Intel Mac" machines.) Almost every new computer sold in the last few years is an x86_64 machine.
    For more details on how to get Fedora, including how to buy a CD (if you can't download one), see the Distribution page on the Fedora Project site.
  2. Q: Can I install on ReiserFS or JFS?
    A: Yes, you can install Fedora on ReiserFS or JFS.
    ReiserFS and JFS are not officially supported by the Fedora Project. (That means that you can use them, but you won't find a lot of official help from the Fedora Project if things go wrong.)
    At the installer prompt, type this for ReiserFS:
    linux selinux=0 reiserfs
    or this for JFS:
    linux selinux=0 jfs
    NOTE: You cannot use SELinux on ReiserFS or JFS. (If you don't know what SELinux is, you can ignore this warning.)
    (Thanks to whiprush [quoting Jesse Keating] for this. Thanks to Kai Thomsen for catching an important typo.
  3. Q: Can Fedora run on a 64-bit (AMD-64 or Intel-64) computer?
    A: Yes, it can! A 64-bit version of Fedora is currently available to download. It works very well. See the question about getting Fedora.
    You can also run the normal 32-bit version of Fedora on your 64-bit computer, although that's rarely required nowadays.
  4. Q: Can I run Fedora on a Mac?
    A: Yes, you can! If you have a Core Duo Intel Mac, you want the i686 version of Fedora. If you have a Core 2 Duo or later Intel Mac, you want the x86_64 version of Fedora. (See the question about getting Fedora.) Note that some things may not yet work perfectly on Intel Macs. mactel-linux.org is a good site for information about running Fedora (or any Linux) on a Mactel machine.
    If you have a G3, G4, or G5 Mac, there is no longer an installation disc available for your machine for Fedora 13.

Using Fedora and Installing Software

  1. Q: Where can I get software for Fedora?
    A: The best way to get software is to use the normal software installation tools that come with Fedora, which will download and install things automatically for you. Otherwise, to search for software packages, you can use rpm.pbone.net.
  2. Q: How do I install software in Fedora? (How to use yum or an RPM)
    A: Fedora has thousands of pieces of software that can be downloaded and automatically installed from the Internet.

    Configuring Package Installation

    Many of the packages I mention in the FAQ are only available from rpmfusion. To configure your system so that you can install packages from rpmfusion, follow these instructions:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Run the following command:

    Using the GUI to Install/Update Software

    If you have graphical access to your desktop, you can use the graphical tools to install software. Go to the System menu, choose "Administration", and then click on "Add/Remove Software".
    Fedora will automatically let you know when updates are available for your software.

    Installing Software From the Command Line

    Often people want to use install or update software using the command line. For this you use a program called "yum". First become root, and then you can use the following commands:
    • To see a list of available software:
      yum list available
    • To install some software, you type:
      yum install packagename
    • To update some software, you type:
      yum update packagename
      If you leave out "packagename" yum will update all your software.
    • To see what updates are available, you can do:
      yum check-update
    • To search for a package, you can do:
      yum search word
    For more info about yum, see the yum project page. (Thanks to Ron Kuris for this tip.)

    Installing Local RPMs

    To install an RPM file that you downloaded outside of yum, open up a terminal, and as root do:
    rpm -Uvh filename.rpm
    If you have Internet access, you can also install local files by doing:
    yum --nogpgcheck install filename.rpm
    Which is handy because it will automatically download and install any dependencies that that RPM has.
  3. Q: Is there anything like apt for Fedora?
    A: APT is a program for Debian and Ubuntu Linux that installs not only the software you specify, but also all of that software's dependencies. It makes installing software much easier. There is a piece of software like this for Fedora, that comes in the standard Fedora installation. It's called yum. It can automatically download and install a program and all of its dependencies, with just one command. I even provide a special configuration that I use for yum on my computer, in the question where I explain how to use yum.
  4. Q: How do I install a working Java plugin for my web browser?
    A: Fedora includes an open-source version of Java 6, and nearly every Java applet will run if you simply install the Java plugin that comes with Fedora:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install the plugin:
      yum install java-1.6.0-openjdk-plugin
  5. Q: How can I install Flash in Firefox?
    A:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install the Adobe repository for yum:
    4. Type:
      yum install --exclude=AdobeReader* flash-plugin nspluginwrapper.{i686,x86_64} pulseaudio-libs.i686 alsa-plugins-pulseaudio.i686 libcurl.i686
    5. Configure Firefox to see the plugin, by typing:
      mozilla-plugin-config -i -g -v
    6. If you have Firefox open, quit and open it again.
  6. Q: How can I see PDF files inside my browser?
    A: Just install mozplugger and xpdf:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install mozplugger:
      yum install mozplugger xpdf
    This also enables Firefox to open lots of other types of files, like movies, audio, Word documents, etc.
  7. Q: How can I watch movies in my web browser?
    A: Just install the Totem Plugin:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Install the plug-in:
      yum install totem-mozplugin gstreamer-plugins-ugly gstreamer-plugins-bad
    5. Close all the windows of your web browser and then open it again.
    Now, you can see movies on web sites!
    Note that if you have also installed mozplugger from the PDF question, you might get a pop-up movie player instead of having the movie embedded in the page.
  8. Q: Can I use MSN Messenger/AIM/ICQ/Yahoo instant messaging in Fedora?
    A: Yes! By default, Fedora comes with a simple instant messaging program called Empathy, which supports MSN Messenger, ICQ, AIM, Yahoo! Messenger, and Google Talk, and many other protocols, all at the same time. To start Empathy, click on the Applications menu, go to "Internet," and choose "Empathy IM Client."
    If you don't like Empathy, you can use Pidgin, another Instant Messenger program for Linux. To install Pidgin:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install Pidgin:
      yum install pidgin
    Pidgin will then be available in the Applications menu, under "Internet", as "Pidgin Instant Messenger".
  9. Q: Can I install the standard Windows fonts on Fedora?
    A: Yes, there's also a very easy way to install all of the common Windows fonts on Linux. You don't usually have to do this on Fedora (because it comes with fonts called the "Liberation" fonts that are the same exact size as the Windows fonts), but if you want to do it, here's how:
    1. Install the chkfontpath package from ATrpms. (Click on either the i686 or x86_64 package, depending on whether you have a 32-bit or 64-bit machine.)
    2. Open a Terminal.
    3. Become root:
      su -
    4. Install some packages you'll need for the following steps:
      yum install rpm-build cabextract ttmkfdir wget
    5. Download the MS Core Fonts Smart Package File:
      wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
    6. Build the Core Fonts package:
      rpmbuild -ba msttcorefonts-2.0-1.spec
    7. Install the Core Fonts package:
      yum install --nogpgcheck /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
    (Thanks to David A. Wheeler and others for convincing me to add the MS Core Fonts instructions. Thanks to byro for pointing out the URL to the 2.0 package!)
  10. Q: Where can I get drivers for my hardware for Fedora?
    A: Most drivers come with Fedora. However, if your driver doesn't come with Fedora, you can see what drivers are available for automatic download:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Run the following command:
      yum list akmod-\* \*-drv\* kmod-\* dkms-\*
    If you don't find what you need this way, try Googling for:
    Fedora NameOfHardware
    or:
    Linux NameOfHardware
    Where NameOfHardware is the normal name of your hardware. If it has more than one name, keep trying different ones until you get a result.
  11. Q: How do I read my NTFS (Windows NT/2000/XP/2003) drive in Fedora?
    A: Well, now, that's an easy one! You just have to install the ntfs-3g program!
    1. Open a Terminal.
    2. Become root:
      su -
    3. Type:
      yum install ntfs-3g
    Now you can read and write to your NTFS drives!
    For information on how to use your NTFS drive, you can read the NTFS FAQ. (You don't need to worry about /proc/filesystems like it says there, though.)
  12. Q: How do I edit the menus in the panel?
    A: First you have to install the menu editor:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install the menu editor:
      yum install alacarte
    Now you can go to the System menu, then "Preferences", and click on "Main Menu" to edit the menu.
    For KDE users, there is a program called kmenuedit that you can run to edit the menu.
  13. Q: How do I install Wine?
    A: Wine is a way of running some Windows programs on Linux. It's available using yum:
    1. Open a Terminal.
    2. Become root:
      su -
    3. Install wine:
      yum install wine
  14. Q: How do I play DVDs in Fedora?
    A: Easy! You just have to install some additional packages for Totem, the Movie Player:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Install the software that Totem needs in order to play DVDs correctly:
      yum install libdvdread libdvdcss libdvdnav gstreamer-plugins-ugly gstreamer-plugins-bad
    And now you can play DVDs! You can find Totem in the "Applications" menu, under "Sound and Video." It's just called "Movie Player." Sometimes it will say that it can't play a DVD, but it will usually work if you close Totem, then insert the DVD into your drive, then wait for a popup to ask you what you want to do, and then click "Open."
  15. Q: How do I play MP3s in Fedora?
    A: To play MP3s in Fedora, you have to install a different package depending on which Fedora MP3 player you want to use. If you're not sure which one to pick, Rhythmbox is the standard. It's in the "Applications" menu, under "Sound & Video" -- it's called "Rhythmbox Music Player." It looks kind of like iTunes when you run it. Here's how to install the correct MP3 plugin:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Now, install the correct plugin depending on which MP3 player you want to use:
      • For Rhythmbox or Totem:
        yum install gstreamer-plugins-ugly
      • For Audacious (which is like XMMS or Winamp):
        yum install audacious-plugins-freeworld-mp3
    Now you should be able to play MP3s in your favorite Fedora MP3 player!
    INFO NOTE: For home users in any country (even the USA), there is no legal problem with MP3 players, so you are not doing anything illegal by enabling MP3 support in Fedora. However, if you are in the USA and you want to encode MP3s or use them in a commercial setting, you may be required to pay patent royalties.

Problems and Their Solutions

  1. Q: I get a NOKEY warning from RPM, or I get a gpg signature error when using yum!
    A: The NOKEY warning is not really a problem. It won't prevent you from doing anything. (The yum error, though, will usually prevent you from installing software.) If you'd like to resolve it, do the following command to get the correct key for the site you're downloading from:
    You must be root to do any of this.
    • Red Hat and Fedora:
      rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
    • rpm.livna.org:
      rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
    • FreshRPMs:
      rpm --import http://freshrpms.net/RPM-GPG-KEY-freshrpms
    • DAG:
      rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
    • ATrpms:
      rpm --import http://atrpms.net/RPM-GPG-KEY.atrpms
    • NewRPMs:
      rpm --import http://newrpms.sunsite.dk/gpg-pubkey-newrpms.txt
    • Dries (RPMForge):
      rpm --import http://apt.sw.be/dries/RPM-GPG-KEY.dries.txt
    • JPackage:
      rpm --import http://www.jpackage.org/jpackage.asc
    • kde-redhat:
      rpm --import http://kde-redhat.sourceforge.net/gpg-pubkey-ff6382fa-3e1ab2ca
    • PlanetCCRMA:
      rpm --import http://ccrma.stanford.edu/planetccrma/RPM-GPG-KEY.planetccrma.txt
    NOTE: If you install my yum configuration, most of these keys are installed for you automatically.
    (Thanks to Kai Thomsen for the original location of the ATrpms key, and thanks to Tom Householder for the new location! Thanks to Pim Rupert for the location of the Dries key. Thanks to Anduin Withers for a good idea about how to reorganize this question. Thanks to Dieter Komendera for the new location of the FreshRPMs key.)
  2. Q: How do I enable 3D support for my ATI Radeon card in Fedora?
    A: RPM Fusion provides ATI driver RPMs that are designed especially for Fedora.
    NOTE: If you have nVidia drivers installed, you must un-install them before installing these ATI drivers.
    Here's how to install them:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Install the driver:
      yum install kmod-catalyst
    5. Shut down X:
      init 3
    6. Log in as root.
    7. Enable the driver:
      catalyst-config-display enable
    8. Rebuild your kernel configuration (otherwise it may try to load a conflicting driver during boot) and add some new kernel arguments to work around conflicts between the Catalyst driver and Fedora:
      new-kernel-pkg --kernel-args=nomodeset --mkinitrd --dracut --update $(rpm -q --queryformat="%{version}-%{release}.%{arch}\n" kernel | tail -n 1)
    9. Reboot your machine:
      reboot
    If you have any trouble with the RPM Fusion RPMs, please report a bug to the RPM Fusion Bugzilla.
  3. Q: How do I enable 3D support for my nVidia graphics card in Fedora?
    A: There are now nVidia driver RPMs provided by rpmfusion.org that are designed especially for Fedora. Here's how to install them:
    1. Make sure that you're using my yum configuration from the installing software question.
    2. Open a Terminal.
    3. Become root:
      su -
    4. Install the driver:
      yum install kmod-nvidia
    5. Rebuild your kernel configuration (otherwise it may try to load a conflicting driver during boot):
      new-kernel-pkg --mkinitrd --dracut --update $(rpm -q --queryformat="%{version}-%{release}.%{arch}\n" kernel | tail -n 1)
    6. Reboot your machine:
      reboot
    And now you should have working 3D with your nVidia card!
    Note that if you have an older card, you may need to install kmod-nvidia-173xx or kmod-nvidia-96xx. There is a list on the nVidia site that says which cards are supported by which driver.
    If you need support for the nVidia drivers, check out the nV News "NVIDIA Linux Forum". (Thanks to Exile in Paradise for this tip.)
  4. Q: The installer's media check says all my CDs are bad!
    A: There is a bug in the kernel which causes the media check to say some CDs are bad when they are not, on some systems. To do a successful media check, do the following:
    1. At the installer prompt, type:
      linux mediacheck ide=nodma
    2. Run the media check on your CDs/DVD.
    3. Reboot, and run the installer normally.
    Note that sometimes mediacheck will report that only some CDs are bad, but this will still fix that problem. (Thanks to Tony Nelson for reminding me of that!)
  5. Q: I have strange installation problems.
    A: If your installation doesn't work, or you have problems during or after installation, first read the latest Release Notes. Also, the Fedora Project provides a detailed installation guide if you'd like any other help while installing.
    In particular, you might want to try using the special boot options listed in the Install Guide. Of those, the most-frequently useful are: noapic, acpi=off, and xdriver=vesa.
    If any of those commands fixes your problem, please file a bug in Red Hat's Bugzilla.
  6. Q: I can't access my Windows network shares anymore! People tell me to use the smbmount command, but it doesn't work!
    A: Modern versions of Linux use a type of Windows file sharing called "The Common Internet File System" (CIFS). Instead of using "smbmount", try:
    mount -t cifs //1.2.3.4/share /mnt/somedirectory
    For more information about this, in a terminal you can do:
    man mount.cifs
    Note that CIFS can't resolve Windows computer names, so you're better off using their IP addresses.
  7. Q: Y is ur f4q so dum n bad?
    A: Not only am I impressed with your intelligence, but also with your sterling education! Verily, I am blinded by your wit and charm. (But as a side note, if you actually want to contribute something useful, there's a whole page about that!)

    Nguồn: Fedora

25.8.11

Tạo file spec cho các gói RPM

http://jeudisdulibre.be/wp-content/uploads/2011/01/rpm-package-fedora1.png

1. Cấu trúc Spec File

Các file RPM (gói phần mềm) được sử dụng rất nhiều trong nhiều distro Linux: Redhat, Fedora, Turbo Linux... Cấu trúc RPM do Redhat phát triển. Để tạo ra các file RPM chúng ta dùng lệnh rpmbuild với tham số là file spec.
File spec là file text bao gồm sáu phần chính: header (đầu mục), %prep, %build, %install, %clean, %files, %changelog, các mục này chỉ có một và theo trình tư như đã liệt kê, trong mỗi mục đó có thể có một số macro (lưu ý là các macro cũng có dấu % ở trước). Trong các mục này có thể thực hiện các lệnh shell (sh), nhưng không cần có #!/bin/sh.
Các macro có thể xuất hiện nhiều lần trong một mục.
File Spec được sử dụng để tạo các gói rpm. Tên file chúng ta nên đặt theo quy ước chuẩn: têngói-gạchngang-sốhiệuphiênbản-sốhiệupháthành-chấm-spec.
Đây là một ví dụ (eject-2.0.2-1.spec):

Summary: A program that ejects removable media using software control.
Name: eject
Version: 2.0.2
Release: 3
Copyright: GPL
Group: System Environment/Base
Source: http://metalab.unc.edu/pub/Linux/utils/disk-management/eject-2.0.2.tar.gz
Patch: eject-2.0.2-buildroot.patch
BuildRoot: /var/tmp/%{name}-buildroot

%description
The eject program allows the user to eject removable media
(typically CD-ROMs, floppy disks or Iomega Jaz or Zip disks)
using software control. Eject can also control some multi-
disk CD changers and even some devices' auto-eject features.

Install eject if you'd like to eject removable media using
software control.

%prep
%setup -q
%patch -p1 -b .buildroot

%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/man/man1

install -s -m 755 eject $RPM_BUILD_ROOT/usr/bin/eject
install -m 644 eject.1 $RPM_BUILD_ROOT/usr/man/man1/eject.1

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README TODO COPYING ChangeLog

/usr/bin/eject
/usr/man/man1/eject.1

%changelog
* Sun Mar 21 1999 Cristian Gafton 
- auto rebuild in the new build environment (release 3)

* Wed Feb 24 1999 Preston Brown 
- Injected new description and group.

[ Some changelog entries trimmed for brevity.  -Editor. ]

2. Tiêu đề (The Header)

Tiêu đề bao gồm một số mục sau:
  • Summary: Một dòng mô tả về sản phẩm.
  • Name: tên gói mà bạn sẽ sử dụng.
  • Version: chuỗi số phiên bản.
  • Release: chuỗi phát hành.
  • Copyright: Bản quyền.
  • Source: Là thư mục chứa mã nguồn hoặc nơi chứa mã nguồn. Bạn cũng có thể mô tả nhiều nơi chứa mã nguồn như sau::
    Source0: blah-0.tar.gz
    Source1: blah-1.tar.gz
    Source2: fooblah.tar.gz

  • Patch: nơi mô tả các gói patch, các goi snày phải có tên file chính xác sẽ được sử dụng sau này trong quá trình patch:
    Patch0: blah-0.patch
    Patch1: blah-1.patch
    Patch2: fooblah.patch
    Các file này phải nằm trong thư mục mã nguồn (SOURCES directory).
  • Group: Là nhóm mà gói phần mềm thuộc trong đó, có thể là mức cao nhất trong bộ gói cài đặt của Red Hat (Red Hat's gnorpm). Bạn cũng có thể tìm thấy một số thông tin ở /usr/doc/rpm*/GROUPS. Ví dụ về cây của các nhóm gói phần mềm:
    Amusements/Games
    Amusements/Graphics
    Applications/Archiving
    Applications/Communications
    Applications/Internet
    Applications/Multimedia
    Applications/Publishing
    Applications/System
    Development/System
    Development/Tools
    Documentation
    System Environment/Base
    System Environment/Shells
    User Interface/Desktops
    User Interface/X
    User Interface/X Hardware Support
  • BuildRoot: Dòng này quy định thư mục "gốc" cho mã nguồn để biên dịch và cài đặt.
  • %description mô tả về phần mềm, có thể được viết ở dạng nhiều dòng.

3. Prep

Đây là phần chuẩn bị để biên dịch, bao gồm giải nén, vá chuẩn bị để chạy chương trình make.
Bạn có thể tạo ra file shell để làm các công tác chuẩn bị, tuy nhiên rpm có sẵn một số macro để làm đơn giản quá trình đó.Macros đầu tiên là %setup . nếu không có tham số thì nó đơn giản là giải nén mã nguồn và chuyển (cd) đến thư mục chứa mã nguồn. %setup có một số tham số sau:
  • -n name Quy định tên thư mục mã nguồn biên dịch khác với mặc định với tên là name. Mặc định là $NAME-$VERSION. Hoặc có thể là $NAME, ${NAME}${VERSION}, hoặc bất kỳ thế nào do tar file sử dụng. (Chú ý rằng dấu "$" ở đây không hẳn là biến thực trong file spec. Bạn phải dùng tên và version thật.
  • -c tạo và chuyển thư mục đến thư mục trước khi giải nén (untar).
  • -b sẽ giải nén mã nguồn thứ #n trước khi chuyển thư mục tới thư mục mã nguồn. Tham số này có ích nếu có nhiều file mã nguồn.
  • -a sẽ giải nén mã nguồn thứ #n sau khi chuyển tới thư mục mã nguồn.
  • -T Tham số này sẽ không giải nén và yêu cầu các tham số -b 0 hoặc -a 0 để có mã nguồn giải nén.
  • -D không xoá thư mục trước khi giải nén. Thường được dùng khi có nhiều %setup, để tránh xoá phần giải nén ở %setup trước, tuy nhiên thường không dùng nếu chỉ có 1 %setup.
Macro tiếp theo là %patch. Phần này sẽ tự động vá (patch mã nguồn), có một số tham s
  • sẽ thực hiện patch#n như là các patch file.
  • -p chỉ ra số thư mục sẽ thực hiện patch(n) command.
  • -P Mặc định sẽ thực hiện Patch (hay Patch0). This flag inhibits the default action and will require a 0 to get the main source file untarred. This option is useful in a second (or later) %patch macro that required a different number than the first macro.
  • Bạn có thể thực hiện %patch thay cho thực hiện lệnh thực tế: %patch #n -P
  • -b extension sẽ lưu lại các file gốc với phần mở rộng là filename.extension trước khi thực hiện vá (patching).
Ngoài các macro này ra bạn cũng có thể thực hiện bất kỳ lệnh nào dạng shell (sh) cho đến mục %build.

4. Build

Bạn có thể liệt kê các lệnh ở đây để biên dịch mã nguồn sau khi đã giải nén và chuyển thư mục hiện thời tơi sthư mục mã nguồn.
Biến RPM_OPT_FLAGS được thiết lập với các giá trị trong /usr/lib/rpm/rpmrc. Hãy kiểm tra với các giá trị thích hợp. Hoặc có thể không cần sử dụng trong file spec.

5. Install

Ở đây không có macro nhưng bạn có thể thực hiện bất kỳ lệnh nào dạng shell để cài đặt, thường bạn dùng lệnh make install để thực hiện phần cài đặt.Bạn lưu ý rằng thư mục hiện thời phải là thư mục mã nguồn.
Biến RPM_BUILD_ROOT cũng được sử dụng để quy định về thưc mục trong phần tiêu đề Buildroot.

6. Dọn dẹp (clean)

Thông thường trước khi buil, tạo gói bạn nên xoá bỏ các file xuất hiện trong quá trình biên dịch, và macro %clean sẽ giúp bạn thực hiện điều đó.

7. Một số scripts dành cho trước và sau khi cài đặt

Bạn có thể thực hiện một số scripts trước và sau khi cài đặt hoặc gỡ bỏ (installation and uninstallation) của các gói nhị phân (binary). Mục đích chính là có thể chạy ldconfig sau khi cài đặt hoặc gỡ bỏ các gói dùng các thư viện chi sẻ (shared libraries). Bao gồm các macro sau::
  • %pre là macro thực hiện trước khi cài đặt (pre-install scripts).
  • %post là macro thực hiện sau khi cài đặt (post-install scripts).
  • %preun là macro thực hiện trước khi gỡ bỏ (pre-uninstall scripts).
  • %postun là macro thực hiện sau khi gỡ bỏ (post-uninstall scripts).
Nội dung các macro này là các lệnh shell (sh) nhưng không cần dòng #!/bin/sh ở đầu.

8. Files

Mục này liệt kê các danh sách file và thư mục cho gói nhị phân. Thường danh sách này bạn có thể xem ở trong phần make install.
Ở đây cũng có một số macro để phục vụ cho một số mục đích nào đó:
  • %doc chỉ ra các file tài liệu (doc) sẽ được đóng gói trong file nhị phân. Tài liệu sẽ được cài trong thư mục /usr/doc/$NAME-$VERSION-$RELEASE. Bạn có thể liệt kê nhiều tài liệu sau phần macro này, hay có thể liệt kê từng tài liệu sau từng macro này.
  • %config đánh dấu rằng đây là các file config. Bao gồm cả các file như sendmail.cf, passwd, etc. Sau này dù các file config có thay đổi thì nó cũng vẫn được remove.
  • %dir chỉ ra rằng chỉ có riêng thư mục được liệt kê ở đây như là thành phần của gói. Bình thường nếi liệt kê thư mục không có macro %dir, thì tất cả những gì có trong thư mục đó sẽ được cho vào gói.
  • %defattr cho phép bạn đặt thuộc tính mặc định cho các file được liệt kê ở dưới. Thuộc tính được mô tả theo dạng (mode, owner, group) , mode là số cơ số 8 mô tả bit pattern (giống như trong lệnh chmod), owner là username , group là tên group mà bạn có thể gán được. Bạn cũng có thể đặt ở một trường nào đấy dấu '-' nếu sử dụng mặc định.
  • %files -f cho phép bạn liệt kê các file trong một file nào đó của bạn trong thư mục mã nguồn. Chức năng này thường được sử dụng khi gói có file liệt kê danh sách riêng, trong trường hợp đó bạn không phải liệt kê tất cả các file ở đây mà chỉ cần chèn file chứa danh scáh file là được.
Ghi chú: nếu bạn chẳng may liệt kê /usr/bin thì gói nhị phân sẽ bao gồm tất cả các file có trong thư mục này.

9. Changelog

log ghi lại những cập nhật và thay đổi của gói, mỗi khi thay đổi RPM bạn nên ghi lại những thay đổi ở đây.
Định dạng khá là đơn giản, mỗi mục bắt đầu bằng một dòng có dấu '*' sau đó là ngày tháng, tên người cập nhật, địa chỉ email, theo định dạng sau:
 date +"%a %b %d %Y"
Phần còn lại là text theo một trình tự nhất định nào đó, thường là các dòng có gạch đầu dòng ở đầu.


Nguồn: Internet