{"id":740,"date":"2021-11-29T13:30:00","date_gmt":"2021-11-29T13:30:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=740"},"modified":"2021-11-29T13:30:00","modified_gmt":"2021-11-29T13:30:00","slug":"740","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2021\/11\/29\/740\/","title":{"rendered":"\u5b89\u88c5 Alpine Linux 3.15 \u7cfb\u7edf\u548c apk \u5b89\u88c5\u5e38\u7528\u8f6f\u4ef6"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/3555164588.webp\" alt=\"alpine.webp\" title=\"alpine.webp\"><br \/>Alpine Linux \u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u3001\u975e\u5546\u4e1a\u7684\u3001\u901a\u7528\u7684 Linux \u53d1\u884c\u7248\uff0c\u4e13\u4e3a\u6b23\u8d4f\u5b89\u5168\u6027\u3001\u7b80\u5355\u6027\u548c\u8d44\u6e90\u6548\u7387\u7684\u9ad8\u7ea7\u7528\u6237\u800c\u8bbe\u8ba1\u3002<\/p>\n<h3>\u4e0b\u8f7d Alpine Linux \u5b89\u88c5\u5149\u76d8\uff0c\u5b98\u65b9\u7f51\u5740: <a href=\"https:\/\/www.alpinelinux.org\/downloads\/\">https:\/\/www.alpinelinux.org\/downloads\/<\/a><\/h3>\n<h2>Alpine Linux \u5b89\u88c5\u65b9\u5f0f\u5230\u865a\u62df\u673a\uff0c\u4e3b\u8981\u6709 \u6302\u8f7d ISO\u5149\u76d8\u5b89\u88c5 \u548c DD ISO\u5149\u76d8\u5230\u786c\u76d8\u5b89\u88c5\uff0c\u4ee5\u53ca\u4f7f\u7528Netboot.xyz \u5f15\u5bfc\u5b89\u88c5<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/348296569.png\" alt=\"dd_iso.png\" title=\"dd_iso.png\"><\/p>\n<h3>1. \u4e0d\u65b9\u4fbf\u6302\u8f7d\u7684vps\uff0c\u53ef\u4ee5\u4f7f\u7528 dd alpine.iso \u5149\u76d8\u5230\u786c\u76d8\uff0c\u65b9\u5f0f\uff0c\u7136\u540e\u91cd\u542f\u5b89\u88c5<\/h3>\n<pre><code>$ dd if=alpine-virt-3.15.0-x86_64.iso  of=\/dev\/sda   bs=1M\n$ reboot<\/code><\/pre>\n<h3>2. \u91cd\u542f\u540e\uff0c\u6309\u63d0\u793a\u8f93\u5165\u547d\u4ee4 <code>setup-alpine<\/code> \u5b89\u88c5<\/h3>\n<pre><code>The Alpine Wiki contains a large amount of how-to guides and general\ninformation about administrating Alpine systems.\nSee &lt;http:\/\/wiki.alpinelinux.org\/&gt;.\n\nYou can setup the system with the command: setup-alpine\n\n$ setup-alpine<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/2662075244.png\" alt=\"setup.png\" title=\"setup.png\"><\/p>\n<h3>3. \u6309\u9ed8\u8ba4\u63a8\u8350\u503c\uff0c\u8bbe\u7f6e\u597d\u7f51\u7edc\u548c\u5bc6\u7801<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/4167277841.png\" alt=\"net.png\" title=\"net.png\"><\/p>\n<h3>4. \u5982\u679c\u56fd\u5185\u5b89\u88c5\u9009\u62e9\u8f6f\u4ef6\u6e90<code>18<\/code>\u662f\u4e2d\u79d1\u5927\uff0c\u786c\u76d8\u6309\u5b9e\u9645\u63d0\u793a\u8f93\u5165<code>sda<\/code>\u6216<code>vda<\/code>\uff0c\u7136\u540e\u8f93\u5165<code>sys<\/code>\uff0c\u8bbe\u5b9a\u786c\u76d8\u4e3a\u7cfb\u7edf\u76d8\uff0c\u786e\u8ba4\u683c\u5f0f\u5316\u786c\u76d8\uff0c\u5b8c\u6210Alpine Linux\u7cfb\u7edf\u5b89\u88c5<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/3314491911.png\" alt=\"disk.png\" title=\"disk.png\"><\/p>\n<h3>5. \u5b89\u88c5\u5b8c\u6210\u6dfb\u52a0\u4e00\u4e2a\u7528\u6237 vip\uff0c\u7528\u6765\u8fdc\u7a0b ssh \u767b\u9646,\u767b\u9646\u540e\u5207\u6362 root<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/2455931426.png\" alt=\"ssh.png\" title=\"ssh.png\"><\/p>\n<pre><code>adduser vip\nssh vip@ip\nsu<\/code><\/pre>\n<h2>\u4f7f\u7528SSH\u8fdc\u7a0b\u767b\u9646\u540e\uff0c\u5c31\u53ef\u4ee5\u590d\u5236\u7c98\u8d34\uff0c\u5f88\u65b9\u4fbf\u5b89\u88c5\u5e38\u7528\u8f6f\u4ef6<\/h2>\n<pre><code># \u5207\u6362 root \u80fd\u767b\u9646\nsed -i \"s\/#PermitRootLogin.*\/PermitRootLogin yes\/g\" \/etc\/ssh\/sshd_config\nrc-service sshd restart\n\n# \u5f00\u542f\u8f6f\u4ef6\u5b89\u88c5\u7b2c\u4e09\u65b9\u5305\nsed -i s\/#http\/http\/g  \/etc\/apk\/repositories\ncat \/etc\/apk\/repositories\napk update\n\n# \u5b89\u88c5\u5e38\u7528\u8f6f\u4ef6 lrz \u548c lsz \u4f20\u9001\u548c\u53d1\u9001\u6587\u4ef6 iproute2 \u5305\u542bss\u547d\u4ee4 psmisc\u5305\u5305\u542b killall\u7b49\napk add lrzsz iproute2 psmisc htop bash nano\n\napk upgrade --no-cache<\/code><\/pre>\n<h3>alpine \u5b89\u88c5docker\uff0c\u5148\u67e5\u770b\u662f\u5426\u5f00\u542f\u8f6f\u4ef6\u6e90<\/h3>\n<ul>\n<li>\n<p><code>cat \/etc\/apk\/repositories<\/code><\/p>\n<pre><code>#\/media\/cdrom\/apks\nhttp:\/\/mirrors.ustc.edu.cn\/alpine\/v3.15\/main\n# http:\/\/mirrors.ustc.edu.cn\/alpine\/v3.15\/community\nhttp:\/\/mirrors.ustc.edu.cn\/alpine\/edge\/main\nhttp:\/\/mirrors.ustc.edu.cn\/alpine\/edge\/community\nhttp:\/\/mirrors.ustc.edu.cn\/alpine\/edge\/testing<\/code><\/pre>\n<\/li>\n<li>\n<p>apk \u5b89\u88c5\u548c\u5f00\u542f\u670d\u52a1<\/p>\n<pre><code>apk add docker\nservice docker start\nrc-update add docker boot<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u641c\u7d22\u8f6f\u4ef6\u5b89\u88c5\u8f6f\u4ef6<\/h3>\n<pre><code>apk search docker-compose\napk add docker-compose<\/code><\/pre>\n<h2>Alpine Linux \u5b9e\u73b0\u5f00\u673a\u81ea\u542f\u811a\u672c<\/h2>\n<pre><code>cd \/etc\/local.d\n\nvi sskcp.start\n\n#!\/bin\/bash\nip link set eth0 up\nip addr add 192.168.1.111\/24 dev eth0\nip route add default via 192.168.1.1\nexec \/root\/sskcp.sh start\n\n\n# \u8d4b\u4e88\u811a\u672c\u53ef\u6267\u884c\u6743\u9650\uff1a\nchmod +x sskcp.start\n\n# \u8bbe\u7f6e local \u670d\u52a1\u5f00\u673a\u542f\u52a8\uff1a\nrc-update add local<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Alpine Linux \u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u3001\u975e\u5546\u4e1a\u7684\u3001\u901a\u7528\u7684 Linux \u53d1\u884c\u7248\uff0c\u4e13\u4e3a\u6b23\u8d4f\u5b89\u5168\u6027\u3001\u7b80\u5355\u6027 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6],"tags":[23],"class_list":["post-740","post","type-post","status-publish","format-standard","hentry","category-linux","category-vps","tag-linux"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=740"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/740\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}