FreeBSD利用 ports 來安裝軟體
FreeBSD利用 ports 來安裝軟體
利用 ports 來安裝軟體
FreeBSD 的 ports 就是別人已經編譯過,安裝測試沒問題了,他們將軟體編譯時所需的組態設定、編譯程序及安裝程序,都依照固定的格式擺在一起,當這些東西經由維護小組認可後即加入軟體蒐集中,對一般使用者而言, 我們只要先將某個軟體 ports 目錄下的檔案抓回來,然後很輕鬆的下:
makemake install
即可自動完成軟體的編譯和安裝 (也可以只用一行 make all install 來代替)。
用過 FreeBSD 的 ports 後,大部份的人都會被它這個完美的機制給吸引了, 這也是很多人喜歡用 FreeBSD 的主因之一哦。
一般 ports 在編譯時的運作流程:
fetch 抓取軟體的原始碼(source code),它會依下面的順序搜尋:先找 /usr/ports/distfiles找 /etc/make.conf 中設定的網站找 Makefile 中 MASTER_SITES 設定的網站checksum 檢查原始檔的 checksum 吻不吻合depends 檢查並自動安裝須先安裝的相關軟體extract 檢查 source,並將它解開到 works 的目錄中patch 對 source 做 patch,修改以符合 FreeBSD 的環境需求configure 產生設定檔build 開始編譯install 將編譯好的東西安裝到系統中
1.生成配置文件
make config
2.删除配置文件
make rmconfig
3.抓取源码包
make fetch
4.抓取所有源码包(包括需要到的所有包)
make fetch-recursive
5.校验源码包
make checksum
6.编译、安装并删除临时文件
make install clean
7.编译、安装、将所有需要的port打包、安装、并删除临时文件
make depends_target=package package clean
mkdir -p /usr/ports/packages/All/
生成的package会自动放到里面,否则放在port的当前目录
8.仅解开源码包
make extract
9.仅解开并打上patch
make patch
10.删除临时文件及源码包
make distclean
11.查询port的依赖关系
make all-depends-list #显示所有相关的套件
make pretty-print-build-depends-list #显示编译期间所需要的套件
make pretty-print-run-depends-list #显示此套件要执行时所需要的套件
12.删除已经安装的port
make deinstall
13.删除已经安装的port及其依赖
make deinstall-depends
14.重新安装port
make reinstall
15.搜索port
make search key=keyword
make search name=nameword
16.指定port安装目录
make PREFIX=path install
17.更新port MK
cd /usr/src/share/mk
make install
18.解决安装时的sed -i 错误
make -DUSE_REINPLACE install
19.更新port index对照表
cd /usr/ports/
make index
20.更新index html
cd /usr/ports/
make readmes
port的make命令参数信息
fetch - Retrieves $ (and $ if defined) into $ as necessary.
fetch-list - Show list of files that would be retrieved by fetch.
fetch-recursive - Retrieves $ (and $ if defined), for port and dependencies into $ as necessary.
fetch-recursive-list - Show list of files that would be retrieved by fetch-recursive.
fetch-required-list - Show list of files that would be retrieved by fetch-required.
fetch-required - Retrieves $ (and $ if defined), for port and dependencies that are not already installed into $.
all-depends-list - Show all directories which are dependencies for this port.
build-depends-list - Show all directories which are build-dependencies for this port.
package-depends-list - Show all directories which are package-dependencies for this port.
run-depends-list - Show all directories which are run-dependencies for this port. extract - Unpacks $ into $.
patch - Apply any provided patches to the source.
configure - Runs either GNU configure, one or more local configure scripts or nothing, depending on what's available.
build - Actually compile the sources.
install - Install the results of a build.
reinstall - Install the results of a build, ignoring "already installed" flag.
deinstall - Remove the installation.
deinstall-all - Remove all installations with the same PKGORIGIN. package - Create a package from an _installed_ port.
package-recursive - Create a package for a port and _all_ of its dependancies.
describe - Try to generate a one-line description for each port for use in INDEX files and the like.
checkpatch - Do a "patch -C" instead of a "patch". Note that it may give incorrect results if multiple patches deal with the same file.
checksum - Use distinfo to ensure that your distfiles are valid.
checksum-recursive - Run checksum in this port and all dependencies.
makesum - Generate distinfo (only do this for your own ports!).
clean - Remove $ and other temporary files used for building.
clean-depends - Do a "make clean" for all dependencies.
config - Configure options for this port (using $). Automatically run prior to extract, patch, configure, build, install, and package.
showconfig - Display options config for this port
rmconfig - Remove the options config for this port
分类:
ns
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南