{"id":171,"date":"2021-03-12T00:37:57","date_gmt":"2021-03-11T16:37:57","guid":{"rendered":"http:\/\/hfcheng.vipuu.net\/?p=171"},"modified":"2021-03-12T15:54:02","modified_gmt":"2021-03-12T07:54:02","slug":"linux-tips","status":"publish","type":"post","link":"https:\/\/www.samcheng.net\/?p=171","title":{"rendered":"linux tips"},"content":{"rendered":"<h1>os tips<\/h1>\n<h2>centos\u5b89\u88c5\u907f\u5751<\/h2>\n<ol>\n<li>could not resolve host \/ Network is unreachable\n<img decoding=\"async\" src=\"http:\/\/hfcheng.vipuu.net\/wp-content\/uploads\/2021\/01\/image.png\" alt=\"\"><\/li>\n<li>\u8c03\u6574\u63a7\u5236\u53f0\u5206\u8fa8\u7387\n<pre><code>vi \/boot\/grub2\/grub\/cfg\uff0crhgb quiet \u540e\u589e\u52a0vga=0x342<\/code><\/pre><\/li>\n<\/ol>\n<h2>vmware Centos\u6302\u8f7d\u5171\u4eab\u76ee\u5f55<\/h2>\n<ol>\n<li>vmware-hgfsclient\uff0c\u67e5\u770b\u5171\u4eab\u76ee\u5f55<\/li>\n<li>mkdir \/mnt\/hgfs<\/li>\n<li>vi \/etc\/fstab\uff0c\u6dfb\u52a0.host:\/ \/mnt\/hgfs fuse.vmhgfs-fuse allow_other,<em>defaults 0 0<\/em><\/li>\n<li>mount -a<\/li>\n<li>umount \/mnt\/hgfs\uff0c\u5378\u8f7d<\/li>\n<\/ol>\n<h2>shutdown<\/h2>\n<ul>\n<li>shutdown -h now\uff0c\u7acb\u5373\u5173\u673a<\/li>\n<li>shutdown -r now\uff0c\u7acb\u5373\u91cd\u542f<\/li>\n<li>shutdown -r 10\uff0c10min\u540e\u91cd\u542f<\/li>\n<li>shutdown -r 20:35,20:35\u91cd\u542f<\/li>\n<\/ul>\n<h2>\u8bbe\u7f6eshell\u63d0\u793a\u683c\u5f0f<\/h2>\n<pre><code>export PS1=&quot;\\033[32m[\\u@\\h \\033[33m\\w\\033[32m]\\033[36m\\$(__git_ps1)\\033[0m\\n\\$ &quot;<\/code><\/pre>\n<h2>\u8bbe\u7f6e\u9759\u6001ip<\/h2>\n<pre><code>vi \/etc\/sysconfig\/network-scripts\/ifcfg-ens33\nBOOTPROTO=static # \u4f7f\u7528\u9759\u6001IP\u5730\u5740\uff0c\u9ed8\u8ba4\u4e3adhcp\nIPADDR=192.168.129.132 # \u8bbe\u7f6e\u7684\u9759\u6001IP\u5730\u5740\nNETMASK=255.255.255.0 # \u5b50\u7f51\u63a9\u7801\nGATEWAY=192.168.229.2 # \u7f51\u5173\u5730\u5740\nDNS1=114.114.114.114\nDNS2=8.8.8.8\n\nvi \/etc\/sysconfig\/network\nNETWORKING=yes\nGATEWAY=192.168.229.2<\/code><\/pre>\n<h2>share folder<\/h2>\n<pre><code>mount -t cifs -o username=share,password=123456 \/\/192.168.12.200\/Work \/work\nvi \/etc\/fstab\n\/\/192.168.12.200\/Work \/work cifs username=share,password=123456 0 0<\/code><\/pre>\n<h2>yum\u6e90<\/h2>\n<pre><code>\/etc\/yum.repos.d\/kubernetes.repo\uff1a\n[kubernetes]\nname=Kubernetes\nbaseurl=https:\/\/mirrors.aliyun.com\/kubernetes\/yum\/repos\/kubernetes-el7-x86_64\/\nenabled=1\ngpgcheck=0<\/code><\/pre>\n<h1>docker tips<\/h1>\n<h2>yum\u6e90<\/h2>\n<pre><code>\/etc\/yum.repos.d\/docker-ce.repo\uff1a\n[docker-ce-stable]\nname=Docker CE Stable - $basearch\nbaseurl=https:\/\/download.docker.com\/linux\/centos\/$releasever\/$basearch\/stable\nenabled=1\ngpgcheck=1\ngpgkey=https:\/\/download.docker.com\/linux\/centos\/gpg<\/code><\/pre>\n<h2>\u56fd\u5185\u955c\u50cf\u6e90\uff1a<\/h2>\n<pre><code>vi \/etc\/docker\/daemon.json<\/code><\/pre>\n<pre><code>{\n    registry-mirrors: [\n        https:\/\/172.20.10.10:8088,\n        http:\/\/hub-mirror.c.163.com\n    ],\n    insecure-registries: [\n        https:\/\/172.20.10.10:8088\n    ],\n    data-root: \/data\/docker\n}<\/code><\/pre>\n<h2>docker-compose\u5b89\u88c5<\/h2>\n<pre><code>curl -L https:\/\/github.com\/docker\/compose\/releases\/download\/1.26.2\/docker-compose-`uname -s`-`uname -m` -o \/usr\/local\/bin\/docker-compose\nchmod +x \/usr\/local\/bin\/docker-compose<\/code><\/pre>\n<h2>gitlab container\u7aef\u53e3\u95ee\u9898<\/h2>\n<p>\u8bbe\u7f6e\u4e86external_url\u4e4b\u540e\uff0c\u5982\u679c\u5e26\u6709\u7aef\u53e3\u53f7\uff0c\u5219\u5bf9\u5916\u670d\u52a1\u7684\u7aef\u53e3\u53f7\u4f1a\u540c\u6b65\u6210\u8be5\u7aef\u53e3\u53f7\uff0c<span style=\"color:red\">\u800c\u4e0d\u662f\u9ed8\u8ba4\u768480\uff01<\/span>\u5982\u679c\u662f\u4f7f\u7528docker\u5b89\u88c5\u7684gitlab\uff0c\u5219\u9700\u8981\u540c\u6b65\u4fee\u6539\u7aef\u53e3\u6620\u5c04\uff0c\u5426\u5219\u5916\u7f51\u5c06\u4e0d\u80fd\u8bbf\u95ee\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>os tips centos\u5b89\u88c5\u907f\u5751 could not resolve host \/ Network is  [&hellip;]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","hentry","category-it"],"_links":{"self":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=171"}],"version-history":[{"count":16,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samcheng.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}