{"id":13853,"date":"2023-12-28T15:43:49","date_gmt":"2023-12-28T07:43:49","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=13853"},"modified":"2023-12-28T15:43:49","modified_gmt":"2023-12-28T07:43:49","slug":"ubuntu%e8%bd%af%e4%bb%b6%e6%89%93%e5%8c%85%e6%9c%89%e5%95%a5%e6%96%b9%e6%b3%95%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/12\/28\/ubuntu%e8%bd%af%e4%bb%b6%e6%89%93%e5%8c%85%e6%9c%89%e5%95%a5%e6%96%b9%e6%b3%95%e5%91%a2%ef%bc%9f\/","title":{"rendered":"ubuntu\u8f6f\u4ef6\u6253\u5305\u6709\u5565\u65b9\u6cd5\u5462\uff1f"},"content":{"rendered":"

Ubuntu\u662f\u4e00\u4e2a\u57fa\u4e8eDebian\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u662f\u81ea\u7531\u548c\u5f00\u6e90\u7684\u3002Ubuntu\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668APT\uff08Advanced Package Tool\uff09\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u5378\u8f7d\u8f6f\u4ef6\u5305\u3002\u4f46\u662f\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u5c06\u81ea\u5df1\u7f16\u5199\u7684\u8f6f\u4ef6\u6253\u5305\u6210Ubuntu\u8f6f\u4ef6\u5305\uff0c\u4ee5\u4fbf\u5728\u5176\u4ed6Ubuntwindow\u7a0b\u5e8f\u6253\u5305exe\u5de5\u5177<\/a>u\u7cfb\u7edf\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecdUbuntu\u8f6f\u4ef6\u6253\u5305\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n

## \u539f\u7406<\/p>\n

Ubuntu\u8f6f\u4ef6\u5305\u7684\u683c\u5f0f\u662fDebian\u8f6f\u4ef6\u5305\u683c\u5f0f\uff0c\u4e5f\u79f0\u4e3a.deb\u6587\u4ef6\u3002\u8fd9\u79cd\u6587\u4ef6\u683c\u5f0f\u5305\u542b\u4e86\u8f6f\u4ef6\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3001\u914d\u7f6e\u6587\u4ef6\u548c\u5b89\u88c5\u811a\u672c\u7b49\u3002\u5728Ubuntu\u4e2d\uff0c\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668APT\u4f1a\u6839\u636e\u8f6f\u4ef6\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\u81ea\u52a8\u5b89\u88c5\u6216\u5378\u8f7d\u8f6f\u4ef6\u5305\u3002\u56e0\u6b64\uff0c\u6253\u5305<\/p>\n

<\/figure>\n<\/p>\n

Ubuntu\u8f6f\u4ef6\u5305\u7684\u8fc7\u7a0b\u4e0d\u4ec5\u5305\u62ec\u5c06\u8f6f\u4ef6\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u6253\u5305\u6210.deb\u6587\u4ef6\uff0c\u8fd8\u9700\u8981\u4e3a\u8f6f\u4ef6\u5305\u521b\u5efa\u4e00\u4e2a\u63a7\u5236\u6587\u4ef6\uff0c\u8be5\u63a7\u5236\u6587\u4ef6\u5305\u542b\u8f6f\u4ef6\u5305\u7684\u63cf\u8ff0\u4fe1\u606f\u3001\u4f9d\u8d56\u5173\u7cfb\u548c\u5b89\u88c5\u811a\u672c\u7b49\u3002<\/p>\n

## \u6b65\u9aa4<\/p>\n

\u4ee5\u4e0b\u662f\u6253\u5305Ubuntu\u8f6f\u4ef6\u5305\u7684\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n

### \u6b65\u9aa4\u4e00\uff1a\u5b89\u88c5\u5fc5\u8981\u7684\u5de5\u5177<\/p>\n

\u5728\u6253\u5305Ubuntu\u8f6f\u4ef6\u5305\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u5de5\u5177\u3002\u6253\u5f00\u7ec8\u7aef\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

sudo apt-get install devscripts build-essential lintian<\/p>\n

“`<\/p>\n

### \u6b65\u9aa4\u4e8c\uff1a\u521b\u5efa\u8f6f\u4ef6\u5305\u76ee\u5f55\u7ed3\u6784<\/p>\n

\u5728\u6253\u5305Ubuntu\u8f6f\u4ef6\u5305\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u8f6f\u4ef6\u5305\u7684\u76ee\u5f55\u7ed3\u6784\u3002\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

mkdir mypackage-1.0<\/p>\n

cd mypackage-1.0<\/p>\n

mkdir DEBIAN usr<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0cmypackage-1.0\u662f\u8f6f\u4ef6\u5305\u7684\u540d\u79f0\u548c\u7248\u672c\u53f7\u3002<\/p>\n

### \u6b65\u9aa4\u4e09\uff1a\u521b\u5efa\u63a7\u5236\u6587\u4ef6<\/p>\n

\u8f6f\u4ef6\u5305\u7684\u63a7\u5236\u6587\u4ef6\u5305\u542b\u8f6f\u4ef6\u5305\u7684\u63cf\u8ff0\u4fe1\u606f\u3001\u4f9d\u8d56\u5173\u7cfb\u548c\u5b89\u88c5\u811a\u672c\u7b49\u3002\u5728DEBIAN\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2acontrol\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

“`<\/p>\n

Package: mypackage<\/p>\n

Version: 1.0<\/p>\n

Section: utils<\/p>\n

Priority: optional<\/p>\n

Architecture: amd64<\/p>\n

Depends: libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.9)<\/p>\n

Maintainer: Your Name <\/p>\n

Description: This is a description of my package.<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0cmypackage\u662f\u8f6f\u4ef6\u5305\u7684\u540d\u79f0\uff0c1.0\u662f\u8f6f\u4ef6\u5305\u7684\u7248\u672c\u53f7\u3002Section\u662f\u8f6f\u4ef6\u5305\u7684\u5206\u7c7b\uff0cPriority\u662f\u8f6f\u4ef6\u5305\u7684\u4f18\u5148\u7ea7\uff0cArchitecture\u662f\u8f6f\u4ef6\u5305\u7684\u67b6\u6784\u3002Depends\u662f\u8f6f\u4ef6\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\uff0cMaintainer\u662f\u8f6f\u4ef6\u5305\u7684\u7ef4\u62a4\u8005\uff0cDescription\u662f\u8f6f\u4ef6\u5305\u7684\u63cf\u8ff0\u4fe1\u606f\u3002<\/p>\n

### \u6b65\u9aa4\u56db\uff1a\u5c06\u8f6f\u4ef6\u5b89\u88c5\u5230usr\u76ee\u5f55\u4e0b<\/p>\n

\u5c06\u8f6f\u4ef6\u5b89\u88c5\u5230usr\u76ee\u5f55\u4e0b\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8f6f\u4ef6\u5305\u5305\u542b\u4e00\u4e2a\u540d\u4e3ahello\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5176\u590d\u5236\u5230usr\/bin\u76ee\u5f55\u4e0b\uff1a<\/p>\n

“`<\/p>\n

cp hello usr\/bin\/<\/p>\n

“`<\/p>\n

### \u6b65\u9aa4\u4e94\uff1a\u8bbe\u7f6e\u6743\u9650\u548c\u6240\u6709\u8005<\/p>\n

\u8bbe\u7f6e\u8f6f\u4ef6\u5305\u4e2d\u6587\u4ef6\u7684\u6743\u9650\u548c\u6240\u6709\u8005\u3002\u4f8b\u5982\uff0c\u5982\u679chello\u6587\u4ef6\u7684\u6240\u6709\u8005\u662froot\uff0c\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

chown root:root usr\/bin\/hello<\/p>\n

chmod 755 usr\/bin\/hellodebug\u6253\u5305exe<\/a><\/p>\n

“`<\/p>\n

### \u6b65\u9aa4\u516d\uff1a\u6253\u5305\u8f6f\u4ef6\u5305<\/p>\n

\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6253\u5305\u8f6f\u4ef6\u5305\uff1a<\/p>\n

“`<\/p>\n

dpkg-deb –build mypackage-1.0<\/p>\n

“`<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amypackage-1.0.deb\u7684\u8f6f\u4ef6\u5305\u6587\u4ef6\u3002<\/p>\n

### \u6b65\u9aa4\u4e03\uff1a\u68c0\u67e5\u8f6f\u4ef6\u5305<\/p>\n

\u4f7f\u7528lintian\u5de5\u5177\u68c0\u67e5\u8f6f\u4ef6\u5305\u662f\u5426\u7b26\u5408Debian\u8f6f\u4ef6\u5305\u89c4\u8303\u3002\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

lintian mypackage-1.0.deb<\/p>\n

“`<\/p>\n

\u5982\u679c\u6ca1\u6709\u9519\u8bef\u6216\u8b66\u544a\uff0c\u8bf4\u660e\u8f6f\u4ef6\u5305\u5df2\u7ecf\u6253\u5305\u6210\u529f\u3002<\/p>\n

## \u7ed3\u8bba<\/p>\n

\u901a\u8fc7\u672c\u6587\uff0c\u6211\u4eec\u4e86\u89e3\u4e86Ubuntu\u8f6f\u4ef6\u6253\u5305\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002\u6253\u5305Ubuntu\u8f6f\u4ef6\u5305\u9700\u8981\u521b\u5efa\u8f6f\u4ef6\u5305\u76ee\u5f55\u7ed3\u6784\u3001\u63a7\u5236\u6587\u4ef6\u548c\u5b89\u88c5\u811a\u672c\u7b49\u3002\u5728\u6253\u5305\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668APT\u5728\u5176\u4ed6Ubuntu\u7cfb\u7edf\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528\u8be5\u8f6f\u4ef6\u5305\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Ubuntu\u662f\u4e00\u4e2a\u57fa\u4e8eDebian\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u662f\u81ea\u7531\u548c\u5f00\u6e90\u7684\u3002Ubuntu\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668APT\uff08Advanced Package Tool\uff09\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u66f4<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[18480,12,207,16583,2312],"topic":[],"class_list":["post-13853","post","type-post","status-publish","format-standard","hentry","category-zhuomianruanjian","tag-pcexe","tag-12","tag-207","tag-exe","tag-2312"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=13853"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13853\/revisions"}],"predecessor-version":[{"id":13876,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13853\/revisions\/13876"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=13853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=13853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=13853"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=13853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}