{"id":3151,"date":"2025-01-20T09:39:34","date_gmt":"2025-01-20T01:39:34","guid":{"rendered":"http:\/\/www.plm.cn\/?p=3151"},"modified":"2025-01-20T09:40:06","modified_gmt":"2025-01-20T01:40:06","slug":"%e8%8f%9c%e9%b8%9fubuntu-%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%88%e5%9f%ba%e7%a1%80linux%e6%93%8d%e4%bd%9c%e5%90%91%e5%af%bc%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.plm.cn\/3151\/","title":{"rendered":"\u83dc\u9e1fubuntu \u5b66\u4e60\u7b14\u8bb0\uff08\u57fa\u7840Linux\u64cd\u4f5c\u5411\u5bfc\uff09"},"content":{"rendered":"

\u968f\u7740\u4fe1\u606f\u7cfb\u7edf\u5b89\u5168\u8981\u6c42\uff0c\u5b66\u4e60linux \u7cfb\u7edf\u8fd8\u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002\u7ecf\u8fc7\u67e5\u8be2\u4e86\u89e3\u5230ubuntu\u7cfb\u7edf\u64cd\u4f5c\u76f8\u5bf9\u6bd4\u8f83\u7b80\u5355\uff08\u4e0ewindows\uff09\u5f88\u7c7b\u4f3c\u3002\u56e0\u6b64\u7ec4\u7ec7\u4e86\u5bf9Ubuntu\u7684\u5b66\u4e60<\/p>\n

Ubuntu\u5b89\u88c5\u540e\u53ef\u4ee5\u63d0\u9ad8\u901f\u5ea6\uff0c\u57fa\u672c\u914d\u7f6e<\/div>\n
1\u3001\u5907\u4efd\u539f\u6765\u7684\u6e90\uff1a<\/div>\n
\u00a0 \u00a0 cp \/etc\/apt\/sources.list \/etc\/apt\/sources.list.bak<\/div>\n
2\u3001\u5c06\u6e90\u7684\u5185\u5bb9\u8bbe\u7f6e\u4e3a\u963f\u91cc\u4e91\u955c\u50cf\uff1a<\/div>\n
\u00a0 \u00a0 sudo vim \/etc\/apt\/sources.list<\/div>\n
\u5185\u5bb9\u6539\u4e3a\uff1a<\/div>\n
\u00a0deb http:\/\/mirrors.aliyun.com\/ubuntu\/ focal main restricted universe multiverse<\/div>\n
\u00a0deb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ focal main restricted universe multiverse<\/div>\n
\u00a0deb http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-security main restricted universe multiverse<\/div>\n
\u00a0deb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-security main restricted universe multiverse<\/div>\n
\u00a0deb http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-updates main restricted universe multiverse<\/div>\n
\u00a0deb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-updates main restricted universe multiverse<\/div>\n
\u00a0deb http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-proposed main restricted universe multiverse<\/div>\n
\u00a0deb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-proposed main restricted universe multiverse<\/div>\n
\u00a0deb http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-backports main restricted universe multiverse<\/div>\n
\u00a0deb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ focal-backports main restricted universe multiverse<\/div>\n
<\/div>\n
3\u3001sudo apt update; sudo apt upgrade -y<\/div>\n
\u00a0\u68c0\u6d4b\u66f4\u65b0\uff0c\u5728\u7cfb\u7edf\u64cd\u4f5c\u524d \u6700\u540e \u8bbe\u7f6e\u4e00\u4e0b\uff08\u91cd\u542f\u64cd\u4f5c\u7cfb\u7edf\uff09<\/div>\n
<\/div>\n
\u5b66\u4e60\u7b14\u8bb0\u5e38\u89c1\u547d\u4ee4<\/div>\n
1\uff09 ctrl+alt+t \u8fdb\u5165 \u547d\u4ee4\u72b6\u6001<\/div>\n
<\/div>\n
2\uff09 sudo su –\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u5207\u6362\u5230root<\/div>\n
2-1\uff09 su-<\/div>\n
2-2\uff09 sudo visudo\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u82e5\u5e0c\u671bsudo\u4e0d\u9700\u8981\u6bcf\u6b21\u8f93\u5165\u5bc6\u7801<\/div>\n
mobox ALL=(ALL) NOPASSWD: ALL\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u589e\u52a0\u5185\u5bb9\uff08mobox \u662f\u7528\u6237\u540d\uff09<\/div>\n
<\/div>\n
3\uff09 getent group sudo\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u67e5\u770b\u54ea\u4e9b\u8d26\u53f7\u6709\u6743\u9650\u4f7f\u7528 sudo<\/div>\n
3-1\uff09 sudo usermod -aG sudo username\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u5c06 username \u7684\u7528\u6237 \u52a0\u5165sudo\u7ec4<\/div>\n
3-2\uff09 su – \uff0c\u8fdb\u5165root \u540e\uff0c visudo \uff0c\u8fdb\u884c\u7f16\u8f91 \uff0c\u5728 root \u4e0b\u9762\u6309\u683c\u5f0f\u6dfb\u52a0\u540e\u4fdd\u5b58<\/div>\n
<\/div>\n
4\uff09 setfacl -R -m u:jzx:rwx \/home\/user\/mbc\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u8bbe\u7f6ejzx \u5bf9 mbc \u76ee\u5f55\u6709\u5199\u6743\u9650<\/div>\n
<\/div>\n
5\uff09 ip a\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u67e5\u770bip<\/div>\n
<\/div>\n
6\uff09 sudo nano \/etc\/network\/interfaces ubuntu\u00a0 \u00a0 \u00a0 \u00a0 \u8001\u7248\u672c \u6c38\u4e45\u4fee\u6539\u7f51\u5361ip<\/div>\n
\u7f16\u8f91\u8f93\u5165\uff1a<\/div>\n
auto eth0<\/div>\n
iface eth0 inet static<\/div>\n
\u00a0 \u00a0 address 192.168.0.109<\/div>\n
\u00a0 \u00a0 netmask 255.255.255.0<\/div>\n
\u00a0 \u00a0 gateway 192.168.0.1<\/div>\n
\u00a0 \u00a0 dns-nameservers 114.114.114.114 180.76.76.76<\/div>\n
6-1\uff09 sudo systemctl restart networking\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u91cd\u542f\u7f51\u7edc<\/div>\n
<\/div>\n
6\uff09 sudo nano \/etc\/netplan\/01-netcfg.yaml ubuntu \u65b0\u7248\u672c \u6c38\u4e45\u4fee\u6539\u7f51\u5361ip<\/div>\n
network:<\/div>\n
\u00a0 version: 2<\/div>\n
\u00a0 renderer: networkd<\/div>\n
\u00a0 ethernets:<\/div>\n
\u00a0 \u00a0 eth0:<\/div>\n
\u00a0 \u00a0 \u00a0 addresses:<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 – 192.168.0.109\/24<\/div>\n
\u00a0 \u00a0 \u00a0 gateway4: 192.168.0.1<\/div>\n
\u00a0 \u00a0 \u00a0 nameservers:<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 addresses: [8.8.8.8 8.8.4.4]<\/div>\n
\u5173\u4e8eip \u8bbe\u7f6e \u4e0a\u9762\u547d\u4ee4\u6d4b\u8bd5\u6ca1\u6709\u6210\u529f\uff0c\u540e\u9762\u662f\u901a\u8fc7\u754c\u9762\u8bbe\u7f6e\u6389\u7684\uff0c\u754c\u9762\u4e0a\u8bbe\u7f6e\u540e \u91cd\u542f ubuntu \u751f\u6548<\/div>\n
<\/div>\n
7\uff09\u00a0 \u00a0 \u00a0sudo systemctl status ssh\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u67e5\u8be2 ssh \u662f\u5426\u6253\u5f00 \u8fdc\u7a0b<\/div>\n
7-1\uff09 sudo apt update\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u5b89\u88c5 ssh<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0sudo apt install openssh-server<\/div>\n
7-2\uff09 sudo systemctl start ssh\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u542f\u52a8<\/div>\n
7-3\uff09 sudo ufw allow ssh\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u6253\u5f00\u9632\u706b\u5899<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0ubuntu 22.04 \u7248\u672c \uff0c\u9ed8\u8ba4\u5e26 rdp \uff0c\u6d4b\u8bd5\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7 rdp \u8fde\u63a5<\/div>\n
<\/div>\n
7\uff09 sudo apt update\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u82e5\u6ca1\u6709\u5b89\u88c5 rdp\u670d\u52a1\uff0c\u9700\u8981\u624b\u5de5\u5b89\u88c5<\/div>\n
\u00a0 \u00a0 \u00a0 sudo apt install xrdp<\/div>\n
\u00a0 \u00a0 \u00a0 sudo systemctl enable xrdp\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u542f\u52a8\u5e76\u542f\u7528 xrdp \u670d\u52a1<\/div>\n
\u00a0 \u00a0 \u00a0 sudo systemctl start xrdp<\/div>\n","protected":false},"excerpt":{"rendered":"

\u968f\u7740\u4fe1\u606f\u7cfb\u7edf\u5b89\u5168\u8981\u6c42\uff0c\u5b66\u4e60linux \u7cfb\u7edf\u8fd8\u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002\u7ecf\u8fc7\u67e5\u8be2\u4e86\u89e3\u5230ubuntu\u7cfb\u7edf\u64cd\u4f5c\u76f8\u5bf9\u6bd4\u8f83\u7b80\u5355\uff08\u4e0ew […]<\/p>\n","protected":false},"author":1,"featured_media":3152,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[16],"class_list":["post-3151","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-xinwen"],"_links":{"self":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/comments?post=3151"}],"version-history":[{"count":2,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3151\/revisions"}],"predecessor-version":[{"id":3154,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3151\/revisions\/3154"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media\/3152"}],"wp:attachment":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media?parent=3151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/categories?post=3151"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/tags?post=3151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}