-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.json
More file actions
1 lines (1 loc) · 427 KB
/
db.json
File metadata and controls
1 lines (1 loc) · 427 KB
1
{"meta":{"version":1,"warehouse":"5.0.1"},"models":{"Asset":[{"_id":"node_modules/hexo-theme-landscape/source/css/style.styl","path":"css/style.styl","modified":0,"renderable":1},{"_id":"node_modules/hexo-theme-landscape/source/fancybox/jquery.fancybox.min.css","path":"fancybox/jquery.fancybox.min.css","modified":0,"renderable":1},{"_id":"node_modules/hexo-theme-landscape/source/fancybox/jquery.fancybox.min.js","path":"fancybox/jquery.fancybox.min.js","modified":0,"renderable":1},{"_id":"node_modules/hexo-theme-landscape/source/js/jquery-3.6.4.min.js","path":"js/jquery-3.6.4.min.js","modified":0,"renderable":1},{"_id":"node_modules/hexo-theme-landscape/source/js/script.js","path":"js/script.js","modified":0,"renderable":1},{"_id":"node_modules/hexo-theme-landscape/source/css/images/banner.jpg","path":"css/images/banner.jpg","modified":0,"renderable":1},{"_id":"themes/redefine/source/assets/hbe.style.css","path":"assets/hbe.style.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/assets/odometer-theme-minimal.css","path":"assets/odometer-theme-minimal.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/style.styl","path":"css/style.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/all.min.css","path":"fontawesome/all.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/brands.min.css","path":"fontawesome/brands.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/duotone.min.css","path":"fontawesome/duotone.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/fontawesome.min.css","path":"fontawesome/fontawesome.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/light.min.css","path":"fontawesome/light.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/regular.min.css","path":"fontawesome/regular.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/sharp-solid.min.css","path":"fontawesome/sharp-solid.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/solid.min.css","path":"fontawesome/solid.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/svg-with-js.min.css","path":"fontawesome/svg-with-js.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/thin.min.css","path":"fontawesome/thin.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/v4-font-face.min.css","path":"fontawesome/v4-font-face.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/v4-shims.min.css","path":"fontawesome/v4-shims.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fontawesome/v5-font-face.min.css","path":"fontawesome/v5-font-face.min.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/fonts.css","path":"fonts/fonts.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-700.woff","path":"fonts/noto-sans-sc-v26-chinese-simplified-700.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-700.woff2","path":"fonts/noto-sans-sc-v26-chinese-simplified-700.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff","path":"fonts/noto-sans-sc-v26-chinese-simplified-regular.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff2","path":"fonts/noto-sans-sc-v26-chinese-simplified-regular.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/ubuntu-mono-v15-latin-regular.woff","path":"fonts/ubuntu-mono-v15-latin-regular.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/ubuntu-mono-v15-latin-regular.woff2","path":"fonts/ubuntu-mono-v15-latin-regular.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/loading.svg","path":"images/loading.svg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/redefine-avatar.svg","path":"images/redefine-avatar.svg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/redefine-favicon.svg","path":"images/redefine-favicon.svg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/redefine-logo.svg","path":"images/redefine-logo.svg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/redefine-logo.webp","path":"images/redefine-logo.webp","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/main.js","path":"js/main.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/utils.js","path":"js/utils.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-brands-400.ttf","path":"webfonts/fa-brands-400.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-brands-400.woff2","path":"webfonts/fa-brands-400.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-duotone-900.ttf","path":"webfonts/fa-duotone-900.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-duotone-900.woff2","path":"webfonts/fa-duotone-900.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-light-300.ttf","path":"webfonts/fa-light-300.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-light-300.woff2","path":"webfonts/fa-light-300.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-regular-400.ttf","path":"webfonts/fa-regular-400.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-regular-400.woff2","path":"webfonts/fa-regular-400.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-sharp-solid-900.ttf","path":"webfonts/fa-sharp-solid-900.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-sharp-solid-900.woff2","path":"webfonts/fa-sharp-solid-900.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-solid-900.ttf","path":"webfonts/fa-solid-900.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-solid-900.woff2","path":"webfonts/fa-solid-900.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-thin-100.ttf","path":"webfonts/fa-thin-100.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-thin-100.woff2","path":"webfonts/fa-thin-100.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-v4compatibility.ttf","path":"webfonts/fa-v4compatibility.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/webfonts/fa-v4compatibility.woff2","path":"webfonts/fa-v4compatibility.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/assets/build/styles.css","path":"assets/build/styles.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/animated.styl","path":"css/common/animated.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/basic.styl","path":"css/common/basic.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/markdown.styl","path":"css/common/markdown.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/redefine-theme.styl","path":"css/common/redefine-theme.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/variables.styl","path":"css/common/variables.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/archive-content.styl","path":"css/layout/archive-content.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/article-content.styl","path":"css/layout/article-content.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/category-content.styl","path":"css/layout/category-content.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/category-list.styl","path":"css/layout/category-list.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/home-content.styl","path":"css/layout/home-content.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/home-sidebar.styl","path":"css/layout/home-sidebar.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/page.styl","path":"css/layout/page.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/layout/tag-content.styl","path":"css/layout/tag-content.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.eot","path":"fonts/Satoshi/Satoshi-Variable.eot","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.ttf","path":"fonts/Satoshi/Satoshi-Variable.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.woff","path":"fonts/Satoshi/Satoshi-Variable.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.woff2","path":"fonts/Satoshi/Satoshi-Variable.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.eot","path":"fonts/Satoshi/Satoshi-VariableItalic.eot","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.ttf","path":"fonts/Satoshi/Satoshi-VariableItalic.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.woff","path":"fonts/Satoshi/Satoshi-VariableItalic.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.woff2","path":"fonts/Satoshi/Satoshi-VariableItalic.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Satoshi/satoshi.css","path":"fonts/Satoshi/satoshi.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.ttf","path":"fonts/Chillax/Chillax-Variable.ttf","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.eot","path":"fonts/Chillax/Chillax-Variable.eot","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.woff","path":"fonts/Chillax/Chillax-Variable.woff","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.woff2","path":"fonts/Chillax/Chillax-Variable.woff2","modified":0,"renderable":1},{"_id":"themes/redefine/source/fonts/Chillax/chillax.css","path":"fonts/Chillax/chillax.css","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/layouts/categoryList.js","path":"js/layouts/categoryList.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/layouts/lazyload.js","path":"js/layouts/lazyload.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/layouts/navbarShrink.js","path":"js/layouts/navbarShrink.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/layouts/toc.js","path":"js/layouts/toc.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/APlayer.min.js","path":"js/libs/APlayer.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/APlayer.min.js.map","path":"js/libs/APlayer.min.js.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/Swup.min.js","path":"js/libs/Swup.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/Swup.min.js.map","path":"js/libs/Swup.min.js.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupPreloadPlugin.min.js","path":"js/libs/SwupPreloadPlugin.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupPreloadPlugin.min.js.map","path":"js/libs/SwupPreloadPlugin.min.js.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupProgressPlugin.min.js","path":"js/libs/SwupProgressPlugin.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupScriptsPlugin.min.js","path":"js/libs/SwupScriptsPlugin.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupScrollPlugin.min.js","path":"js/libs/SwupScrollPlugin.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupScrollPlugin.min.js.map","path":"js/libs/SwupScrollPlugin.min.js.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/Typed.min.js","path":"js/libs/Typed.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/SwupSlideTheme.min.js","path":"js/libs/SwupSlideTheme.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/anime.min.js","path":"js/libs/anime.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/mermaid.min.js","path":"js/libs/mermaid.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/mermaid.min.js.map","path":"js/libs/mermaid.min.js.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/minimasonry.min.js","path":"js/libs/minimasonry.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/odometer.min.js","path":"js/libs/odometer.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/pjax.min.js","path":"js/libs/pjax.min.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/waline.mjs","path":"js/libs/waline.mjs","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/libs/waline.mjs.map","path":"js/libs/waline.mjs.map","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/aplayer.js","path":"js/plugins/aplayer.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/hbe.js","path":"js/plugins/hbe.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/masonry.js","path":"js/plugins/masonry.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/mermaid.js","path":"js/plugins/mermaid.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/tabs.js","path":"js/plugins/tabs.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/plugins/typed.js","path":"js/plugins/typed.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/codeBlock.js","path":"js/tools/codeBlock.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/imageViewer.js","path":"js/tools/imageViewer.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/lightDarkSwitch.js","path":"js/tools/lightDarkSwitch.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/localSearch.js","path":"js/tools/localSearch.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/runtime.js","path":"js/tools/runtime.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/scrollTopBottom.js","path":"js/tools/scrollTopBottom.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/js/tools/tocToggle.js","path":"js/tools/tocToggle.js","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/codeblock/code-block.styl","path":"css/common/codeblock/code-block.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/codeblock/code-theme.styl","path":"css/common/codeblock/code-theme.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/css/common/codeblock/highlight.styl","path":"css/common/codeblock/highlight.styl","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/long.jpg","path":"images/long.jpg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/logo.png","path":"images/logo.png","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/long2.jpg","path":"images/long2.jpg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/00003.webp","path":"images/00003.webp","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/shenguoqi.jpg","path":"images/shenguoqi.jpg","modified":0,"renderable":1},{"_id":"themes/redefine/source/images/cutimg1.png","path":"images/cutimg1.png","modified":1,"renderable":1}],"Cache":[{"_id":"source/_posts/hello-world.md","hash":"385996276947135d998d9837cd113f434c63b202","modified":1708043956000},{"_id":"node_modules/hexo-theme-landscape/LICENSE","hash":"c480fce396b23997ee23cc535518ffaaf7f458f8","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/README.md","hash":"1a9b279e6dd29fd19245f913f0c4a316ffaa62db","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/_config.yml","hash":"b608c1f1322760dce9805285a602a95832730a2e","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/package.json","hash":"4bf95d52f77edf811f23f6d264a7493311a8d078","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/de-DE.yml","hash":"d29d1c4256b7ed9df42f511c2ff0a23ad5fd6c1f","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/de.yml","hash":"3ebf0775abbee928c8d7bda943c191d166ded0d3","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/default.yml","hash":"ea5e6aee4cb14510793ac4593a3bddffe23e530c","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/en-GB.yml","hash":"ea5e6aee4cb14510793ac4593a3bddffe23e530c","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/en-US.yml","hash":"ea5e6aee4cb14510793ac4593a3bddffe23e530c","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/en.yml","hash":"3083f319b352d21d80fc5e20113ddf27889c9d11","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/es-ES.yml","hash":"7008a8fc91f18d2a735864817b8ebda30c7a2c66","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/es.yml","hash":"76edb1171b86532ef12cfd15f5f2c1ac3949f061","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/fr-FR.yml","hash":"8d09dbdab00a30a2870b56f7c0a7ca7deafa7b88","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/fr.yml","hash":"415e1c580ced8e4ce20b3b0aeedc3610341c76fb","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/hu-HU.yml","hash":"712d18664898fa21ba38d4973e90ef41a324ea25","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/hu.yml","hash":"284d557130bf54a74e7dcef9d42096130e4d9550","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/it-IT.yml","hash":"2cb6dc2fab9bd2dbe1c8bb869a9e8bf85a564fdd","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/it.yml","hash":"89b7d91306b2c1a0f3ac023b657bf974f798a1e8","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ja-JP.yml","hash":"08481267e0c112e1f6855620f2837ec4c4a98bbd","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ko-KR.yml","hash":"19209ad8f9d4057e8df808937f950eb265e1db69","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ja.yml","hash":"a73e1b9c80fd6e930e2628b393bfe3fb716a21a9","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ko.yml","hash":"881d6a0a101706e0452af81c580218e0bfddd9cf","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/mn-MN.yml","hash":"b9e5f3e7c0c2f779cf2cfded6db847b5941637ca","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/mn.yml","hash":"2e7523951072a9403ead3840ad823edd1084c116","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/nl-NL.yml","hash":"5ebbc30021f05d99938f96dfff280392df7f91f0","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/nl.yml","hash":"12ed59faba1fc4e8cdd1d42ab55ef518dde8039c","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/no.yml","hash":"965a171e70347215ec726952e63f5b47930931ef","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/pt-PT.yml","hash":"0f852b6b228e6ea59aa3540574bb89b233f2a098","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/pt.yml","hash":"57d07b75d434fbfc33b0ddb543021cb5f53318a8","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ru-RU.yml","hash":"360d11a28bb768afb1dd15f63fa7fd3a8cc547ee","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/ru.yml","hash":"4fda301bbd8b39f2c714e2c934eccc4b27c0a2b0","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/th-TH.yml","hash":"ebfdba9bc4842c829473c1e6e4544344f182724d","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/th.yml","hash":"84a55b00aa01f03982be294e43c33a20e6d32862","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/tr.yml","hash":"a1cdbfa17682d7a971de8ab8588bf57c74224b5b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/zh-CN.yml","hash":"1efd95774f401c80193eac6ee3f1794bfe93dc5a","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/languages/zh-TW.yml","hash":"53ce3000c5f767759c7d2c4efcaa9049788599c3","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/archive.ejs","hash":"2703b07cc8ac64ae46d1d263f4653013c7e1666b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/category.ejs","hash":"765426a9c8236828dc34759e604cc2c52292835a","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/index.ejs","hash":"aa1b4456907bdb43e629be3931547e2d29ac58c8","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/layout.ejs","hash":"0d1765036e4874500e68256fedb7470e96eeb6ee","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/page.ejs","hash":"7d80e4e36b14d30a7cd2ac1f61376d9ebf264e8b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/post.ejs","hash":"7d80e4e36b14d30a7cd2ac1f61376d9ebf264e8b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/tag.ejs","hash":"eaa7b4ccb2ca7befb90142e4e68995fb1ea68b2e","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/scripts/fancybox.js","hash":"c857d7a5e4a5d71c743a009c5932bf84229db428","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/after-footer.ejs","hash":"377d257d5d16e0158a4405c72401517b074fd7ff","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/archive-post.ejs","hash":"c7a71425a946d05414c069ec91811b5c09a92c47","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/archive.ejs","hash":"7cb70a7a54f8c7ae49b10d1f37c0a9b74eab8826","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/article.ejs","hash":"56597e951203dd662a6d2c817c7c4f1c920d4a25","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/footer.ejs","hash":"3656eb692254346671abc03cb3ba1459829e0dce","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/gauges-analytics.ejs","hash":"21a1e2a3907d1a3dad1cd0ab855fe6735f233c74","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/google-analytics.ejs","hash":"2ea7442ea1e1a8ab4e41e26c563f58413b59a3d0","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/head.ejs","hash":"f05bced793b0314d4f2ef0c993b3a51d0b7d203a","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/header.ejs","hash":"6a5033d189554c9a6d42e2ef7952ae5c9742648e","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/mobile-nav.ejs","hash":"e952a532dfc583930a666b9d4479c32d4a84b44e","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/sidebar.ejs","hash":"930da35cc2d447a92e5ee8f835735e6fd2232469","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_widget/archive.ejs","hash":"beb4a86fcc82a9bdda9289b59db5a1988918bec3","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_widget/category.ejs","hash":"dd1e5af3c6af3f5d6c85dfd5ca1766faed6a0b05","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_widget/recent_posts.ejs","hash":"60c4b012dcc656438ff59997e60367e5a21ab746","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_widget/tag.ejs","hash":"2de380865df9ab5f577f7d3bcadf44261eb5faae","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_widget/tagcloud.ejs","hash":"b4a2079101643f63993dcdb32925c9b071763b46","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_extend.styl","hash":"222fbe6d222531d61c1ef0f868c90f747b1c2ced","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_variables.styl","hash":"ca28281423ae57d76b6c1eb91cd845fd4e518bd6","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/style.styl","hash":"e55a1d92954ed20f6887f92dc727bb995a010a43","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/fancybox/jquery.fancybox.min.css","hash":"1be9b79be02a1cfc5d96c4a5e0feb8f472babd95","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/js/script.js","hash":"49773efcb2221bbdf2d86f3f5c5ff2d841b528cc","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/category.ejs","hash":"c6bcd0e04271ffca81da25bcff5adf3d46f02fc0","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/date.ejs","hash":"f1458584b679545830b75bef2526e2f3eb931045","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/gallery.ejs","hash":"3d9d81a3c693ff2378ef06ddb6810254e509de5b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/nav.ejs","hash":"16a904de7bceccbb36b4267565f2215704db2880","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/tag.ejs","hash":"2fcb0bf9c8847a644167a27824c9bb19ac74dd14","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/layout/_partial/post/title.ejs","hash":"4d7e62574ddf46de9b41605fe3140d77b5ddb26d","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/archive.styl","hash":"db15f5677dc68f1730e82190bab69c24611ca292","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/article.styl","hash":"2d1f6f79ebf9cb55ebdb3865a2474437eb2b37c6","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/comment.styl","hash":"79d280d8d203abb3bd933ca9b8e38c78ec684987","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/footer.styl","hash":"e35a060b8512031048919709a8e7b1ec0e40bc1b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/header.styl","hash":"268d2989acb06e2ddd06cc36a6918c6cd865476b","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/highlight.styl","hash":"9cc3b2927d814f2f6e8e188f9d3657b94f4c6ef3","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/mobile.styl","hash":"a399cf9e1e1cec3e4269066e2948d7ae5854d745","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/sidebar-aside.styl","hash":"890349df5145abf46ce7712010c89237900b3713","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/sidebar-bottom.styl","hash":"8fd4f30d319542babfd31f087ddbac550f000a8a","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_partial/sidebar.styl","hash":"404ec059dc674a48b9ab89cd83f258dec4dcb24d","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_util/grid.styl","hash":"0bf55ee5d09f193e249083602ac5fcdb1e571aed","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/_util/mixin.styl","hash":"44f32767d9fd3c1c08a60d91f181ee53c8f0dbb3","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/fancybox/jquery.fancybox.min.js","hash":"6181412e73966696d08e1e5b1243a572d0f22ba6","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/js/jquery-3.6.4.min.js","hash":"eda46747c71d38a880bee44f9a439c3858bb8f99","modified":1707635696000},{"_id":"node_modules/hexo-theme-landscape/source/css/images/banner.jpg","hash":"f44aa591089fcb3ec79770a1e102fd3289a7c6a6","modified":1707635696000},{"_id":"public/2023/11/26/hello-world/index.html","hash":"f4dbfdd26f35f7b911a137110bb97a1b0d1f5e7c","modified":1707639611980},{"_id":"public/archives/index.html","hash":"f47d1679be9a8b657c9e1382cfa21bdcff67c31a","modified":1707639611980},{"_id":"public/archives/2023/index.html","hash":"e00c9ccdb889d714389b86b4fc39dcf7598ed889","modified":1707639611980},{"_id":"public/archives/2023/11/index.html","hash":"209dbe965876f819d712495efa9beb512f840ac4","modified":1707639611980},{"_id":"public/index.html","hash":"d1e95339bc8eb4fe7b824b48ab4100053182b117","modified":1707639611980},{"_id":"public/fancybox/jquery.fancybox.min.css","hash":"1be9b79be02a1cfc5d96c4a5e0feb8f472babd95","modified":1707636031256},{"_id":"public/css/style.css","hash":"c60fe0c9515176d6ec99264fe0e3597ee69b95d6","modified":1707637587496},{"_id":"public/js/jquery-3.6.4.min.js","hash":"eda46747c71d38a880bee44f9a439c3858bb8f99","modified":1707636031256},{"_id":"public/fancybox/jquery.fancybox.min.js","hash":"6181412e73966696d08e1e5b1243a572d0f22ba6","modified":1707636031256},{"_id":"public/js/script.js","hash":"49773efcb2221bbdf2d86f3f5c5ff2d841b528cc","modified":1707636031256},{"_id":"public/css/images/banner.jpg","hash":"f44aa591089fcb3ec79770a1e102fd3289a7c6a6","modified":1707636031256},{"_id":"themes/redefine/.gitignore","hash":"66c386f9b2072d2bea694266c97bdc35d655376c","modified":1707298966000},{"_id":"themes/redefine/.npmignore","hash":"79596a6faba67852ff4d0426602141426f48639f","modified":1707298966000},{"_id":"themes/redefine/CODE_OF_CONDUCT.md","hash":"61a6276ef54989b7a1325f3ecb3183a4dfdf50cb","modified":1707298966000},{"_id":"themes/redefine/CONTRIBUTING.md","hash":"c6ef834f602b7ae02e2863a2a857e0ce8d392f15","modified":1707298966000},{"_id":"themes/redefine/DONATION.md","hash":"c04ce21a6a0ff9ccd31e792abd17fe6257c681ab","modified":1707298966000},{"_id":"themes/redefine/LICENSE","hash":"1de7bacb4fbbd7b6d391a69abfe174c2509ec303","modified":1707298966000},{"_id":"themes/redefine/README.md","hash":"d0098f5cc5553a2fb0a113234316f787056fcbfb","modified":1707298966000},{"_id":"themes/redefine/README_zh-CN.md","hash":"722b6f495e802718b8a0184d74ac534ae3f13293","modified":1707298966000},{"_id":"themes/redefine/README_zh-TW.md","hash":"d8854f435e2d9e892eb91d2865c486161e34d043","modified":1707298966000},{"_id":"themes/redefine/_config.yml","hash":"3b6a3c01894d3c1d649f586636d3c4224cda15ca","modified":1707884916000},{"_id":"themes/redefine/package.json","hash":"eb9c860d5a49421c96398da33c36e5ed295ea2e0","modified":1707298966000},{"_id":"themes/redefine/tailwind.config.js","hash":"337bb6bff0d90c339f156c0cb34f0662b335797c","modified":1707298966000},{"_id":"themes/redefine/languages/ja.yml","hash":"8a125bb668274de2985f12f3eb9b9857e22e389f","modified":1707298966000},{"_id":"themes/redefine/.github/FUNDING.yml","hash":"7d7dc34bf08883dad940625ac098790bd1a50fb0","modified":1707298966000},{"_id":"themes/redefine/languages/en.yml","hash":"157f84538d34fb3d47a05482a8b45c1e1a5c8ef8","modified":1707298966000},{"_id":"themes/redefine/languages/zh-CN.yml","hash":"cf234f835d1f2ab84521d88b693e3cbb4488f2d8","modified":1708038966000},{"_id":"themes/redefine/languages/zh-TW.yml","hash":"84819d96f8c27f51ece8f1eabc74b9f79b16db2e","modified":1707298966000},{"_id":"themes/redefine/layout/404.ejs","hash":"8456f112fc12bbb1c83cd190d0ce83ee474bd297","modified":1707298966000},{"_id":"themes/redefine/layout/archive-content.ejs","hash":"2adfbb9954af9fcf2047c8abc85d4664d45167af","modified":1707298966000},{"_id":"themes/redefine/layout/archive.ejs","hash":"8456f112fc12bbb1c83cd190d0ce83ee474bd297","modified":1707298966000},{"_id":"themes/redefine/layout/article-content.ejs","hash":"cc491efae332fad6dff69c9ffc65dc5368c3d2c4","modified":1707298966000},{"_id":"themes/redefine/layout/category-content.ejs","hash":"5c4fdc9c2b7f225edb7ebb2abf6925b81c5e698f","modified":1707298966000},{"_id":"themes/redefine/layout/category-list.ejs","hash":"4bd20b18bdf10dfdce5ddcddfac2605800d18973","modified":1707298966000},{"_id":"themes/redefine/layout/category.ejs","hash":"8456f112fc12bbb1c83cd190d0ce83ee474bd297","modified":1707298966000},{"_id":"themes/redefine/layout/index.ejs","hash":"f5fee4e079a9c2c23059ebde4cd89ec723e310c6","modified":1707298966000},{"_id":"themes/redefine/layout/layout.ejs","hash":"e13ebcba0323e0641457d04009c6b548b914ef3d","modified":1707298966000},{"_id":"themes/redefine/layout/page.ejs","hash":"0d43cc355011db0c5815610205851efd3ccbf691","modified":1707298966000},{"_id":"themes/redefine/layout/tag.ejs","hash":"8456f112fc12bbb1c83cd190d0ce83ee474bd297","modified":1707298966000},{"_id":"themes/redefine/layout/tag-content.ejs","hash":"6134aa2a112b9d8daa3eeaf9a1ee41bbeaf7eb24","modified":1707298966000},{"_id":"themes/redefine/layout/tags.ejs","hash":"8456f112fc12bbb1c83cd190d0ce83ee474bd297","modified":1707298966000},{"_id":"themes/redefine/scripts/dataHandle.js","hash":"3a069d3f529dceed3fd98e99d5940989f1087305","modified":1707298966000},{"_id":"themes/redefine/.github/ISSUE_TEMPLATE/bug-chinese.yml","hash":"5616b1ba5ddcd91755fce55fdb6d13022e5d39c0","modified":1707298966000},{"_id":"themes/redefine/.github/ISSUE_TEMPLATE/bug-english.yml","hash":"23bcdb79064f0e967258be662777c3a424140782","modified":1707298966000},{"_id":"themes/redefine/.github/ISSUE_TEMPLATE/enhancement-chinese.yml","hash":"b55c4e79ea4946318324c79b8be61a8ae16cc5c9","modified":1707298966000},{"_id":"themes/redefine/.github/ISSUE_TEMPLATE/enhancement-english.yml","hash":"e43dc9d37f8ad5cdfd12aacf6f85b71346ae6e9b","modified":1707298966000},{"_id":"themes/redefine/.github/workflows/aliyun_cdn.yml","hash":"5b857a504539b739df992fa2894ba72fde6985ca","modified":1707298966000},{"_id":"themes/redefine/.github/workflows/npm-publish.yml","hash":"2b1771ae2a71e3c148b09d507f9be47d04e6e623","modified":1707298966000},{"_id":"themes/redefine/layout/_meta/article-copyright.ejs","hash":"8e97d76ded33d1e334c376451e2f3d5fd177a958","modified":1707298966000},{"_id":"themes/redefine/layout/_meta/article-info.ejs","hash":"1d551beb7cc47d6c841ce63a7f0f0ffb30c1770b","modified":1707298966000},{"_id":"themes/redefine/layout/_meta/home-article.ejs","hash":"b54a0df26341fa5f26a6e1eedb91cd11014d50c5","modified":1707298966000},{"_id":"themes/redefine/layout/_plugins/aplayer.ejs","hash":"c8f275cdbbe14b4673c69f7c1463b1f830ec8e40","modified":1707298966000},{"_id":"themes/redefine/layout/_plugins/swup.ejs","hash":"9fbfd2872dfbe92ec715357d5238647987d8cbdf","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/404-template.ejs","hash":"e3574f623ea22ec3e90413909321a9a3b447f7e2","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/footer.ejs","hash":"79c42b613b9b0c73d5de39cf469a6d8ee722fcff","modified":1707884936000},{"_id":"themes/redefine/layout/_partials/head.ejs","hash":"09edf7c6c0a8d093a2d7c34290188b71dcefdea8","modified":1707639610000},{"_id":"themes/redefine/layout/_partials/home-background.ejs","hash":"dd120259ab091b8087d0194ea2291676556efad8","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/home-banner.ejs","hash":"5cc6d0a703c207e86c9def16c0885ec69b3c8658","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/home-content.ejs","hash":"9443d55dd5ae33350fec8181b43057b93f831604","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/navbar.ejs","hash":"bc2aa13a6bbb12eb7a4c0d7e5f1df965a2bde311","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/page-template.ejs","hash":"5d03f543ae291598ee227af758da73304a51633e","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/home-sidebar.ejs","hash":"976d24d01194a9340957617db24b30f63c1ba66b","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/preloader.ejs","hash":"d10892f0930da50e41b62cb1ad64ccc043eb9302","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/scripts.ejs","hash":"1f0219c25aa35f4129686f290e987a3f28b3869d","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/archive-list.ejs","hash":"66364723e353e006f3b4af790f8c93d3e44c812b","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/essays.ejs","hash":"e4332342b7dd95449c2a84edfe8323f54db6f4b5","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/friends-link.ejs","hash":"bacaf6f0e958fa7d9be17a59d3a8bae4b9119501","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/image-viewer.ejs","hash":"beb3dec5e08856a29d585fe0eb94a8a6ddade4dd","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/local-search.ejs","hash":"72c9acca0280f0e63e6a5d31618dd2707bdbec3f","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/masonry.ejs","hash":"6b8ec5cff3dcf9f494b32237e6911c6e1e9dd9a1","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/paginator.ejs","hash":"a237e7b858e0cf32ca67553d540f7c5f7239a8d0","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/post-tools.ejs","hash":"c2d193e84e0781423ce1c018ee2be1116359d694","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/progress-bar.ejs","hash":"4cab094eafc72b19662a7c9eb888e632d7bb15e7","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/side-tools.ejs","hash":"3b6b75a902ba673f8f0a144db63bd144d0d5b648","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/tagcloud.ejs","hash":"640e40c859c610ae1d97b1fac7fb39b986b9f676","modified":1707298966000},{"_id":"themes/redefine/layout/_widgets/toc.ejs","hash":"46ef94dca9be59d163f6b4cba16e1695e8020bc3","modified":1707298966000},{"_id":"themes/redefine/scripts/events/404.js","hash":"169245d7b2af1ff401cf76e718c28b4e38f637c7","modified":1707298966000},{"_id":"themes/redefine/scripts/events/welcome.js","hash":"7666868f4b8f97fd80e6505122ffc363e4e1c322","modified":1707730884000},{"_id":"themes/redefine/scripts/filters/encrypt.js","hash":"0daf029e7441426afcab94f5f9e1ed316e3b71f6","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/imgHandle.js","hash":"b396fe7b6cbc331f2952aa7561f96c1f250d8c52","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/lazyloadHandle.js","hash":"f8ae44311e6463e887c07a41910ebade8766bac2","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/linkHandle.js","hash":"7d8cb128dbfed1a4ef9b07142a63ba0c6c383628","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/stylHandle.js","hash":"8a8bf069ce096bd7b42952c8e50c3c89758cbc13","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/tableHandle.js","hash":"c500c45cd9221788df1f31939c5399eabb62ebb5","modified":1707298966000},{"_id":"themes/redefine/scripts/helpers/articleRecommend.js","hash":"b9ede93bfd16af13871625d2d127bf79d99724d1","modified":1707298966000},{"_id":"themes/redefine/scripts/helpers/autoCanonical.js","hash":"f3ea74759129c71041371a1d77c687eb6aa88d3a","modified":1707298966000},{"_id":"themes/redefine/scripts/helpers/configExport.js","hash":"c1e5b36a8d8e97218c8cc1aab77ec38d5457c846","modified":1707298966000},{"_id":"themes/redefine/scripts/helpers/seoGenerate.js","hash":"e0059a60cc5978be6792dcf795a2ece3a509f41a","modified":1707298966000},{"_id":"themes/redefine/scripts/helpers/themeHelpers.js","hash":"2c2f9812a0d0593777da4edc0afe738988388451","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/btn.js","hash":"3e4c1b01a1f922f712895e9ac06c030231b35cf2","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/btns.js","hash":"a91492e772287114527a3fbc85f0c7c1c1b15eb3","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/folding.js","hash":"cfa6646c1350c557430149bd52578c6cac59063b","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/note-large.js","hash":"b3e19b9a5c57e3e029bf9ead84aac750f799a9b3","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/note.js","hash":"8fc9f2e7d78fe2d1644828d8a79e2c48597f6103","modified":1707298966000},{"_id":"themes/redefine/scripts/modules/tabs.js","hash":"74e3b0cdd009206f7b78b04dcb96eccd86e7a996","modified":1707298966000},{"_id":"themes/redefine/source/assets/hbe.style.css","hash":"29be8fc47be885e9954e310cbc68dfadd3b4cee6","modified":1707298966000},{"_id":"themes/redefine/source/assets/odometer-theme-minimal.css","hash":"793c31feb38e241a5ff6ecc5e65e61751507d728","modified":1707298966000},{"_id":"themes/redefine/source/css/style.styl","hash":"d9450b06a5391ba6f62690bfef2071a1c8e7e893","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/brands.min.css","hash":"5119c35bbd273d2ea2501997827f6d644da93164","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/light.min.css","hash":"18a176eb2486db4e938e568083fa578b641ccc83","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/regular.min.css","hash":"d27c4fed54dacff688010e51f611d950dd6e0aca","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/sharp-solid.min.css","hash":"7d1a13c6b8178b29f5bcb1a639a1998fc9de16c4","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/solid.min.css","hash":"e727feabedb171fb0b398151870d7739ef4e2432","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/svg-with-js.min.css","hash":"f4c08e37c4d44b3ed7a3f377d1cb5d7fca4d04bc","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/thin.min.css","hash":"3d46be31379b07ffb24d69c6c915725eaa2e89e9","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/v4-font-face.min.css","hash":"0be987628c8b485b39f064da41c90f15c0596c1f","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/v4-shims.min.css","hash":"96f037860b8e9b59af8e47571ea98791616dbfd8","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/v5-font-face.min.css","hash":"260ea7a5e0b89963a5dcf2600a4decdf0f408f3f","modified":1707298966000},{"_id":"themes/redefine/source/fonts/fonts.css","hash":"850cf3679dfc1f5b7fe44b1377f2f85f1ec8531f","modified":1707298966000},{"_id":"themes/redefine/source/fonts/ubuntu-mono-v15-latin-regular.woff","hash":"c7abad03bf081ed35bb434cb5b34b5c59c852f16","modified":1707298966000},{"_id":"themes/redefine/source/fonts/ubuntu-mono-v15-latin-regular.woff2","hash":"e583803593916547b1101a56c216526fa2d26d1c","modified":1707298966000},{"_id":"themes/redefine/source/images/redefine-avatar.svg","hash":"d0d20061bda08894a82d7691b660be7c6aaa0608","modified":1707298966000},{"_id":"themes/redefine/source/images/redefine-favicon.svg","hash":"420f930a1df64a3c4391ff80326a8a2d7d5a6418","modified":1707298966000},{"_id":"themes/redefine/source/images/redefine-logo.svg","hash":"472776b6f013aad44706fee6c94201c96ee83932","modified":1707298966000},{"_id":"themes/redefine/source/images/redefine-logo.webp","hash":"0a07e3fb6d9125dee44798c8c110187b16fb42a9","modified":1707298966000},{"_id":"themes/redefine/source/images/wallhaven-wqery6-dark.webp","hash":"d0066e0b025ae748448a3d6a96165d45a55d2f22","modified":1707298966000},{"_id":"themes/redefine/source/images/wallhaven-wqery6-light.webp","hash":"d25389973d0359b78f1e9c74a850ef425690ba40","modified":1707298966000},{"_id":"themes/redefine/source/js/main.js","hash":"55dd6c873e56ffe8f83673ed60edc1d6d8e97f75","modified":1707735242000},{"_id":"themes/redefine/source/js/utils.js","hash":"00fe71414bf6a95bd4438cb301cf9096df90c46c","modified":1707298966000},{"_id":"themes/redefine/source/images/loading.svg","hash":"938c2a41c8ba18e37ed659e481696e40a4c8f3a4","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-v4compatibility.ttf","hash":"b54531dd09c5089eb93b12ce8f90ff521855ff8a","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-v4compatibility.woff2","hash":"d02b1adc81fd5bec023e25a7770779b99d6dd742","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/comments/comment.ejs","hash":"e0c2e22351d2740e7f7584028a9ea7c87f26372f","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/comments/giscus.ejs","hash":"5a20975c17daeed5a602dedd0682a29d7c56e42f","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/comments/gitalk.ejs","hash":"1e1cf5e5f883f2bde0a76d6edb1d42bbd125c313","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/comments/twikoo.ejs","hash":"2945e818e4406fbb5628a465023c7e4d445c0975","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/comments/waline.ejs","hash":"73a07a2fd56cb2ab53b86c15a3152929f57635d9","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/sidebar-components/author.ejs","hash":"422aed0f3f67529c1ea87ee43f8f680ffc531b45","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/sidebar-components/avatar.ejs","hash":"47cd8318471493c82f5e5983550145d4fd0a2ddc","modified":1707298966000},{"_id":"themes/redefine/layout/_partials/sidebar-components/statistics.ejs","hash":"4329363d232de541e1cb8f24eb59c1a8bacc9b9c","modified":1707298966000},{"_id":"themes/redefine/scripts/filters/lib/hbe.default.js","hash":"fee2c92011ef007121b992193bbab0f3b196d873","modified":1707298966000},{"_id":"themes/redefine/source/assets/build/styles.css","hash":"4110074a98eeb49ac6c92f8d6f894cfeb0e10d2d","modified":1707298966000},{"_id":"themes/redefine/source/css/common/animated.styl","hash":"ab52b066c427cee62d67e4da136878114c7b1afe","modified":1707298966000},{"_id":"themes/redefine/source/css/common/basic.styl","hash":"0493e7ae8c2b07cf1172fa1b68ea1ec74795878b","modified":1707298966000},{"_id":"themes/redefine/source/css/common/markdown.styl","hash":"df479df045886a9d3d683304f35c1051537cb685","modified":1707298966000},{"_id":"themes/redefine/source/css/common/redefine-theme.styl","hash":"ff099b1959829e3070e5077c4a3b13e1c1573e79","modified":1707298966000},{"_id":"themes/redefine/source/css/common/variables.styl","hash":"f6a059c35ad1eb531f42345003879e1764b34c00","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/archive-content.styl","hash":"4e329547447c716c986e0b4a4f54afc59fc6b486","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/article-content.styl","hash":"2328b11599e30e84aa3e801e177f11ad45abc0f4","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/category-content.styl","hash":"4f9a5559b5269ec74b5f49ac113268f747bf0243","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/category-list.styl","hash":"d33a8d0e8f2d58d759bf7b9da69c2aa6a0d9f433","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/home-sidebar.styl","hash":"a9842014f60979f2aec3fe7ed8b1721968afcaed","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/home-content.styl","hash":"299a383d78d1ddbeafbdf39dad5d007d5ee300f8","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/page.styl","hash":"e5c0b44623d18d0c2674069b3796546dd9857b8d","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/tag-content.styl","hash":"6c9ec582c1d8699bdff5a4cd1524121cc6ca8522","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.woff","hash":"d731068e2b28d4f1dfe5b4dbe8cce9c082fa8572","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.woff2","hash":"2d34d398b398a7fd88d21fae7642cdca908bf3ee","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.woff","hash":"e44272b921c0a14e77c640cc4cf209c4b80cb205","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.woff2","hash":"dafa429c1d0a4b053b8fbb8c70478b8dbcb9ee9c","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/satoshi.css","hash":"59b058f8bc9144c7799b86af728cf44dc7b3921c","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.woff","hash":"fc0e791429c274c4c9312d810e7ae9503cab34ab","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Chillax/chillax.css","hash":"ac7d8777d601070e08fb262ec6d7bc97c508afa7","modified":1707298966000},{"_id":"themes/redefine/source/js/layouts/categoryList.js","hash":"eb1af2cd0726f56ff7861222ea543315fe295a17","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.woff2","hash":"fc5d99b40db9deca7d151f9bd16b96ff160828b7","modified":1707298966000},{"_id":"themes/redefine/source/js/layouts/lazyload.js","hash":"c06323d68bbdebbb685db5010e7655b8ed0caf42","modified":1707298966000},{"_id":"themes/redefine/source/js/layouts/navbarShrink.js","hash":"3e80bf9ef719b2ddb2d1c4b67eb169d2ef52dbb8","modified":1707298966000},{"_id":"themes/redefine/source/js/layouts/toc.js","hash":"7a768982f6cb1f40552cce063d5743fe862db762","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/APlayer.min.js","hash":"22caa28ff6b41a16ff40f15d38f1739e22359478","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/Swup.min.js","hash":"cc054d34e74a1feecfae75064f6a4d6107607396","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupPreloadPlugin.min.js","hash":"d911512891ecbe1935203bcd3d93427ad75e45c8","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupPreloadPlugin.min.js.map","hash":"40513fec1323b601667876a97a9ef8a0c88bff63","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupProgressPlugin.min.js","hash":"fd30fe1c43072017f67bbaac18b962a5ac218711","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupScriptsPlugin.min.js","hash":"b17f3434035f1339d6f9cd5c8a055d2a1b6602e9","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupScrollPlugin.min.js","hash":"6c3afca9bb98f79d14516c093f27e3e50a3fd82e","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupScrollPlugin.min.js.map","hash":"63cf04ba556b256379e103ef7d3ba12d629449a4","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/Typed.min.js","hash":"e8ce2b674a637b0c0396a3106c1aedf10186249c","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/anime.min.js","hash":"47cb482a8a488620a793d50ba8f6752324b46af3","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/SwupSlideTheme.min.js","hash":"e9d143780e879d958164b1356b7f918ec25e838a","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/minimasonry.min.js","hash":"9681cc509cb8aa733d36aad032e6e8acdb33c08c","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/odometer.min.js","hash":"fe5beb60997c84ab2f91b54535c4221443cdd21f","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/pjax.min.js","hash":"3d796e5be9cdd4067c94e190ea2482d7fdb4856c","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/aplayer.js","hash":"150ceb910584ccd0b4a9558d9e2360c1409c1149","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/hbe.js","hash":"abd3b27238e26dc3bdd65e0e69fa514fa432a75b","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/masonry.js","hash":"92734a30a21f8b16f20aa75208f6c082890275fb","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/mermaid.js","hash":"303254d382869ed618025fcb328426bd10314583","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/tabs.js","hash":"964ec5c25a8d78763ba2ba9bfbd5b1b49ed05381","modified":1707298966000},{"_id":"themes/redefine/source/js/plugins/typed.js","hash":"01799d5c07633f33b1d2893f524054074d56ec65","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/codeBlock.js","hash":"344e6c83e6ffda22f6e5bc724d603066b49a7d8b","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/imageViewer.js","hash":"f2ed02b6489c601821cd257c6ffa28c25f07bdd7","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/lightDarkSwitch.js","hash":"97b7e68f871dc218fceca77b85ac051c7c6306af","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/localSearch.js","hash":"f6e59f65c676457198c2cf5d78bd06052499ee38","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/runtime.js","hash":"eb0374b6f033f7ac25f49b1b079aa163e14b0fcd","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/scrollTopBottom.js","hash":"9e54fa4310bb98ea5ba61780a9ef56d05d475203","modified":1707298966000},{"_id":"themes/redefine/source/js/tools/tocToggle.js","hash":"c2224ff0370fcf109e94194613b9480a3913c82d","modified":1707298966000},{"_id":"themes/redefine/source/css/common/codeblock/code-block.styl","hash":"0593c3555640bb9132caaccac9821225ea3b97c8","modified":1707298966000},{"_id":"themes/redefine/source/css/common/codeblock/code-theme.styl","hash":"a3cc2e7a83a8ed575681f6cb6e3b4ef205689c2a","modified":1707298966000},{"_id":"themes/redefine/source/css/common/codeblock/highlight.styl","hash":"39a8032d5ca2872ef9268856a77d212200d07651","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_modules/aplayer.styl","hash":"f3943142b2415a0ff7c2c36729e8f8939b548222","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_modules/buttons.styl","hash":"18bd3c1d00e2cc6416cef69433b207ae5c947ba1","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_modules/folding.styl","hash":"b5e5c2407eb83ae4b3ee4ed73490dcd41edef705","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_modules/notes.styl","hash":"37b2a4a0669414c74498ed0ecae873c90b15fe6e","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_modules/tabs.styl","hash":"dbf47ca4ceb2951843b3170ec893077216158191","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/404.styl","hash":"16215f6fe664d1ddc5744a626405bc774dc30f70","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/archive-list.styl","hash":"feb29ecef348bdf2dfd0525424105b390864ff69","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/article-copyright-info.styl","hash":"810d182789bce6fc27a30e2eafc21d3d292fb9af","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/article-meta-info.styl","hash":"1f680910751b36c4445a48c5a48eda3187412eaf","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/footer.styl","hash":"b9028c74a9f75536d5a7cee77a25a5d77469515a","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/home-banner.styl","hash":"76760ac45a15598d844c99829b5f73d2908b831f","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/image-viewer.styl","hash":"6c8eeb7a96cae110cd9a684a3a5076148b8154d8","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/local-search.styl","hash":"a9c99c57b27afbe7f00f1f14f0e46c41748affb5","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/navbar.styl","hash":"95c5bf83b5e50d305e1aaf6ef4dbe9f86e217201","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/paginator.styl","hash":"53421b731f3d7ed34a3a4c87405e06ae3d6519e0","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/post-tools.styl","hash":"d602c2fe191d2c639f7cd8c4d0ee618f8c80f5c1","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/progress-bar.styl","hash":"d3715280d9b62d89ccd1b79ab5e5f030669f4d88","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/page-template.styl","hash":"c57dccb2fdc13fc7bceb730c7b0eda9590557bd9","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/side-tools.styl","hash":"995982b8c228f7386d352042f64587d06663716e","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/tagcloud.styl","hash":"756f84cf4ac8c21a169c60c8f227954a09218bee","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/toc.styl","hash":"13949981a5afa2b0483da1836af5999d992961f9","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/comments/comment.styl","hash":"71529ec72f356c78f75a752e5400c1197aa5ea96","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/comments/gitalk.styl","hash":"85f26189ec6dee13a0a743687e7b5391f170c33f","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/comments/waline.styl","hash":"24ad25f1344b51f0ccb436644e70d95e84fd8f40","modified":1707298966000},{"_id":"themes/redefine/source/css/layout/_partials/comments/twikoo.styl","hash":"448cbc045bcffa2d666094b81dd99eb980676fff","modified":1707298966000},{"_id":"themes/redefine/package-lock.json","hash":"0d780c0b1d723e48bc22d4904ba0602987e07236","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-brands-400.woff2","hash":"a358912d781e6249a8d291e4ce9ebd0a9ab9452e","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.eot","hash":"2b6ff9014b62876c03d8f579bf00ffcc6ac44bd8","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-Variable.ttf","hash":"d49872a745842f389bc9d24b73d0a3090fce50b1","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.eot","hash":"7525ee5ad63e4bb198910286ff176587f43fc5c3","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Satoshi/Satoshi-VariableItalic.ttf","hash":"62c34444221ff17e93a8e1cadfea5a8c68ea705b","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/Swup.min.js.map","hash":"f74755d9318a86939791027767f631472b876207","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/fontawesome.min.css","hash":"44e6d666b45a6875e4fce11159876129e7a1cceb","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-brands-400.ttf","hash":"ba9322d66c19f635e15e458cc39fcb509818332f","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.ttf","hash":"01aafadc0ca4ace59127a5594a8f534e83b84879","modified":1707298966000},{"_id":"themes/redefine/source/fonts/Chillax/Chillax-Variable.eot","hash":"50a4e2ab17155fe7449e0ee488a6242180f3b256","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/APlayer.min.js.map","hash":"31a19da0f0cb6b00ec212eafa847f31af86788df","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/waline.mjs","hash":"b53165275a5606f6d26bba216f4b218dcc790837","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-sharp-solid-900.woff2","hash":"74d0af1108ab8157993ca03cef80e89e35e2408d","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/duotone.min.css","hash":"0becc4b085bd9d377a8ff4b5160f8e19c8ec27a0","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-solid-900.woff2","hash":"e73d164db2aff2c91d18c07da03e8db9d0c5dfd4","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-duotone-900.woff2","hash":"2cc24434345b80a844a6bda1139539fe41e4df53","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-light-300.woff2","hash":"def760895375328ccdcf62b2b9b9001a21947acd","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-regular-400.woff2","hash":"486fed640153de1de84f460834c73daef060ed20","modified":1707298966000},{"_id":"themes/redefine/source/fontawesome/all.min.css","hash":"630bf0e29410ec27622f65d1270c6bc435cdff21","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-thin-100.woff2","hash":"e0a4482c20f6b67784df54965539a317a3bd681b","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-sharp-solid-900.ttf","hash":"0d710cd7bd1b7ff574e88bb812de82babe45e415","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-solid-900.ttf","hash":"40b536c3667547db70ee9ca6f3c94fbc33e0cab7","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/mermaid.min.js","hash":"c11ca6043d8dae028448a808105f8c888faac8f5","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-regular-400.ttf","hash":"cdec068700dc440530e5bbeff7e8bb33a01b4132","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/waline.mjs.map","hash":"a58abd8799bfa9580d5835ea6a79862c059aedcd","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-light-300.ttf","hash":"cc5d9f4f994c82e23f58cdde1eec8792d81633c7","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-thin-100.ttf","hash":"c1fee6e6986b14533ce022afada5fbe10c0f6562","modified":1707298966000},{"_id":"themes/redefine/source/webfonts/fa-duotone-900.ttf","hash":"e0313a772ea710cb5ea4bd08f5dedb0a0025f8ca","modified":1707298966000},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff2","hash":"eb3b3063cf2be7bd96146051168f11327f4e28d7","modified":1707298966000},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-700.woff2","hash":"3a046e40a1b2a8537a2d60db4f3b4f915852a722","modified":1707298966000},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff","hash":"7c2e7b6873eabd4dc1fe2aee5c6d542fe8743356","modified":1707298966000},{"_id":"themes/redefine/source/fonts/noto-sans-sc-v26-chinese-simplified-700.woff","hash":"11df5a4313f3730378dd78fcfcb444d845b389e1","modified":1707298966000},{"_id":"themes/redefine/source/js/libs/mermaid.min.js.map","hash":"7d303cf926754817c4360f92e6c39b8c390cdbdb","modified":1707298966000},{"_id":"public/404.html","hash":"19394869d8ca34e1121f3c7ad2b9cb7368cebca5","modified":1707639611980},{"_id":"public/fonts/ubuntu-mono-v15-latin-regular.woff","hash":"c7abad03bf081ed35bb434cb5b34b5c59c852f16","modified":1707637587496},{"_id":"public/fonts/ubuntu-mono-v15-latin-regular.woff2","hash":"e583803593916547b1101a56c216526fa2d26d1c","modified":1707637587496},{"_id":"public/images/loading.svg","hash":"938c2a41c8ba18e37ed659e481696e40a4c8f3a4","modified":1707637587496},{"_id":"public/images/redefine-avatar.svg","hash":"d0d20061bda08894a82d7691b660be7c6aaa0608","modified":1707637587496},{"_id":"public/images/redefine-favicon.svg","hash":"420f930a1df64a3c4391ff80326a8a2d7d5a6418","modified":1707637587496},{"_id":"public/images/redefine-logo.svg","hash":"472776b6f013aad44706fee6c94201c96ee83932","modified":1707637587496},{"_id":"public/images/redefine-logo.webp","hash":"0a07e3fb6d9125dee44798c8c110187b16fb42a9","modified":1707637587496},{"_id":"public/images/wallhaven-wqery6-dark.webp","hash":"d0066e0b025ae748448a3d6a96165d45a55d2f22","modified":1707637587496},{"_id":"public/images/wallhaven-wqery6-light.webp","hash":"d25389973d0359b78f1e9c74a850ef425690ba40","modified":1707637587496},{"_id":"public/webfonts/fa-v4compatibility.ttf","hash":"b54531dd09c5089eb93b12ce8f90ff521855ff8a","modified":1707637587496},{"_id":"public/webfonts/fa-v4compatibility.woff2","hash":"d02b1adc81fd5bec023e25a7770779b99d6dd742","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-Variable.woff","hash":"d731068e2b28d4f1dfe5b4dbe8cce9c082fa8572","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-Variable.woff2","hash":"2d34d398b398a7fd88d21fae7642cdca908bf3ee","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-VariableItalic.woff","hash":"e44272b921c0a14e77c640cc4cf209c4b80cb205","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-VariableItalic.woff2","hash":"dafa429c1d0a4b053b8fbb8c70478b8dbcb9ee9c","modified":1707637587496},{"_id":"public/fonts/Chillax/Chillax-Variable.woff2","hash":"fc5d99b40db9deca7d151f9bd16b96ff160828b7","modified":1707637587496},{"_id":"public/assets/hbe.style.css","hash":"29be8fc47be885e9954e310cbc68dfadd3b4cee6","modified":1707637587496},{"_id":"public/assets/odometer-theme-minimal.css","hash":"793c31feb38e241a5ff6ecc5e65e61751507d728","modified":1707637587496},{"_id":"public/fontawesome/light.min.css","hash":"18a176eb2486db4e938e568083fa578b641ccc83","modified":1707637587496},{"_id":"public/fontawesome/regular.min.css","hash":"d27c4fed54dacff688010e51f611d950dd6e0aca","modified":1707637587496},{"_id":"public/fontawesome/sharp-solid.min.css","hash":"7d1a13c6b8178b29f5bcb1a639a1998fc9de16c4","modified":1707637587496},{"_id":"public/fontawesome/solid.min.css","hash":"e727feabedb171fb0b398151870d7739ef4e2432","modified":1707637587496},{"_id":"public/fontawesome/thin.min.css","hash":"3d46be31379b07ffb24d69c6c915725eaa2e89e9","modified":1707637587496},{"_id":"public/fontawesome/v4-font-face.min.css","hash":"0be987628c8b485b39f064da41c90f15c0596c1f","modified":1707637587496},{"_id":"public/fontawesome/v5-font-face.min.css","hash":"260ea7a5e0b89963a5dcf2600a4decdf0f408f3f","modified":1707637587496},{"_id":"public/fonts/fonts.css","hash":"850cf3679dfc1f5b7fe44b1377f2f85f1ec8531f","modified":1707637587496},{"_id":"public/js/main.js","hash":"9d1d5167d8b966786268841abdf3c1639fd6d13a","modified":1707637587496},{"_id":"public/js/utils.js","hash":"00fe71414bf6a95bd4438cb301cf9096df90c46c","modified":1707637587496},{"_id":"public/fontawesome/brands.min.css","hash":"5119c35bbd273d2ea2501997827f6d644da93164","modified":1707637587496},{"_id":"public/fontawesome/fontawesome.min.css","hash":"44e6d666b45a6875e4fce11159876129e7a1cceb","modified":1707637587496},{"_id":"public/fontawesome/duotone.min.css","hash":"0becc4b085bd9d377a8ff4b5160f8e19c8ec27a0","modified":1707637587496},{"_id":"public/fontawesome/svg-with-js.min.css","hash":"f4c08e37c4d44b3ed7a3f377d1cb5d7fca4d04bc","modified":1707637587496},{"_id":"public/fontawesome/all.min.css","hash":"630bf0e29410ec27622f65d1270c6bc435cdff21","modified":1707637587496},{"_id":"public/fontawesome/v4-shims.min.css","hash":"96f037860b8e9b59af8e47571ea98791616dbfd8","modified":1707637587496},{"_id":"public/fonts/Chillax/Chillax-Variable.woff","hash":"fc0e791429c274c4c9312d810e7ae9503cab34ab","modified":1707637587496},{"_id":"public/js/libs/SwupPreloadPlugin.min.js.map","hash":"40513fec1323b601667876a97a9ef8a0c88bff63","modified":1707637587496},{"_id":"public/js/libs/SwupScrollPlugin.min.js.map","hash":"63cf04ba556b256379e103ef7d3ba12d629449a4","modified":1707637587496},{"_id":"public/css/hbe.style.css","hash":"29be8fc47be885e9954e310cbc68dfadd3b4cee6","modified":1707637587496},{"_id":"public/lib/hbe.js","hash":"abd3b27238e26dc3bdd65e0e69fa514fa432a75b","modified":1707637587496},{"_id":"public/webfonts/fa-brands-400.woff2","hash":"a358912d781e6249a8d291e4ce9ebd0a9ab9452e","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-Variable.eot","hash":"2b6ff9014b62876c03d8f579bf00ffcc6ac44bd8","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-Variable.ttf","hash":"d49872a745842f389bc9d24b73d0a3090fce50b1","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-VariableItalic.eot","hash":"7525ee5ad63e4bb198910286ff176587f43fc5c3","modified":1707637587496},{"_id":"public/fonts/Satoshi/Satoshi-VariableItalic.ttf","hash":"62c34444221ff17e93a8e1cadfea5a8c68ea705b","modified":1707637587496},{"_id":"public/css/common/animated.css","hash":"638a1974b6ef420acc84f5d3539d93324b62219f","modified":1707637587496},{"_id":"public/css/common/redefine-theme.css","hash":"da39a3ee5e6b4b0d3255bfef95601890afd80709","modified":1707637587496},{"_id":"public/css/common/markdown.css","hash":"990fd367ba0ad8f158abded8d77f091e2d9f1085","modified":1707637587496},{"_id":"public/css/layout/archive-content.css","hash":"da39a3ee5e6b4b0d3255bfef95601890afd80709","modified":1707637587496},{"_id":"public/css/common/variables.css","hash":"807fafff6f983933550a03f0be7a41d393c8a1a0","modified":1707637587496},{"_id":"public/css/layout/category-content.css","hash":"5593febb0cf50446355dcd3ca56803997d5fe2f5","modified":1707637587496},{"_id":"public/css/layout/category-list.css","hash":"6dad00432778b2963e4b8712cb993e18779270a8","modified":1707637587496},{"_id":"public/css/layout/home-content.css","hash":"dea31ea76b8d270db31288132c23f714ede47e86","modified":1707637587496},{"_id":"public/css/layout/home-sidebar.css","hash":"2c0b13f8bfec3d3bd31307090d402a14acc5774e","modified":1707637587496},{"_id":"public/css/layout/page.css","hash":"9b6cee5a8c77176e87a404ffd6516975d43a4a4e","modified":1707637587496},{"_id":"public/css/layout/tag-content.css","hash":"c88785317c2d21dcf2c90d152d3adc85ccbbeece","modified":1707637587496},{"_id":"public/fonts/Satoshi/satoshi.css","hash":"59b058f8bc9144c7799b86af728cf44dc7b3921c","modified":1707637587496},{"_id":"public/fonts/Chillax/chillax.css","hash":"ac7d8777d601070e08fb262ec6d7bc97c508afa7","modified":1707637587496},{"_id":"public/js/layouts/categoryList.js","hash":"eb1af2cd0726f56ff7861222ea543315fe295a17","modified":1707637587496},{"_id":"public/js/layouts/lazyload.js","hash":"c06323d68bbdebbb685db5010e7655b8ed0caf42","modified":1707637587496},{"_id":"public/js/layouts/navbarShrink.js","hash":"3e80bf9ef719b2ddb2d1c4b67eb169d2ef52dbb8","modified":1707637587496},{"_id":"public/js/layouts/toc.js","hash":"7a768982f6cb1f40552cce063d5743fe862db762","modified":1707637587496},{"_id":"public/js/libs/SwupPreloadPlugin.min.js","hash":"d911512891ecbe1935203bcd3d93427ad75e45c8","modified":1707637587496},{"_id":"public/js/libs/SwupProgressPlugin.min.js","hash":"fd30fe1c43072017f67bbaac18b962a5ac218711","modified":1707637587496},{"_id":"public/js/libs/SwupScriptsPlugin.min.js","hash":"b17f3434035f1339d6f9cd5c8a055d2a1b6602e9","modified":1707637587496},{"_id":"public/js/libs/SwupScrollPlugin.min.js","hash":"6c3afca9bb98f79d14516c093f27e3e50a3fd82e","modified":1707637587496},{"_id":"public/js/libs/SwupSlideTheme.min.js","hash":"e9d143780e879d958164b1356b7f918ec25e838a","modified":1707637587496},{"_id":"public/js/libs/Typed.min.js","hash":"e8ce2b674a637b0c0396a3106c1aedf10186249c","modified":1707637587496},{"_id":"public/js/libs/minimasonry.min.js","hash":"9681cc509cb8aa733d36aad032e6e8acdb33c08c","modified":1707637587496},{"_id":"public/js/libs/odometer.min.js","hash":"fe5beb60997c84ab2f91b54535c4221443cdd21f","modified":1707637587496},{"_id":"public/js/plugins/aplayer.js","hash":"150ceb910584ccd0b4a9558d9e2360c1409c1149","modified":1707637587496},{"_id":"public/js/plugins/hbe.js","hash":"abd3b27238e26dc3bdd65e0e69fa514fa432a75b","modified":1707637587496},{"_id":"public/js/plugins/masonry.js","hash":"92734a30a21f8b16f20aa75208f6c082890275fb","modified":1707637587496},{"_id":"public/js/plugins/mermaid.js","hash":"303254d382869ed618025fcb328426bd10314583","modified":1707637587496},{"_id":"public/js/plugins/tabs.js","hash":"964ec5c25a8d78763ba2ba9bfbd5b1b49ed05381","modified":1707637587496},{"_id":"public/js/plugins/typed.js","hash":"01799d5c07633f33b1d2893f524054074d56ec65","modified":1707637587496},{"_id":"public/js/tools/codeBlock.js","hash":"344e6c83e6ffda22f6e5bc724d603066b49a7d8b","modified":1707637587496},{"_id":"public/js/tools/imageViewer.js","hash":"f2ed02b6489c601821cd257c6ffa28c25f07bdd7","modified":1707637587496},{"_id":"public/js/tools/lightDarkSwitch.js","hash":"97b7e68f871dc218fceca77b85ac051c7c6306af","modified":1707637587496},{"_id":"public/js/tools/localSearch.js","hash":"f6e59f65c676457198c2cf5d78bd06052499ee38","modified":1707637587496},{"_id":"public/js/tools/runtime.js","hash":"eb0374b6f033f7ac25f49b1b079aa163e14b0fcd","modified":1707637587496},{"_id":"public/js/tools/scrollTopBottom.js","hash":"9e54fa4310bb98ea5ba61780a9ef56d05d475203","modified":1707637587496},{"_id":"public/js/tools/tocToggle.js","hash":"c2224ff0370fcf109e94194613b9480a3913c82d","modified":1707637587496},{"_id":"public/css/common/codeblock/code-theme.css","hash":"609cce68af538b9de8dc1a0cb28a4e796e658099","modified":1707637587496},{"_id":"public/css/common/codeblock/code-block.css","hash":"a88885a3e204d747dde91d090c29088aa5317e0e","modified":1707637587496},{"_id":"public/assets/build/styles.css","hash":"4110074a98eeb49ac6c92f8d6f894cfeb0e10d2d","modified":1707637587496},{"_id":"public/css/common/basic.css","hash":"ab2c2dcfef280535334d31ea4935400dd613f01b","modified":1707637587496},{"_id":"public/css/layout/article-content.css","hash":"fee679004f3a5a5480731f7e61d964e8531edd5c","modified":1707637587496},{"_id":"public/js/libs/APlayer.min.js","hash":"22caa28ff6b41a16ff40f15d38f1739e22359478","modified":1707637587496},{"_id":"public/js/libs/Swup.min.js","hash":"cc054d34e74a1feecfae75064f6a4d6107607396","modified":1707637587496},{"_id":"public/js/libs/anime.min.js","hash":"47cb482a8a488620a793d50ba8f6752324b46af3","modified":1707637587496},{"_id":"public/js/libs/pjax.min.js","hash":"3d796e5be9cdd4067c94e190ea2482d7fdb4856c","modified":1707637587496},{"_id":"public/css/common/codeblock/highlight.css","hash":"90a68e8dfd001225a57a70f1be6c1fa191b77672","modified":1707637587496},{"_id":"public/js/libs/Swup.min.js.map","hash":"f74755d9318a86939791027767f631472b876207","modified":1707637587496},{"_id":"public/webfonts/fa-brands-400.ttf","hash":"ba9322d66c19f635e15e458cc39fcb509818332f","modified":1707637587496},{"_id":"public/fonts/Chillax/Chillax-Variable.ttf","hash":"01aafadc0ca4ace59127a5594a8f534e83b84879","modified":1707637587496},{"_id":"public/fonts/Chillax/Chillax-Variable.eot","hash":"50a4e2ab17155fe7449e0ee488a6242180f3b256","modified":1707637587496},{"_id":"public/js/libs/mermaid.min.js","hash":"c11ca6043d8dae028448a808105f8c888faac8f5","modified":1707637587496},{"_id":"public/js/libs/APlayer.min.js.map","hash":"31a19da0f0cb6b00ec212eafa847f31af86788df","modified":1707637587496},{"_id":"public/js/libs/waline.mjs","hash":"b53165275a5606f6d26bba216f4b218dcc790837","modified":1707637587496},{"_id":"public/webfonts/fa-sharp-solid-900.woff2","hash":"74d0af1108ab8157993ca03cef80e89e35e2408d","modified":1707637587496},{"_id":"public/webfonts/fa-solid-900.woff2","hash":"e73d164db2aff2c91d18c07da03e8db9d0c5dfd4","modified":1707637587496},{"_id":"public/webfonts/fa-light-300.woff2","hash":"def760895375328ccdcf62b2b9b9001a21947acd","modified":1707637587496},{"_id":"public/webfonts/fa-duotone-900.woff2","hash":"2cc24434345b80a844a6bda1139539fe41e4df53","modified":1707637587496},{"_id":"public/webfonts/fa-regular-400.woff2","hash":"486fed640153de1de84f460834c73daef060ed20","modified":1707637587496},{"_id":"public/webfonts/fa-thin-100.woff2","hash":"e0a4482c20f6b67784df54965539a317a3bd681b","modified":1707637587496},{"_id":"public/webfonts/fa-sharp-solid-900.ttf","hash":"0d710cd7bd1b7ff574e88bb812de82babe45e415","modified":1707637587496},{"_id":"public/webfonts/fa-solid-900.ttf","hash":"40b536c3667547db70ee9ca6f3c94fbc33e0cab7","modified":1707637587496},{"_id":"public/webfonts/fa-regular-400.ttf","hash":"cdec068700dc440530e5bbeff7e8bb33a01b4132","modified":1707637587496},{"_id":"public/js/libs/waline.mjs.map","hash":"a58abd8799bfa9580d5835ea6a79862c059aedcd","modified":1707637587496},{"_id":"public/webfonts/fa-light-300.ttf","hash":"cc5d9f4f994c82e23f58cdde1eec8792d81633c7","modified":1707637587496},{"_id":"public/webfonts/fa-thin-100.ttf","hash":"c1fee6e6986b14533ce022afada5fbe10c0f6562","modified":1707637587496},{"_id":"public/webfonts/fa-duotone-900.ttf","hash":"e0313a772ea710cb5ea4bd08f5dedb0a0025f8ca","modified":1707637587496},{"_id":"public/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff2","hash":"eb3b3063cf2be7bd96146051168f11327f4e28d7","modified":1707637587496},{"_id":"public/fonts/noto-sans-sc-v26-chinese-simplified-700.woff2","hash":"3a046e40a1b2a8537a2d60db4f3b4f915852a722","modified":1707637587496},{"_id":"public/fonts/noto-sans-sc-v26-chinese-simplified-regular.woff","hash":"7c2e7b6873eabd4dc1fe2aee5c6d542fe8743356","modified":1707637587496},{"_id":"public/fonts/noto-sans-sc-v26-chinese-simplified-700.woff","hash":"11df5a4313f3730378dd78fcfcb444d845b389e1","modified":1707637587496},{"_id":"public/js/libs/mermaid.min.js.map","hash":"7d303cf926754817c4360f92e6c39b8c390cdbdb","modified":1707637587496},{"_id":"themes/redefine/source/images/long.jpg","hash":"07763c18e94cb3a3fc4f83330ca0e9a17a8eab3b","modified":1707638830000},{"_id":"public/images/long.jpg","hash":"07763c18e94cb3a3fc4f83330ca0e9a17a8eab3b","modified":1707639490984},{"_id":"source/categories/index.md","hash":"41d314dfb8e3c1e84a7a81ee798741756b9a8962","modified":1707796100000},{"_id":"source/tags/index.md","hash":"2723e7863e803cdd1889fa284fd1739a5dfcd948","modified":1707796088000},{"_id":"source/_posts/categories/index.md","hash":"b8325a04e4d5f24620802924f1e664ec8dedec4d","modified":1707133238000},{"_id":"themes/redefine/source/images/wallhaven-3zgz2y_1920x1080.webp","hash":"047bec81d1c202639a25680d12feeecbd1a717ba","modified":1707718006000},{"_id":"source/showcase/index.md","hash":"92fdd6ff07a33ce1149a2184a3abf76cf2458d8a","modified":1707796094000},{"_id":"source/_data/essays.yml","hash":"89db617a9b6b2369e384472b14c2a4042b85e81e","modified":1707133238000},{"_id":"source/_data/links.yml","hash":"c946e43e4854db6fa0d5e14a6733ee8e57f180fe","modified":1707884894000},{"_id":"source/_posts/docker.md","hash":"60211d37a34864abbf6ee28f225ed68ab564a1e9","modified":1707784730000},{"_id":"source/_posts/linux.md","hash":"404ee0a58b648fd855517ca96c511fa29d12e48e","modified":1707784662000},{"_id":"source/_posts/widows.md","hash":"a7452abc98204075f532e92ae9740d3175fb411c","modified":1707784812000},{"_id":"themes/redefine/source/images/logo.png","hash":"200738d0147ff91910717fa5f170967cf3947a32","modified":1707795296000},{"_id":"source/about/index.md","hash":"130e259028037b96c204609d6de5d4613e33fb78","modified":1707796286000},{"_id":"themes/redefine/source/images/long2.jpg","hash":"2abef19a092db09082e3f9003325d347a087a694","modified":1707792932000},{"_id":"themes/redefine/source/images/wallhaven-coding.webp","hash":"047bec81d1c202639a25680d12feeecbd1a717ba","modified":1707718006000},{"_id":"themes/redefine/source/images/00003.webp","hash":"7bdf038a28443299f32e5ba49c70cc73658db3eb","modified":1707803096000},{"_id":"themes/redefine/source/images/tiananmen.jpg","hash":"f2dc9fd4c3903ceadceaa40ff345adb35c406c16","modified":1708039012000},{"_id":"themes/redefine/source/images/shenguoqi.jpg","hash":"698989ea63e2dd3ab3fa6580bbf4a2568a4773ba","modified":1708039600000},{"_id":"source/_posts/net9","hash":"f54210f45bc0b312e976375da60d498f9f1717b2","modified":1708489686000},{"_id":"source/_posts/net9.md","hash":"83f69b2c86735d56d8d8e5577dd93b56fd1f48c0","modified":1708491508000},{"_id":"themes/redefine/source/images/cutimg1.png","hash":"30cf4fa9f14be7802fd293b60ff35b191251ab89","modified":1708491380000}],"Category":[{"name":"更新日志","_id":"clsiledq0000340cza7ib7k7p"},{"name":"随记","_id":"clsilewm0000f40czhfre1ms3"},{"name":"工具教程","_id":"clsjmshs80001locz31ad87ie"},{"name":"编程教程","_id":"clsvap2ad00010oczd1avajad"}],"Data":[{"_id":"links","data":[{"links_category":"常用地址 / Common Url","has_thumbnail":false,"list":[{"name":"PH BLOG","link":"http://ph88.ink/","description":"phenix个人博客","avatar":"https://evan.beee.top/avatar.png"}]}]}],"Page":[{"title":"tags","date":"2024-02-11T14:12:43.000Z","_content":"","source":"tags/index.md","raw":"---\ntitle: tags\ndate: 2024-02-11 22:12:43\n---\n","updated":"2024-02-13T03:48:08.000Z","path":"tags/index.html","_id":"clsil956f000040cz5ttiazkw","comments":1,"layout":"page","content":"","excerpt":"","more":""},{"title":"categories","date":"2024-02-11T14:12:43.000Z","_content":"","source":"categories/index.md","raw":"---\ntitle: categories\ndate: 2024-02-11 22:12:43\n---\n","updated":"2024-02-13T03:48:20.000Z","path":"categories/index.html","_id":"clsil956h000240cz34zyhx96","comments":1,"layout":"page","content":"","excerpt":"","more":""},{"title":"网站收藏夹","type":"links","comment":true,"date":"2024-02-11T14:12:43.000Z","_content":"\n\n{% notel info 收藏夹说明 %}\n更新个人推荐的一些常用网站\n{% endnotel %}\n\n","source":"showcase/index.md","raw":"---\ntitle: 网站收藏夹\ntype: links\ncomment: true\ndate: 2024-02-11 22:12:43\n---\n\n\n{% notel info 收藏夹说明 %}\n更新个人推荐的一些常用网站\n{% endnotel %}\n\n","updated":"2024-02-13T03:48:14.000Z","path":"showcase/index.html","_id":"clsim2jl1000n40czdxeccgxt","comments":1,"layout":"page","content":"\n <div class=\"note-large info\">\n <div class=\"notel-title rounded-t-lg p-3 font-bold text-lg flex flex-row gap-2 items-center\">\n <p>收藏夹说明</p>\n\n </div>\n <div class=\"notel-content\">\n <p>更新个人推荐的一些常用网站</p>\n\n </div>\n </div>\n\n","excerpt":"","more":"\n <div class=\"note-large info\">\n <div class=\"notel-title rounded-t-lg p-3 font-bold text-lg flex flex-row gap-2 items-center\">\n <p>收藏夹说明</p>\n\n </div>\n <div class=\"notel-content\">\n <p>更新个人推荐的一些常用网站</p>\n\n </div>\n </div>\n\n"},{"title":"关于我","comment":true,"date":"2024-02-16T11:56:33.000Z","_content":"\n# 介绍\nHi there! \n\nHere are more details about me:\n\n# 项目\nHere are some of the projects I’ve worked on:\n\n\n# 联系方式\nYou can also find me on:\n\n# 网站","source":"about/index.md","raw":"---\ntitle: 关于我\ncomment: true\ndate: 2024-02-16 19:56:33\n---\n\n# 介绍\nHi there! \n\nHere are more details about me:\n\n# 项目\nHere are some of the projects I’ve worked on:\n\n\n# 联系方式\nYou can also find me on:\n\n# 网站","updated":"2024-02-13T03:51:26.000Z","path":"about/index.html","_id":"clsjtpfy5000060cz5s6g5j8w","comments":1,"layout":"page","content":"<h1 id=\"介绍\"><a href=\"#介绍\" class=\"headerlink\" title=\"介绍\"></a>介绍</h1><p>Hi there! </p>\n<p>Here are more details about me:</p>\n<h1 id=\"项目\"><a href=\"#项目\" class=\"headerlink\" title=\"项目\"></a>项目</h1><p>Here are some of the projects I’ve worked on:</p>\n<h1 id=\"联系方式\"><a href=\"#联系方式\" class=\"headerlink\" title=\"联系方式\"></a>联系方式</h1><p>You can also find me on:</p>\n<h1 id=\"网站\"><a href=\"#网站\" class=\"headerlink\" title=\"网站\"></a>网站</h1>","excerpt":"","more":"<h1 id=\"介绍\"><a href=\"#介绍\" class=\"headerlink\" title=\"介绍\"></a>介绍</h1><p>Hi there! </p>\n<p>Here are more details about me:</p>\n<h1 id=\"项目\"><a href=\"#项目\" class=\"headerlink\" title=\"项目\"></a>项目</h1><p>Here are some of the projects I’ve worked on:</p>\n<h1 id=\"联系方式\"><a href=\"#联系方式\" class=\"headerlink\" title=\"联系方式\"></a>联系方式</h1><p>You can also find me on:</p>\n<h1 id=\"网站\"><a href=\"#网站\" class=\"headerlink\" title=\"网站\"></a>网站</h1>"}],"Post":[{"title":"PH BLOG 搭建日志","_content":"记录本站建立的日志,供参考交流\n\n## Git部分\n>[github官方文档](https://pages.github.com/)\n\n### ssh key\n```\nssh-keygen -t rsa -C \"xxx@xxx.com\"\ncat /root/.ssh/id_rsa.pub\n//github后台添加key以后,提交前验证\nssh -vT git@github.com\n```\n\n### 基础语句\n\n``` bash\nssh -vT xx@github.com\ngit init\ngit add README.md\ngit commit -m \"first commit\"\ngit git branch -M main\ngit remote add origin git@github.com:XXXXX/docs.git\ngit push --set-upstream origin master //推送到master分支\ngit push -u origin main 将 main 分支 push 到 GitHub\ngit push -u origin main\ngit push -f //强制推送\n```\n>如何在提交前,服务端产生了修改的部分,请先git pull,同步到本地,再进行提交\n\n### 修改文件\n\n`cd /文件所在目录`\n`git add 文件名`\n同新增操作\n\n### 删除文件夹\n```bash\ngit rm -r css\ngit commit -m \"delete\"\ngit push\n```\n\n### 创建忽略文件\n项目根目录创建文件.gitignore,将需要忽略的目录写入,比如:node_modules/\n\n## Hexo安装\n安装官方文档操作步骤即可,[https://hexo.io/zh-cn/docs/](https://hexo.io/zh-cn/docs/)\n\n## theme安装\n>[官方文档](https://redefine-docs.ohevan.com/getting-started)\n```\n//安装\nnpm install hexo-theme-redefine@latest\n//启用\n_config.yml\ntheme: redefine\n//创建主题配置文件\n在 Hexo 根目录下创建 _config.redefine.yml 文件。\n并将主题下的config文件复制进去的所有内容复制进去。\n本文件会自动覆盖主题的配置项,创建本文件的目的是为了方便你在升级主题时,不会丢失你的配置。\n```\n\n## 站点搜索\n`npm i hexo-generator-searchdb`\n\n## 自定义域名\n>一共两条记录\n- 在域名提供商,添加A记录,对应项目ip地址\n- 添加CNAME记录,对应repository的二级域名(如果使用二级域名,该域名和项目的name是一致的即可)\n\n## CDN\n- 选择合适的cdn进行加速,代理,这里需要根据cdn服务商提示,修改域名本身的dns(这里的修改在域名提供商的网站修改)\n- 由于github是强制https,所以在cdn中要勾选https,也就是ssl这一项,并选择\"Full (strict)\"模式,否则可能出现无限重定向导致无法访问\n\n\n## 搭建过程一些小问题\n- github上传以后,项目的编译解析过程需要等待,不会立即生效\n- 更换域名后,仍然会跳转到之前的域名,等待一天也换不过来,所以就删掉repository重建了一个\n- 一定要核对github对应项目的repository的setting中,pages显示的访问地址,所对应的ip地址,这里会变换地址,比如108,109这种,如果ip地址变换了,我们在自己的域名解析A记录未能正确对应的话,那么域名会无法访问到你的项目","source":"_posts/hello-world.md","raw":"---\ntitle: PH BLOG 搭建日志\ntags:\n - \"github\"\n - \"网站搭建\"\n - \"Hexo\"\n - \"CDN\"\ncategories:\n - \"随记\"\n---\n记录本站建立的日志,供参考交流\n\n## Git部分\n>[github官方文档](https://pages.github.com/)\n\n### ssh key\n```\nssh-keygen -t rsa -C \"xxx@xxx.com\"\ncat /root/.ssh/id_rsa.pub\n//github后台添加key以后,提交前验证\nssh -vT git@github.com\n```\n\n### 基础语句\n\n``` bash\nssh -vT xx@github.com\ngit init\ngit add README.md\ngit commit -m \"first commit\"\ngit git branch -M main\ngit remote add origin git@github.com:XXXXX/docs.git\ngit push --set-upstream origin master //推送到master分支\ngit push -u origin main 将 main 分支 push 到 GitHub\ngit push -u origin main\ngit push -f //强制推送\n```\n>如何在提交前,服务端产生了修改的部分,请先git pull,同步到本地,再进行提交\n\n### 修改文件\n\n`cd /文件所在目录`\n`git add 文件名`\n同新增操作\n\n### 删除文件夹\n```bash\ngit rm -r css\ngit commit -m \"delete\"\ngit push\n```\n\n### 创建忽略文件\n项目根目录创建文件.gitignore,将需要忽略的目录写入,比如:node_modules/\n\n## Hexo安装\n安装官方文档操作步骤即可,[https://hexo.io/zh-cn/docs/](https://hexo.io/zh-cn/docs/)\n\n## theme安装\n>[官方文档](https://redefine-docs.ohevan.com/getting-started)\n```\n//安装\nnpm install hexo-theme-redefine@latest\n//启用\n_config.yml\ntheme: redefine\n//创建主题配置文件\n在 Hexo 根目录下创建 _config.redefine.yml 文件。\n并将主题下的config文件复制进去的所有内容复制进去。\n本文件会自动覆盖主题的配置项,创建本文件的目的是为了方便你在升级主题时,不会丢失你的配置。\n```\n\n## 站点搜索\n`npm i hexo-generator-searchdb`\n\n## 自定义域名\n>一共两条记录\n- 在域名提供商,添加A记录,对应项目ip地址\n- 添加CNAME记录,对应repository的二级域名(如果使用二级域名,该域名和项目的name是一致的即可)\n\n## CDN\n- 选择合适的cdn进行加速,代理,这里需要根据cdn服务商提示,修改域名本身的dns(这里的修改在域名提供商的网站修改)\n- 由于github是强制https,所以在cdn中要勾选https,也就是ssl这一项,并选择\"Full (strict)\"模式,否则可能出现无限重定向导致无法访问\n\n\n## 搭建过程一些小问题\n- github上传以后,项目的编译解析过程需要等待,不会立即生效\n- 更换域名后,仍然会跳转到之前的域名,等待一天也换不过来,所以就删掉repository重建了一个\n- 一定要核对github对应项目的repository的setting中,pages显示的访问地址,所对应的ip地址,这里会变换地址,比如108,109这种,如果ip地址变换了,我们在自己的域名解析A记录未能正确对应的话,那么域名会无法访问到你的项目","slug":"hello-world","published":1,"date":"2023-11-25T20:14:22.000Z","updated":"2024-02-16T00:39:16.000Z","_id":"clsh6eim300000gczbehcd345","comments":1,"layout":"post","photos":[],"content":"<p>记录本站建立的日志,供参考交流</p>\n<h2 id=\"Git部分\"><a href=\"#Git部分\" class=\"headerlink\" title=\"Git部分\"></a>Git部分</h2><blockquote>\n<p><a class=\"link\" href=\"https://pages.github.com/\" >github官方文档 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<h3 id=\"ssh-key\"><a href=\"#ssh-key\" class=\"headerlink\" title=\"ssh key\"></a>ssh key</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ssh-keygen -t rsa -C "xxx@xxx.com"</span><br><span class=\"line\">cat /root/.ssh/id_rsa.pub</span><br><span class=\"line\">//github后台添加key以后,提交前验证</span><br><span class=\"line\">ssh -vT git@github.com</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"基础语句\"><a href=\"#基础语句\" class=\"headerlink\" title=\"基础语句\"></a>基础语句</h3><div class=\"highlight-container\" data-rel=\"Bash\"><figure class=\"iseeu highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ssh -vT xx@github.com</span><br><span class=\"line\">git init</span><br><span class=\"line\">git add README.md</span><br><span class=\"line\">git commit -m <span class=\"string\">"first commit"</span></span><br><span class=\"line\">git git branch -M main</span><br><span class=\"line\">git remote add origin git@github.com:XXXXX/docs.git</span><br><span class=\"line\">git push --set-upstream origin master //推送到master分支</span><br><span class=\"line\">git push -u origin main 将 main 分支 push 到 GitHub</span><br><span class=\"line\">git push -u origin main</span><br><span class=\"line\">git push -f //强制推送</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>如何在提交前,服务端产生了修改的部分,请先git pull,同步到本地,再进行提交</p>\n</blockquote>\n<h3 id=\"修改文件\"><a href=\"#修改文件\" class=\"headerlink\" title=\"修改文件\"></a>修改文件</h3><p><code>cd /文件所在目录</code><br><code>git add 文件名</code><br>同新增操作</p>\n<h3 id=\"删除文件夹\"><a href=\"#删除文件夹\" class=\"headerlink\" title=\"删除文件夹\"></a>删除文件夹</h3><div class=\"highlight-container\" data-rel=\"Bash\"><figure class=\"iseeu highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">git <span class=\"built_in\">rm</span> -r css</span><br><span class=\"line\">git commit -m <span class=\"string\">"delete"</span></span><br><span class=\"line\">git push</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"创建忽略文件\"><a href=\"#创建忽略文件\" class=\"headerlink\" title=\"创建忽略文件\"></a>创建忽略文件</h3><p>项目根目录创建文件.gitignore,将需要忽略的目录写入,比如:node_modules/</p>\n<h2 id=\"Hexo安装\"><a href=\"#Hexo安装\" class=\"headerlink\" title=\"Hexo安装\"></a>Hexo安装</h2><p>安装官方文档操作步骤即可,<a class=\"link\" href=\"https://hexo.io/zh-cn/docs/\" >https://hexo.io/zh-cn/docs/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<h2 id=\"theme安装\"><a href=\"#theme安装\" class=\"headerlink\" title=\"theme安装\"></a>theme安装</h2><blockquote>\n<p><a class=\"link\" href=\"https://redefine-docs.ohevan.com/getting-started\" >官方文档 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//安装</span><br><span class=\"line\">npm install hexo-theme-redefine@latest</span><br><span class=\"line\">//启用</span><br><span class=\"line\">_config.yml</span><br><span class=\"line\">theme: redefine</span><br><span class=\"line\">//创建主题配置文件</span><br><span class=\"line\">在 Hexo 根目录下创建 _config.redefine.yml 文件。</span><br><span class=\"line\">并将主题下的config文件复制进去的所有内容复制进去。</span><br><span class=\"line\">本文件会自动覆盖主题的配置项,创建本文件的目的是为了方便你在升级主题时,不会丢失你的配置。</span><br></pre></td></tr></table></figure></div>\n\n<h2 id=\"站点搜索\"><a href=\"#站点搜索\" class=\"headerlink\" title=\"站点搜索\"></a>站点搜索</h2><p><code>npm i hexo-generator-searchdb</code></p>\n<h2 id=\"自定义域名\"><a href=\"#自定义域名\" class=\"headerlink\" title=\"自定义域名\"></a>自定义域名</h2><blockquote>\n<p>一共两条记录</p>\n</blockquote>\n<ul>\n<li>在域名提供商,添加A记录,对应项目ip地址</li>\n<li>添加CNAME记录,对应repository的二级域名(如果使用二级域名,该域名和项目的name是一致的即可)</li>\n</ul>\n<h2 id=\"CDN\"><a href=\"#CDN\" class=\"headerlink\" title=\"CDN\"></a>CDN</h2><ul>\n<li>选择合适的cdn进行加速,代理,这里需要根据cdn服务商提示,修改域名本身的dns(这里的修改在域名提供商的网站修改)</li>\n<li>由于github是强制https,所以在cdn中要勾选https,也就是ssl这一项,并选择”Full (strict)”模式,否则可能出现无限重定向导致无法访问</li>\n</ul>\n<h2 id=\"搭建过程一些小问题\"><a href=\"#搭建过程一些小问题\" class=\"headerlink\" title=\"搭建过程一些小问题\"></a>搭建过程一些小问题</h2><ul>\n<li>github上传以后,项目的编译解析过程需要等待,不会立即生效</li>\n<li>更换域名后,仍然会跳转到之前的域名,等待一天也换不过来,所以就删掉repository重建了一个</li>\n<li>一定要核对github对应项目的repository的setting中,pages显示的访问地址,所对应的ip地址,这里会变换地址,比如108,109这种,如果ip地址变换了,我们在自己的域名解析A记录未能正确对应的话,那么域名会无法访问到你的项目</li>\n</ul>\n","excerpt":"","more":"<p>记录本站建立的日志,供参考交流</p>\n<h2 id=\"Git部分\"><a href=\"#Git部分\" class=\"headerlink\" title=\"Git部分\"></a>Git部分</h2><blockquote>\n<p><a class=\"link\" href=\"https://pages.github.com/\" >github官方文档 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<h3 id=\"ssh-key\"><a href=\"#ssh-key\" class=\"headerlink\" title=\"ssh key\"></a>ssh key</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ssh-keygen -t rsa -C "xxx@xxx.com"</span><br><span class=\"line\">cat /root/.ssh/id_rsa.pub</span><br><span class=\"line\">//github后台添加key以后,提交前验证</span><br><span class=\"line\">ssh -vT git@github.com</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"基础语句\"><a href=\"#基础语句\" class=\"headerlink\" title=\"基础语句\"></a>基础语句</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ssh -vT xx@github.com</span><br><span class=\"line\">git init</span><br><span class=\"line\">git add README.md</span><br><span class=\"line\">git commit -m <span class=\"string\">"first commit"</span></span><br><span class=\"line\">git git branch -M main</span><br><span class=\"line\">git remote add origin git@github.com:XXXXX/docs.git</span><br><span class=\"line\">git push --set-upstream origin master //推送到master分支</span><br><span class=\"line\">git push -u origin main 将 main 分支 push 到 GitHub</span><br><span class=\"line\">git push -u origin main</span><br><span class=\"line\">git push -f //强制推送</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>如何在提交前,服务端产生了修改的部分,请先git pull,同步到本地,再进行提交</p>\n</blockquote>\n<h3 id=\"修改文件\"><a href=\"#修改文件\" class=\"headerlink\" title=\"修改文件\"></a>修改文件</h3><p><code>cd /文件所在目录</code><br><code>git add 文件名</code><br>同新增操作</p>\n<h3 id=\"删除文件夹\"><a href=\"#删除文件夹\" class=\"headerlink\" title=\"删除文件夹\"></a>删除文件夹</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">git <span class=\"built_in\">rm</span> -r css</span><br><span class=\"line\">git commit -m <span class=\"string\">"delete"</span></span><br><span class=\"line\">git push</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"创建忽略文件\"><a href=\"#创建忽略文件\" class=\"headerlink\" title=\"创建忽略文件\"></a>创建忽略文件</h3><p>项目根目录创建文件.gitignore,将需要忽略的目录写入,比如:node_modules/</p>\n<h2 id=\"Hexo安装\"><a href=\"#Hexo安装\" class=\"headerlink\" title=\"Hexo安装\"></a>Hexo安装</h2><p>安装官方文档操作步骤即可,<a class=\"link\" href=\"https://hexo.io/zh-cn/docs/\" >https://hexo.io/zh-cn/docs/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<h2 id=\"theme安装\"><a href=\"#theme安装\" class=\"headerlink\" title=\"theme安装\"></a>theme安装</h2><blockquote>\n<p><a class=\"link\" href=\"https://redefine-docs.ohevan.com/getting-started\" >官方文档 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//安装</span><br><span class=\"line\">npm install hexo-theme-redefine@latest</span><br><span class=\"line\">//启用</span><br><span class=\"line\">_config.yml</span><br><span class=\"line\">theme: redefine</span><br><span class=\"line\">//创建主题配置文件</span><br><span class=\"line\">在 Hexo 根目录下创建 _config.redefine.yml 文件。</span><br><span class=\"line\">并将主题下的config文件复制进去的所有内容复制进去。</span><br><span class=\"line\">本文件会自动覆盖主题的配置项,创建本文件的目的是为了方便你在升级主题时,不会丢失你的配置。</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"站点搜索\"><a href=\"#站点搜索\" class=\"headerlink\" title=\"站点搜索\"></a>站点搜索</h2><p><code>npm i hexo-generator-searchdb</code></p>\n<h2 id=\"自定义域名\"><a href=\"#自定义域名\" class=\"headerlink\" title=\"自定义域名\"></a>自定义域名</h2><blockquote>\n<p>一共两条记录</p>\n</blockquote>\n<ul>\n<li>在域名提供商,添加A记录,对应项目ip地址</li>\n<li>添加CNAME记录,对应repository的二级域名(如果使用二级域名,该域名和项目的name是一致的即可)</li>\n</ul>\n<h2 id=\"CDN\"><a href=\"#CDN\" class=\"headerlink\" title=\"CDN\"></a>CDN</h2><ul>\n<li>选择合适的cdn进行加速,代理,这里需要根据cdn服务商提示,修改域名本身的dns(这里的修改在域名提供商的网站修改)</li>\n<li>由于github是强制https,所以在cdn中要勾选https,也就是ssl这一项,并选择”Full (strict)”模式,否则可能出现无限重定向导致无法访问</li>\n</ul>\n<h2 id=\"搭建过程一些小问题\"><a href=\"#搭建过程一些小问题\" class=\"headerlink\" title=\"搭建过程一些小问题\"></a>搭建过程一些小问题</h2><ul>\n<li>github上传以后,项目的编译解析过程需要等待,不会立即生效</li>\n<li>更换域名后,仍然会跳转到之前的域名,等待一天也换不过来,所以就删掉repository重建了一个</li>\n<li>一定要核对github对应项目的repository的setting中,pages显示的访问地址,所对应的ip地址,这里会变换地址,比如108,109这种,如果ip地址变换了,我们在自己的域名解析A记录未能正确对应的话,那么域名会无法访问到你的项目</li>\n</ul>\n"},{"title":"docker基础及各种镜像使用","_content":"docker相关的常用命令及各种镜像使用\n\n# docker \n>建议使用linux系统安装docker,如果使用windows则需要bios开启虚拟化,cpu为64位,系统安装hyper-v的组件 \n- 网上资料解释: \nDocker 底层的核心技术包括 Linux 上的名字空间( Namespaces) 、 控制组( Control groups) 、 Union 文\n件系统( Union file systems) 和容器格式( Container format) 。 \n我们知道, 传统的虚拟机通过在宿主主机中运行 hypervisor 来模拟一整套完整的硬件环境提供给虚拟机的\n操作系统。 虚拟机系统看到的环境是可限制的, 也是彼此隔离的。 这种直接的做法实现了对资源最完整的\n封装, 但很多时候往往意味着系统资源的浪费。 \n例如, 以宿主机和虚拟机系统都为 Linux 系统为例, 虚拟机中运行的应用其实可以利用宿主机系统中的运行环境。 \n我们知道, 在操作系统中, 包括内核、 文件系统、 网络、 PID、 UID、 IPC、 内存、 硬盘、 CPU 等等, 所有\n的资源都是应用进程直接共享的。 要想实现虚拟化, 除了要实现对内存、 CPU、 网络IO、 硬盘IO、 存储空\n间等的限制外, 还要实现文件系统、 网络、 PID、 UID、 IPC等等的相互隔离。 前者相对容易实现一些, 后\n者则需要宿主机系统的深入支持。 \n随着 Linux 系统对于名字空间功能的完善实现, 程序员已经可以实现上面的所有需求, 让某些进程在彼此\n隔离的名字空间中运行。 大家虽然都共用一个内核和某些运行时环境( 例如一些系统命令和系统库) , 但\n是彼此却看不到, 都以为系统中只有自己的存在。 这种机制就是容器( Container) , 利用名字空间来做权\n限的隔离控制, 利用 cgroups 来做资源分配。\n## 安装\n### linux\n- 安装组件:`sudo apt install curl`\n- 阿里云镜像安装\n - 下载路径:`sudo curl -fsSL https://get.docker.com | bash -s` `docker --mirror Aliyun`\n- 官方安装\n - `$ curl -fsSL https://get.docker.com -o get-docker.sh`\n - `$ sudo sh get-docker.sh` \n如果提示`无法定位软件包 docker-compose-plugin`,则update或者更换源\n- 下载完成后查看一下版本信息\n`docker -v`\n- Debian下可直接通过apt安装 \n`apt install docker.io` \n\n- Ubuntu下离线安装 \n\n```\n1. 在联网的环境中拉取Docker的安装包和镜像\nbash\ncurl -fsSL get.docker.com -o get-docker.sh\nsudo sh get-docker.sh \ndocker pull ubuntu:16.04 # 拉取一个示例镜像用于测试\n2. 导出刚拉取的Docker安装包、镜像和其他依赖\nbash\n\\\\导出Docker安装包\nsudo tar -cvf docker.tar /usr/bin/docker /usr/share/doc/docker*\n\\\\导出Docker镜像\ndocker save -o ubuntu.tar ubuntu:16.04 \n\\\\导出依赖\nsudo tar -cvf docker-deps.tar /var/lib/docker /var/run/docker.sock /etc/docker\n3. 将导出的 docker.tar、ubuntu.tar和docker-deps.tar复制到离线环境\n4. 在离线环境中安装Docker\nbash\n\\\\解压依赖\nsudo tar -xvf docker-deps.tar\n\\\\安装Docker\nsudo tar -xvf docker.tar -C /\n\\\\导入镜像 \ndocker load -i ubuntu.tar\n5. 验证安装是否成功\nbash\ndocker version # 验证Docker版本\ndocker run -it ubuntu:16.04 /bin/bash # 运行导出的ubuntu镜像\n如果能成功运行容器并进到bash,则证明Docker已成功安装。\n需要注意的是:\n1) 导出和导入的镜像是架构相关的,比如amd64架构的镜像无法在arm64架构的机器上运行。\n2) 如果Docker有更新版本,则需要重新进行离线部署的步骤拉取最新版本的安装包和依赖。\n3) 可以导出更多的依赖组件,比如 containerd、runc 等,以确保离线环境有更完整的环境。\n```\n\n-windows下,则下载官方桌面端,双击安装。记得先打开系统的虚拟化组件。\n >vbox虚拟机和docker,或者wsl只能用一个\n\n 管理员身份启动cmd \n 关闭 \n `bcdedit /set hypervisorlaunchtype off` \n 开启 \n `bcdedit /set hypervisorlaunchtype auto` \n 关闭虚拟机平台,vbox可启动 \n 打开的化,vbox无法使用,可使用windos本身的虚拟机\n### windows\n- 在docker官网直接下载dockers desktop\n- 如果没有hyper支持,可以用旧版本的docker toolbox,在[阿里云镜像站docker页面](https://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/?spm=a2c6h.25603864.0.0.298a2767ua94JZ),这个是一组套件,相当于在vbox虚拟机里运行docker。\n### 配置加速器\n```\n针对安装了Docker Toolbox的用户,您可以参考以下配置步骤:\n创建一台安装有Docker环境的Linux虚拟机,指定机器名称为default,同时配置Docker加速器地址。\ndocker-machine create --engine-registry-mirror=https://esmp74oa.mirror.aliyuncs.com -d virtualbox default\n查看机器的环境配置,并配置到本地,并通过Docker客户端访问Docker服务。\ndocker-machine env default\neval \"$(docker-machine env default)\"\ndocker info\n针对安装了Docker for Windows的用户,您可以参考以下配置步骤:\n在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:\n{\n \"registry-mirrors\": [\"https://esmp74oa.mirror.aliyuncs.com\"]\n}\n编辑完成后点击 Apply 保存按钮,等待Docker重启并应用配置的镜像加速器。 \nlinux环境下,编辑配置文件/etc/docker/daemon.json\n```\n>start working→\n## 使用\n### jenkins\n```\ndocker pull jenkins/jenkins\nsudo mkdir /var/jenkins_home/\nsudo chmod 777 /usr/jenkins_home/\ndocker run -u root -it --name jenkins -p 8080:8080 -p 50000:50000 -v /usr/jenkins_home:/jenkins_home -d jenkins/jenkins\n```\n\n### net6\n- 镜像创建\n - Dockfile\n```\n#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.\nFROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base\nWORKDIR /app\nEXPOSE 1888\nFROM mcr.microsoft.com/dotnet/sdk:6.0 AS build\nWORKDIR /src\nCOPY . .\nENTRYPOINT [\"dotnet\", \"XXXX.dll\"]\n```\n - publish\n发布选项对应平台记得匹配docker的系统,linux或者win\n - 进入发布好的目录\n命令行,执行`docker build -t myimagename .`\n- 启动\n这里主要,最好把静态文件和配置文件映射出来方便修改,还有端口\n`docker run -itd --name myname-p myport:1802 -v myfile/appsettings.Production.json:/src/appsettings.Production.json --network bridge diyname /bin/bash`\n- 网络\n面的命令网络选择为网桥,所以会有一个虚拟网络地址转换。如何要实现和宿主机或者其他容器的通讯,首先在命令界面`ipconfig /all`查出本机虚拟网卡的实际地址,如果win系统开启了虚拟化,则虚拟网卡名称为`Hyper-V Virtual Ethernet Adapter`,这个就是宿主机的虚拟网络中的地址。因为我的mysql是装在宿主机,所以容器连接需要使用该地址。\n- mysql授权\n```\nmysql> use mysql;\nDatabase changed\nmysql> update user set host = '%' where user = 'root';\nQuery OK, 1 row affected (0.02 sec)\nRows matched: 1 Changed: 1 Warnings: 0\nmysql> FLUSH PRIVILEGES;\nQuery OK, 0 rows affected (0.01 sec)\n```\n- 遇到问题 \n部分页面打开报错,提示找不到Views下的Index,这里主要的原因时因为,页面名称为小写的i,index的都打不开,但在win系统下是可以的。\n\n### ghost\n[ghost官网](https://hub.docker.com/_/ghost/)\n>nodejs轻量级博客系统 \n```\ndocker pull ghost\n$ docker run -d --name some-ghost -e NODE_ENV=development -e url=http://localhost:3001 -p 3001:2368 ghost\n$ docker exec <container-id> node --version\n```\n\n### wikiJS\n[Docker | Wiki.js](http://requarks.io) \n[requarks/wiki - Docker Image | Docker Hub](https://hub.docker.com/r/requarks/wiki)\n```\n#这里之前错误的拉成了arm的版本,导致无法启动,可以不填具体版本,默认就行\ndocker pull requarks/wiki\n#wiki\n#8080为映射的本地端口\ndocker run -d -p 8080:3000 --name wiki --restart unless-stopped -e \"DB_TYPE=mysql\" -e \"DB_HOST=192.168.8.103\" -e \"DB_PORT=3308\" -e \"DB_USER=root\" -e \"DB_PASS=root\" -e \"DB_NAME=wiki\" 3065654519c8\n```\n\n### aria2\n\n```\noldiy/aria2-ui-ng\n#Aria2+WebUI+AriaNG+FilesWeb-Docker\ndocker run -d --name aria2 -p 80:80 -p 6800:6800 -p 443:443 \n-p 81:81 -p 8080:8080 -e SECRET=oldiy \n-v /your/data:/data -v /your/conf:/conf oldiy/aria2-ui-ng:latest\n//实测\ndocker run -d --name aria2 -p 14153:80 -p 6800:6800 \n-p 14152:443 -p 14151:81 -p 14150:8080 \n-e SECRET=oldiy \n-v /volume2/3t-Data/aria2-data:/data oldiy/aria2-ui-ng:latest\n```\n\n### tomcat\n```\n$ sudo docker run -itd ubuntu:14.04 /bin/bash \ndocker run -d -p 58080:8080 -v /root/webapps/:/opt/tomcat/webapps/ --name mytomcat_1 mytomcat:1.0 \ndocker run -d -p 8080:8080 tomcat(镜像名)\ndocker run <相关参数> <镜像 ID> <初始命令>\ndocker run -i -t -v /root/software/:/mnt/software/ e934 /bin/bash \n```\n-i:表示以“交互模式”运行容器\n-t:表示容器启动后会进入其命令行\n-v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录>\n### mysql\n- arm版本:`docker pull arm64v8/mysql`\n- 普通版:`docker pull mysql:8.0.31` \n\n```\n# docker run -itd --name mysql\n -restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7\n#mysql8\n#官方启动代码\ndocker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag\n#自定义配置文件启动\ndocker run --name mysql8 -p 3308:3306 --restart=always -v /localdisk/mysql8/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=111111 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci\n#映射目录出现未授权建立文件的情况\ndocker run -d --name mysql8 -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=11111 --privilege\nd=true 70325c69f1fe\n#远程连接授权\nGRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; #修改权限\n#Mysql 8.0的加密规则变了,在Mysql 8.0以前,加密规则为mysql_native_password,Mysql8.0以后,加密规则为caching_sha2_password caching_sha2_password是一种新的加密方式,提供了比mysql_native_password插件更安全的加密方式\n#查看默认加密方式 \nshow variables like '%authen%'\n#为root修改加密方式\nalter user 'root'@'%' identified with mysql_native_password by 'root';\n```\n### kali\n```\ndocker run -itd --name kali 01eef62a8b9b --restart=always /bin/bash\n--privileged=true //获得最高权限,可以挂载smb、\n//支持中文,支持smb,支持自动启动 it是进入交互模式,d则是后台运行,attach可进\n docker run -itd --name kali \n --privileged=true \n --restart=always 616f66e03c6b env LANG=C.UTF-8 /bin/bash\n```\n### awtrix2\n>(指定环境变量,时区) \n```\ndocker run -d --name awtrix2 --restart always \\\n -p 8000:8000 -p 8001:8001 -v /volume2/3t-Data/awtrix2:/data \\\n -e TZ=Asia/Shanghai whyet/awtrix2\n#202311更新,关闭自动更新,避免出现因为更新需要下载jar包无法连接导致启动不了的情况\ndocker run --name awtrix2 -p 7000:7000 -p 7001:7001 -p 5568:5568/udp --restart always -e TZ=Asia/Shanghai -e AUTOUPDATE=false -v /myfiles:/data -d whyet/awtrix2:latest\n```\n### cloudnas/clouddrive\n```\ndocker run -d --name clouddrive --restart unless-stopped -p 9798:9798 cloudnas/clouddrive\n//挂载点\n/CloudNAS/CloudDrive\nBefore run\nClouddrive uses fuse to mount cloud storages, to enable fuse in docker container and share fuse mounts to host, one of the following options should be set in host:\nOption 1: enable MountFlags in docker service\n#mkdir -p /etc/systemd/system/docker.service.d/\n#cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf\n[Service]\nMountFlags=shared\nEOF\nOption 2: enable shared mount option for mapped volume in host\n#mount --make-shared <volume contains the path to accept cloud mounts>\ndocker run -d \\\n --name clouddrive \\\n --restart unless-stopped \\\n -v <path to accept cloud mounts>:/CloudNAS:shared \\\n -v <path to app data>:/Config \\\n -v <other local shared path>:/media:shared \\\n -p 9798:9798 \\\n --privileged \\\n --device /dev/fuse:/dev/fuse \\\n cloudnas/clouddrive\n```\n### phpzender\n`docker run -d -p 803:10081 --name phpzender2 php-zendserver:9.0-php7`\n### xampp\n```\ndocker run -d -p 805:80 --name xampp \n-v /root/www/:/opt/lampp/htdocs xampp:7\n```\n### openauth\n- 根据自制的镜像启动\n- 在项目目录下新建Dockerfile,然后运行docker build,生成image\n```\nFROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine\nCOPY . /publish\nWORKDIR /publish\nEXPOSE 6000\nCMD [\"dotnet\", \"OpenAuth.App.dll\", \"--server.urls\", \"http://*:60000\"]:q\ndocker run -d -v /root/publish/:/publish/ \n--name openauth -p 6000:6000 openauth:v1\n```\n>要重新打tag的话,语法是:\n`docker tag imageId repository:newTag`\n\n## 常用命令\n### 清除所有运行的容器包括镜像 \n`docker system prune -a -f`\n\n### 启动容器支持中文 \n`docker run -i -t mysql env LANG=C.UTF-8 /bin/bash`\n\n- 创建一个守护态的Docker容器\n`$ sudo docker run -itd ubuntu:14.04 /bin/bash`\n\n- 进入一个已经在运行的容器\n```\n$ sudo docker ps\n$ sudo docker exec -it 775c7c9ee1e1 /bin/bash\n$ sudo docker exec -it 775c7c9ee1e1 /bin/sh\n```\n>如果容器本身以bash建立,直接用attach进入,不是则exec\n\n### 创建一个容器,退出时删除 \n`$ docker run --rm <container_id>`\n\n### 暂停和恢复\n```\ndocker pause\ndocker unpause\n```\n### 修改参数\n```\n//docker container update --restart=always\ndocker update kali --restart always\ndocker container update --restart=always kali \n```\n### 保存新的镜像\n将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。\n\n```\n docker commit -a \"runoob.com\" -m \"my apache\" a404c6c174a2 mymysql:v1\n -a :提交的镜像作者; \n -c :使用Dockerfile指令来创建镜像; \n -m :提交时的说明文字; \n -p :在commit时,将容器暂停。\n```\n\n- 导出 \n `docker save ae513a47849c > nginx-save.tar`\n\n### 提交到docker hub\n```\n//登录后,需要在docker仓库先creat\ndocker login\ndocker push XXXX/kali\ndocker pull XXXX/kali:latest\n```\n\n### 查询docker日志的存储目录\n```\ndocker inspect container_ID | grep json.log`\ndocker inspect container_name | grep json.log\n```\n### 清docker日志\n`cat /dev/null > /var/log/…log-json.log`\n\n### 查询并取消容器挂载位置\n```\ncat /proc/mounts |grep \"docker\" |grep \"caf8ef20f3c1\"\n#umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets\n# umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm\n```\n\n- 进行安装htop工具\n`$:sudo apt-get install htop`\n\n - 安装后使用$:htop命令可以更直观查看CPU使用信息\n- 防火墙\n - 查看防火墙状态 \nsudo ufw status\n - 开启防火墙 \nsudo ufw enable\n - 关闭防火墙 \nsudo ufw disable\n - 防火墙没问题可能就是80端口没开,执行: \niptables -I INPUT -p tcp --dport 36572 -j ACCEPT\n\n - 1、清空iptables所有配置(新系统操作)\nsudo iptables -F \nsudo iptables -X \nsudo iptables -Z \n\n - 2、放行SSH远程22端口及lookback规则: \nsudo iptables -A INPUT -i lo -j ACCEPT \nsudo iptables -A OUTPUT -o lo -j ACCEPT \nsudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT \n\n - 3、配置默认动作为拒绝,只允许流出数据: \nsudo iptables --policy OUTPUT ACCEPT \nsudo iptables --policy FORWARD DROP \nsudo iptables -P INPUT DROP \n >操作这部之前,请确保放行了ssh或者其他远程端口.\n\n - 4、配置放行的关联规则包\n ```\n sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n sudo iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n ```\n - 5、Ubuntu保存iptables配置与开机启动(root账号下)\n >如果是普通用户,请切换到root\n ```\n super@super:~$ su - root\n Password: \n root@super:~# iptables-save > /etc/iptables-rules # 保存配置\n ```\n\n - 5.1、ubuntu配置规则开机自启动(可以普通账号下)\n \n ```\n super@super:~$ more /etc/rc.local \n #请先配置rc.local服务自启动\n #!/bin/bash\n #rc.local启动\n ```\n\n- iptables配置恢复,默认重启系统iptables配置丢失.\n```\niptables-restore < /etc/iptables-rules\nexit 0\n```\n\n### Docker 镜像和容器的导入导出\n- 镜像的导出和导入\n- 镜像的保存\n\n```\n[root@k8s-master ~]# docker images\nREPOSITORY TAG IMAGE ID CREATED SIZE\nnginx latest ae513a47849c 2 months ago 109MB\ndebian jessie 4eb8376dc2a3 2 months ago 127MB\nrabbitmq 3.6.8 8cdcbee37f62 15 months ago 179MB\n[root@k8s-master tmp]# docker save ae513a47849c > nginx-save.tar\n[root@k8s-master tmp]# ls -lh\ntotal 108M\n-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar\n```\n\n- 第二种写法:\n`docker save -o nginx-save.tar ae513a47849c`\n- 2.镜像的导入\n - 可以将导出的nginx-save.tar包传到需要的docker主机上面,然后执行导入命令. \n\n```\n[root@k8s-master tmp]# ls -lh\ntotal 108M\n-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar\n[root@k8s-master tmp]# docker load < nginx-save.tar \n82b81d779f83: Loading layer [==================================================>] 54.21MB/54.21MB\n7ab428981537: Loading layer [==================================================>] 3.584kB/3.584kB\nLoaded image ID: sha256:ae513a47849c895a155ddfb868d6ba247f60240ec8495482eca74c4a2c13a881\n```\n\n- 第三种写法:\n`docker load -i nginx-save.tar`\n\n### 容器的导出和导入\n- 1.容器的导出\n```\n[root@k8s-master tmp]# docker ps\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n220aee82cfea tomcat:7 \"catalina.sh run\" 9 seconds ago Up 7 seconds 8080/tcp tomcat7\ndocker export -o mysql-`date +%Y%m%d`.tar 220aee82cfea\n```\n- 2.容器的导入\n`docker import my_ubuntu_v3.tar runoob/ubuntu:v4 `\n\n- 镜像和容器 导出和导入的区别: \n - 1.镜像导入 是复制的过程\n - 2.容器导入 是将当前容器 变成一个新的镜像\n - save 和 export区别:\n - 1)save 保存镜像所有的信息-包含历史\n - 2)export 只导出当前的信息\n\n - docker save images_name: \n - 将一个镜像导出为文件,再使用docker load命令将文件导入为一个镜像,会保存该镜像的的所有历史记录。比docker export命令导出的文件大,很好理解,因为会保存镜像的所有历史记录。 \n - docker export container_id: \n - 将一个容器导出为文件,再使用docker import命令将容器导入成为一个新的镜像,但是相比docker save命令,容器文件会丢失所有元数据和历史记录,仅保存容器当时的状态,相当于虚拟机快照。\n\n- 普通启动的容器\n```\nrunoob@runoob:~$ docker run ubuntu:15.10 /bin/echo \"Hello world\"\nHello world\n```\n\n>各个参数解析:\n\n- docker: Docker 的二进制执行文件。\n\n- run:与前面的 docker 组合来运行一个容器。\n\n- ubuntu:15.10指定要运行的镜像,Docker首先从本地主机上查找镜像是否存在,如果不存在,Docker 就会从镜像仓库 Docker Hub 下载公共镜像。\n\n- /bin/echo \"Hello world\": 在启动的容器里执行的命令\n\n- 运行交互式的容器 \n我们通过docker的两个参数 -i -t,让docker运行的容器实现\"对话\"的能力\n```\nrunoob@runoob:~$ docker run -i -t ubuntu:15.10 /bin/bash\nroot@dc0050c79503:/#\n```\n>各个参数解析:\n\n-t:在新容器内指定一个伪终端或终端。\n\n-i:允许你对容器内的标准输入 (STDIN) 进行交互。\n\n启动容器(后台模式)\n使用以下命令创建一个以进程方式运行的容器\n```\nrunoob@runoob:~$ docker run -d ubuntu:15.10 /bin/sh -c \"while true; do echo hello world; sleep 1; done\"\n2b1b7a428627c51ab8810d541d759f072b4fc75487eed05812646b8534a2fe63\n```\n- 首先,我们需要确认容器有在运行,可以通过 docker ps 来查看\n\n`runoob@runoob:~$ docker ps`\n\nCONTAINER ID:容器ID\n\nNAMES:自动分配的容器名称\n\n在容器内使用docker logs命令,查看容器内的标准输出\n\n`runoob@runoob:~$ docker logs 2b1b7a428627` \n\n\n### 构建镜像\n我们使用命令 docker build , 从零开始来创建一个新的镜像。为此,我们需要创建一个 Dockerfile 文件,其中包含一组指令来告诉 Docker 如何构建我们的镜像。\n```\nrunoob@runoob:~$ cat Dockerfile \nFROM centos:6.7\nMAINTAINER Fisher \"fisher@sudops.com\"\nRUN /bin/echo 'root:123456' |chpasswd\nRUN useradd runoob\nRUN /bin/echo 'runoob:123456' |chpasswd\nRUN /bin/echo -e \"LANG=\\\"en_US.UTF-8\\\"\" >/etc/default/local\nEXPOSE 22\nEXPOSE 80\nCMD /usr/sbin/sshd -D\n```\n每一个指令都会在镜像上创建一个新的层,每一个指令的前缀都必须是大写的。\n第一条FROM,指定使用哪个镜像源\nRUN 指令告诉docker 在镜像内执行命令,安装了什么。。。\n然后,我们使用 Dockerfile 文件,通过 docker build 命令来构建一个镜像。\n```\nrunoob@runoob:~$ docker build -t runoob/centos:6.7 .\nSending build context to Docker daemon 17.92 kB\nStep 1 : FROM centos:6.7\n ---> d95b5ca17cc3\nStep 2 : MAINTAINER Fisher \"fisher@sudops.com\"\n ---> Using cache\n ---> 0c92299c6f03\nStep 3 : RUN /bin/echo 'root:123456' |chpasswd\n ---> Using cache\n ---> 0397ce2fbd0a\nStep 4 : RUN useradd runoob\n```\n>参数说明:\n\n-t :指定要创建的目标镜像名\n\n. :Dockerfile 文件所在目录,可以指定Dockerfile 的绝对路径\n\n使用docker images 查看创建的镜像已经在列表中存在,镜像ID为860c279d2fec\n\nrunoob@runoob:~$ docker images \nREPOSITORY TAG IMAGE ID CREATED SIZE\n\n我们可以使用新的镜像来创建容器\n\nrunoob@runoob:~$ docker run -t -i runoob/centos:6.7 /bin/bash\n[root@41c28d18b5fb /]# id runoob\nuid=500(runoob) gid=500(runoob) groups=500(runoob)\n从上面看到新镜像已经包含我们创建的用户runoob\n\n网络端口映射\n我们创建了一个 python 应用的容器。\n```\nrunoob@runoob:~$ docker run -d -P training/webapp python app.py\nfce072cc88cee71b1cdceb57c2821d054a4a59f67da6b416fceb5593f059fc6d\n```\n另外,我们可以指定容器绑定的网络地址,比如绑定 127.0.0.1。\n\n我们使用 -P 参数创建一个容器,使用 docker ps 来看到端口5000绑定主机端口32768。\n\n另外,我们可以指定容器绑定的网络地址,比如绑定127.0.0.1。\n```\nrunoob@runoob:~$ docker run -d -p 127.0.0.1:5001:5000 training/webapp python app.py\n95c6ceef88ca3e71eaf303c2833fd6701d8d1b2572b5613b5a932dfdfe8a857c\n```\n这样我们就可以通过访问127.0.0.1:5001来访问容器的5000端口。\n\n上面的例子中,默认都是绑定 tcp 端口,如果要绑定 UDP 端口,可以在端口后面加上 /udp。\n```\nrunoob@runoob:~$ docker run -d -p 127.0.0.1:5000:5000/udp training/webapp python app.py\n6779686f06f6204579c1d655dd8b2b31e8e809b245a97b2d3a8e35abe9dcd22a\n```\ndocker port 命令可以让我们快捷地查看端口的绑定情况。\n```\nrunoob@runoob:~$ docker port adoring_stonebraker 5000\n127.0.0.1:5001\n```\n### 容器连接\n端口映射并不是唯一把 docker 连接到另一个容器的方法。\n\ndocker有一个连接系统允许将多个容器连接在一起,共享连接信息。\n\ndocker连接会创建一个父子关系,其中父容器可以看到子容器的信息。\n\n容器命名\n当我们创建一个容器的时候,docker会自动对它进行命名。另外,我们也可以使用--name标识来命名容器,例如:\n\nrunoob@runoob:~$ docker run -d -P --name runoob training/webapp python app.py\n43780a6eabaaf14e590b6e849235c75f3012995403f97749775e38436db9a441\n我们可以使用 docker ps 命令来查看容器名称。\n```\nrunoob@runoob:~$ docker ps -l\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n43780a6eabaa training/webapp \"python app.py\" 3 minutes ago Up 3 minutes 0.0.0.0:32769->5000/tcp runoob\n```\n\n- Docker文件目录和容器内部操作\n- Docker默认的文件目录位于Linux server的/var/lib/docker 下面。目录结构如下\n\n|-----containers:用于存储容器信息\n|-----image:用来存储镜像中间件及本身信息,大小,依赖信息\n|-----network\n|-----swarm\n|-----tmp:docker临时目录\n|-----trust:docker信任目录\n|-----volumes:docker卷目录\n\n>还可以通过docker指令确认文件位置:\n`docker info`\n \n### 查看某个容器的文件目录\n docker exec 容器name ls\n\n### 文件互相拷贝\n\n- 将本地文件拷贝到docker 镜像内\n```\n docker cp 本地路径 容器Id或name:容器目录\n docker cp /Users/howey/Documents/apache-maven-3.5.2/ containername:/opt\n```\n \n- 将docker内文件拷贝到本地文件夹内\n```\n docker cp 容器Id或name:本地路径 镜像路径\n docker cp containername:/Users/howey/Documents/apache-maven-3.5.2 /opt/\n```\n\n>如何进入容器内部呢:使用docker exec可以进入Docker容器并运行指令 \n```\n#docker exec 在运行的容器中执行命令\ndocker exec [OPTIONS] CONTAINER COMMAND [ARG...]\n```\nOPTIONS说明: \n-d :分离模式: 在后台运行 \n-i :即使没有附加也保持STDIN 打开 \n-t :分配一个伪终端 \n通过 exec 命令对指定的容器执行 bash: \n`docker exec -it 容器ID或name bash` \n>-it : 目前的理解浅薄,就是要等在容器内的命令执行完毕才会出来到当前操作; 没有-it的加 就相当于在容器内执行一下命令,不等容器内部是否执行完毕直接出来.\n案例:在容器内创建sqlserver目录,如下所示,安装sqlserver后实际上已经自动创建了data目录,映射的时候无需再次创建直接使用即可.\n\n```\n# docker exec -it sqlserver bash\nmssql@649b4b891718:/$ mkdir /var/opt/mssql/data\nmkdir: cannot create directory '/var/opt/mssql/data': File exists\nmssql@649b4b891718:/$ ls #查看目录列表\nbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var\nmssql@649b4b891718:/$ cd /var/opt #转到opt目录\nmssql@649b4b891718:/var/opt$ ls #查看opt目录\nmssql\nmssql@649b4b891718:/var/opt$ cd mssql \nmssql@649b4b891718:/var/opt/mssql$ ls\ndata log secrets\nmssql@649b4b891718:/var/opt/mssql$ \n```","source":"_posts/docker.md","raw":"---\ntitle: docker基础及各种镜像使用\ntags:\n - \"docker\"\ncategories:\n - \"工具教程\"\n---\ndocker相关的常用命令及各种镜像使用\n\n# docker \n>建议使用linux系统安装docker,如果使用windows则需要bios开启虚拟化,cpu为64位,系统安装hyper-v的组件 \n- 网上资料解释: \nDocker 底层的核心技术包括 Linux 上的名字空间( Namespaces) 、 控制组( Control groups) 、 Union 文\n件系统( Union file systems) 和容器格式( Container format) 。 \n我们知道, 传统的虚拟机通过在宿主主机中运行 hypervisor 来模拟一整套完整的硬件环境提供给虚拟机的\n操作系统。 虚拟机系统看到的环境是可限制的, 也是彼此隔离的。 这种直接的做法实现了对资源最完整的\n封装, 但很多时候往往意味着系统资源的浪费。 \n例如, 以宿主机和虚拟机系统都为 Linux 系统为例, 虚拟机中运行的应用其实可以利用宿主机系统中的运行环境。 \n我们知道, 在操作系统中, 包括内核、 文件系统、 网络、 PID、 UID、 IPC、 内存、 硬盘、 CPU 等等, 所有\n的资源都是应用进程直接共享的。 要想实现虚拟化, 除了要实现对内存、 CPU、 网络IO、 硬盘IO、 存储空\n间等的限制外, 还要实现文件系统、 网络、 PID、 UID、 IPC等等的相互隔离。 前者相对容易实现一些, 后\n者则需要宿主机系统的深入支持。 \n随着 Linux 系统对于名字空间功能的完善实现, 程序员已经可以实现上面的所有需求, 让某些进程在彼此\n隔离的名字空间中运行。 大家虽然都共用一个内核和某些运行时环境( 例如一些系统命令和系统库) , 但\n是彼此却看不到, 都以为系统中只有自己的存在。 这种机制就是容器( Container) , 利用名字空间来做权\n限的隔离控制, 利用 cgroups 来做资源分配。\n## 安装\n### linux\n- 安装组件:`sudo apt install curl`\n- 阿里云镜像安装\n - 下载路径:`sudo curl -fsSL https://get.docker.com | bash -s` `docker --mirror Aliyun`\n- 官方安装\n - `$ curl -fsSL https://get.docker.com -o get-docker.sh`\n - `$ sudo sh get-docker.sh` \n如果提示`无法定位软件包 docker-compose-plugin`,则update或者更换源\n- 下载完成后查看一下版本信息\n`docker -v`\n- Debian下可直接通过apt安装 \n`apt install docker.io` \n\n- Ubuntu下离线安装 \n\n```\n1. 在联网的环境中拉取Docker的安装包和镜像\nbash\ncurl -fsSL get.docker.com -o get-docker.sh\nsudo sh get-docker.sh \ndocker pull ubuntu:16.04 # 拉取一个示例镜像用于测试\n2. 导出刚拉取的Docker安装包、镜像和其他依赖\nbash\n\\\\导出Docker安装包\nsudo tar -cvf docker.tar /usr/bin/docker /usr/share/doc/docker*\n\\\\导出Docker镜像\ndocker save -o ubuntu.tar ubuntu:16.04 \n\\\\导出依赖\nsudo tar -cvf docker-deps.tar /var/lib/docker /var/run/docker.sock /etc/docker\n3. 将导出的 docker.tar、ubuntu.tar和docker-deps.tar复制到离线环境\n4. 在离线环境中安装Docker\nbash\n\\\\解压依赖\nsudo tar -xvf docker-deps.tar\n\\\\安装Docker\nsudo tar -xvf docker.tar -C /\n\\\\导入镜像 \ndocker load -i ubuntu.tar\n5. 验证安装是否成功\nbash\ndocker version # 验证Docker版本\ndocker run -it ubuntu:16.04 /bin/bash # 运行导出的ubuntu镜像\n如果能成功运行容器并进到bash,则证明Docker已成功安装。\n需要注意的是:\n1) 导出和导入的镜像是架构相关的,比如amd64架构的镜像无法在arm64架构的机器上运行。\n2) 如果Docker有更新版本,则需要重新进行离线部署的步骤拉取最新版本的安装包和依赖。\n3) 可以导出更多的依赖组件,比如 containerd、runc 等,以确保离线环境有更完整的环境。\n```\n\n-windows下,则下载官方桌面端,双击安装。记得先打开系统的虚拟化组件。\n >vbox虚拟机和docker,或者wsl只能用一个\n\n 管理员身份启动cmd \n 关闭 \n `bcdedit /set hypervisorlaunchtype off` \n 开启 \n `bcdedit /set hypervisorlaunchtype auto` \n 关闭虚拟机平台,vbox可启动 \n 打开的化,vbox无法使用,可使用windos本身的虚拟机\n### windows\n- 在docker官网直接下载dockers desktop\n- 如果没有hyper支持,可以用旧版本的docker toolbox,在[阿里云镜像站docker页面](https://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/?spm=a2c6h.25603864.0.0.298a2767ua94JZ),这个是一组套件,相当于在vbox虚拟机里运行docker。\n### 配置加速器\n```\n针对安装了Docker Toolbox的用户,您可以参考以下配置步骤:\n创建一台安装有Docker环境的Linux虚拟机,指定机器名称为default,同时配置Docker加速器地址。\ndocker-machine create --engine-registry-mirror=https://esmp74oa.mirror.aliyuncs.com -d virtualbox default\n查看机器的环境配置,并配置到本地,并通过Docker客户端访问Docker服务。\ndocker-machine env default\neval \"$(docker-machine env default)\"\ndocker info\n针对安装了Docker for Windows的用户,您可以参考以下配置步骤:\n在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:\n{\n \"registry-mirrors\": [\"https://esmp74oa.mirror.aliyuncs.com\"]\n}\n编辑完成后点击 Apply 保存按钮,等待Docker重启并应用配置的镜像加速器。 \nlinux环境下,编辑配置文件/etc/docker/daemon.json\n```\n>start working→\n## 使用\n### jenkins\n```\ndocker pull jenkins/jenkins\nsudo mkdir /var/jenkins_home/\nsudo chmod 777 /usr/jenkins_home/\ndocker run -u root -it --name jenkins -p 8080:8080 -p 50000:50000 -v /usr/jenkins_home:/jenkins_home -d jenkins/jenkins\n```\n\n### net6\n- 镜像创建\n - Dockfile\n```\n#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.\nFROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base\nWORKDIR /app\nEXPOSE 1888\nFROM mcr.microsoft.com/dotnet/sdk:6.0 AS build\nWORKDIR /src\nCOPY . .\nENTRYPOINT [\"dotnet\", \"XXXX.dll\"]\n```\n - publish\n发布选项对应平台记得匹配docker的系统,linux或者win\n - 进入发布好的目录\n命令行,执行`docker build -t myimagename .`\n- 启动\n这里主要,最好把静态文件和配置文件映射出来方便修改,还有端口\n`docker run -itd --name myname-p myport:1802 -v myfile/appsettings.Production.json:/src/appsettings.Production.json --network bridge diyname /bin/bash`\n- 网络\n面的命令网络选择为网桥,所以会有一个虚拟网络地址转换。如何要实现和宿主机或者其他容器的通讯,首先在命令界面`ipconfig /all`查出本机虚拟网卡的实际地址,如果win系统开启了虚拟化,则虚拟网卡名称为`Hyper-V Virtual Ethernet Adapter`,这个就是宿主机的虚拟网络中的地址。因为我的mysql是装在宿主机,所以容器连接需要使用该地址。\n- mysql授权\n```\nmysql> use mysql;\nDatabase changed\nmysql> update user set host = '%' where user = 'root';\nQuery OK, 1 row affected (0.02 sec)\nRows matched: 1 Changed: 1 Warnings: 0\nmysql> FLUSH PRIVILEGES;\nQuery OK, 0 rows affected (0.01 sec)\n```\n- 遇到问题 \n部分页面打开报错,提示找不到Views下的Index,这里主要的原因时因为,页面名称为小写的i,index的都打不开,但在win系统下是可以的。\n\n### ghost\n[ghost官网](https://hub.docker.com/_/ghost/)\n>nodejs轻量级博客系统 \n```\ndocker pull ghost\n$ docker run -d --name some-ghost -e NODE_ENV=development -e url=http://localhost:3001 -p 3001:2368 ghost\n$ docker exec <container-id> node --version\n```\n\n### wikiJS\n[Docker | Wiki.js](http://requarks.io) \n[requarks/wiki - Docker Image | Docker Hub](https://hub.docker.com/r/requarks/wiki)\n```\n#这里之前错误的拉成了arm的版本,导致无法启动,可以不填具体版本,默认就行\ndocker pull requarks/wiki\n#wiki\n#8080为映射的本地端口\ndocker run -d -p 8080:3000 --name wiki --restart unless-stopped -e \"DB_TYPE=mysql\" -e \"DB_HOST=192.168.8.103\" -e \"DB_PORT=3308\" -e \"DB_USER=root\" -e \"DB_PASS=root\" -e \"DB_NAME=wiki\" 3065654519c8\n```\n\n### aria2\n\n```\noldiy/aria2-ui-ng\n#Aria2+WebUI+AriaNG+FilesWeb-Docker\ndocker run -d --name aria2 -p 80:80 -p 6800:6800 -p 443:443 \n-p 81:81 -p 8080:8080 -e SECRET=oldiy \n-v /your/data:/data -v /your/conf:/conf oldiy/aria2-ui-ng:latest\n//实测\ndocker run -d --name aria2 -p 14153:80 -p 6800:6800 \n-p 14152:443 -p 14151:81 -p 14150:8080 \n-e SECRET=oldiy \n-v /volume2/3t-Data/aria2-data:/data oldiy/aria2-ui-ng:latest\n```\n\n### tomcat\n```\n$ sudo docker run -itd ubuntu:14.04 /bin/bash \ndocker run -d -p 58080:8080 -v /root/webapps/:/opt/tomcat/webapps/ --name mytomcat_1 mytomcat:1.0 \ndocker run -d -p 8080:8080 tomcat(镜像名)\ndocker run <相关参数> <镜像 ID> <初始命令>\ndocker run -i -t -v /root/software/:/mnt/software/ e934 /bin/bash \n```\n-i:表示以“交互模式”运行容器\n-t:表示容器启动后会进入其命令行\n-v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录>\n### mysql\n- arm版本:`docker pull arm64v8/mysql`\n- 普通版:`docker pull mysql:8.0.31` \n\n```\n# docker run -itd --name mysql\n -restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7\n#mysql8\n#官方启动代码\ndocker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag\n#自定义配置文件启动\ndocker run --name mysql8 -p 3308:3306 --restart=always -v /localdisk/mysql8/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=111111 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci\n#映射目录出现未授权建立文件的情况\ndocker run -d --name mysql8 -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=11111 --privilege\nd=true 70325c69f1fe\n#远程连接授权\nGRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; #修改权限\n#Mysql 8.0的加密规则变了,在Mysql 8.0以前,加密规则为mysql_native_password,Mysql8.0以后,加密规则为caching_sha2_password caching_sha2_password是一种新的加密方式,提供了比mysql_native_password插件更安全的加密方式\n#查看默认加密方式 \nshow variables like '%authen%'\n#为root修改加密方式\nalter user 'root'@'%' identified with mysql_native_password by 'root';\n```\n### kali\n```\ndocker run -itd --name kali 01eef62a8b9b --restart=always /bin/bash\n--privileged=true //获得最高权限,可以挂载smb、\n//支持中文,支持smb,支持自动启动 it是进入交互模式,d则是后台运行,attach可进\n docker run -itd --name kali \n --privileged=true \n --restart=always 616f66e03c6b env LANG=C.UTF-8 /bin/bash\n```\n### awtrix2\n>(指定环境变量,时区) \n```\ndocker run -d --name awtrix2 --restart always \\\n -p 8000:8000 -p 8001:8001 -v /volume2/3t-Data/awtrix2:/data \\\n -e TZ=Asia/Shanghai whyet/awtrix2\n#202311更新,关闭自动更新,避免出现因为更新需要下载jar包无法连接导致启动不了的情况\ndocker run --name awtrix2 -p 7000:7000 -p 7001:7001 -p 5568:5568/udp --restart always -e TZ=Asia/Shanghai -e AUTOUPDATE=false -v /myfiles:/data -d whyet/awtrix2:latest\n```\n### cloudnas/clouddrive\n```\ndocker run -d --name clouddrive --restart unless-stopped -p 9798:9798 cloudnas/clouddrive\n//挂载点\n/CloudNAS/CloudDrive\nBefore run\nClouddrive uses fuse to mount cloud storages, to enable fuse in docker container and share fuse mounts to host, one of the following options should be set in host:\nOption 1: enable MountFlags in docker service\n#mkdir -p /etc/systemd/system/docker.service.d/\n#cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf\n[Service]\nMountFlags=shared\nEOF\nOption 2: enable shared mount option for mapped volume in host\n#mount --make-shared <volume contains the path to accept cloud mounts>\ndocker run -d \\\n --name clouddrive \\\n --restart unless-stopped \\\n -v <path to accept cloud mounts>:/CloudNAS:shared \\\n -v <path to app data>:/Config \\\n -v <other local shared path>:/media:shared \\\n -p 9798:9798 \\\n --privileged \\\n --device /dev/fuse:/dev/fuse \\\n cloudnas/clouddrive\n```\n### phpzender\n`docker run -d -p 803:10081 --name phpzender2 php-zendserver:9.0-php7`\n### xampp\n```\ndocker run -d -p 805:80 --name xampp \n-v /root/www/:/opt/lampp/htdocs xampp:7\n```\n### openauth\n- 根据自制的镜像启动\n- 在项目目录下新建Dockerfile,然后运行docker build,生成image\n```\nFROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine\nCOPY . /publish\nWORKDIR /publish\nEXPOSE 6000\nCMD [\"dotnet\", \"OpenAuth.App.dll\", \"--server.urls\", \"http://*:60000\"]:q\ndocker run -d -v /root/publish/:/publish/ \n--name openauth -p 6000:6000 openauth:v1\n```\n>要重新打tag的话,语法是:\n`docker tag imageId repository:newTag`\n\n## 常用命令\n### 清除所有运行的容器包括镜像 \n`docker system prune -a -f`\n\n### 启动容器支持中文 \n`docker run -i -t mysql env LANG=C.UTF-8 /bin/bash`\n\n- 创建一个守护态的Docker容器\n`$ sudo docker run -itd ubuntu:14.04 /bin/bash`\n\n- 进入一个已经在运行的容器\n```\n$ sudo docker ps\n$ sudo docker exec -it 775c7c9ee1e1 /bin/bash\n$ sudo docker exec -it 775c7c9ee1e1 /bin/sh\n```\n>如果容器本身以bash建立,直接用attach进入,不是则exec\n\n### 创建一个容器,退出时删除 \n`$ docker run --rm <container_id>`\n\n### 暂停和恢复\n```\ndocker pause\ndocker unpause\n```\n### 修改参数\n```\n//docker container update --restart=always\ndocker update kali --restart always\ndocker container update --restart=always kali \n```\n### 保存新的镜像\n将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。\n\n```\n docker commit -a \"runoob.com\" -m \"my apache\" a404c6c174a2 mymysql:v1\n -a :提交的镜像作者; \n -c :使用Dockerfile指令来创建镜像; \n -m :提交时的说明文字; \n -p :在commit时,将容器暂停。\n```\n\n- 导出 \n `docker save ae513a47849c > nginx-save.tar`\n\n### 提交到docker hub\n```\n//登录后,需要在docker仓库先creat\ndocker login\ndocker push XXXX/kali\ndocker pull XXXX/kali:latest\n```\n\n### 查询docker日志的存储目录\n```\ndocker inspect container_ID | grep json.log`\ndocker inspect container_name | grep json.log\n```\n### 清docker日志\n`cat /dev/null > /var/log/…log-json.log`\n\n### 查询并取消容器挂载位置\n```\ncat /proc/mounts |grep \"docker\" |grep \"caf8ef20f3c1\"\n#umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets\n# umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm\n```\n\n- 进行安装htop工具\n`$:sudo apt-get install htop`\n\n - 安装后使用$:htop命令可以更直观查看CPU使用信息\n- 防火墙\n - 查看防火墙状态 \nsudo ufw status\n - 开启防火墙 \nsudo ufw enable\n - 关闭防火墙 \nsudo ufw disable\n - 防火墙没问题可能就是80端口没开,执行: \niptables -I INPUT -p tcp --dport 36572 -j ACCEPT\n\n - 1、清空iptables所有配置(新系统操作)\nsudo iptables -F \nsudo iptables -X \nsudo iptables -Z \n\n - 2、放行SSH远程22端口及lookback规则: \nsudo iptables -A INPUT -i lo -j ACCEPT \nsudo iptables -A OUTPUT -o lo -j ACCEPT \nsudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT \n\n - 3、配置默认动作为拒绝,只允许流出数据: \nsudo iptables --policy OUTPUT ACCEPT \nsudo iptables --policy FORWARD DROP \nsudo iptables -P INPUT DROP \n >操作这部之前,请确保放行了ssh或者其他远程端口.\n\n - 4、配置放行的关联规则包\n ```\n sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n sudo iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n ```\n - 5、Ubuntu保存iptables配置与开机启动(root账号下)\n >如果是普通用户,请切换到root\n ```\n super@super:~$ su - root\n Password: \n root@super:~# iptables-save > /etc/iptables-rules # 保存配置\n ```\n\n - 5.1、ubuntu配置规则开机自启动(可以普通账号下)\n \n ```\n super@super:~$ more /etc/rc.local \n #请先配置rc.local服务自启动\n #!/bin/bash\n #rc.local启动\n ```\n\n- iptables配置恢复,默认重启系统iptables配置丢失.\n```\niptables-restore < /etc/iptables-rules\nexit 0\n```\n\n### Docker 镜像和容器的导入导出\n- 镜像的导出和导入\n- 镜像的保存\n\n```\n[root@k8s-master ~]# docker images\nREPOSITORY TAG IMAGE ID CREATED SIZE\nnginx latest ae513a47849c 2 months ago 109MB\ndebian jessie 4eb8376dc2a3 2 months ago 127MB\nrabbitmq 3.6.8 8cdcbee37f62 15 months ago 179MB\n[root@k8s-master tmp]# docker save ae513a47849c > nginx-save.tar\n[root@k8s-master tmp]# ls -lh\ntotal 108M\n-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar\n```\n\n- 第二种写法:\n`docker save -o nginx-save.tar ae513a47849c`\n- 2.镜像的导入\n - 可以将导出的nginx-save.tar包传到需要的docker主机上面,然后执行导入命令. \n\n```\n[root@k8s-master tmp]# ls -lh\ntotal 108M\n-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar\n[root@k8s-master tmp]# docker load < nginx-save.tar \n82b81d779f83: Loading layer [==================================================>] 54.21MB/54.21MB\n7ab428981537: Loading layer [==================================================>] 3.584kB/3.584kB\nLoaded image ID: sha256:ae513a47849c895a155ddfb868d6ba247f60240ec8495482eca74c4a2c13a881\n```\n\n- 第三种写法:\n`docker load -i nginx-save.tar`\n\n### 容器的导出和导入\n- 1.容器的导出\n```\n[root@k8s-master tmp]# docker ps\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n220aee82cfea tomcat:7 \"catalina.sh run\" 9 seconds ago Up 7 seconds 8080/tcp tomcat7\ndocker export -o mysql-`date +%Y%m%d`.tar 220aee82cfea\n```\n- 2.容器的导入\n`docker import my_ubuntu_v3.tar runoob/ubuntu:v4 `\n\n- 镜像和容器 导出和导入的区别: \n - 1.镜像导入 是复制的过程\n - 2.容器导入 是将当前容器 变成一个新的镜像\n - save 和 export区别:\n - 1)save 保存镜像所有的信息-包含历史\n - 2)export 只导出当前的信息\n\n - docker save images_name: \n - 将一个镜像导出为文件,再使用docker load命令将文件导入为一个镜像,会保存该镜像的的所有历史记录。比docker export命令导出的文件大,很好理解,因为会保存镜像的所有历史记录。 \n - docker export container_id: \n - 将一个容器导出为文件,再使用docker import命令将容器导入成为一个新的镜像,但是相比docker save命令,容器文件会丢失所有元数据和历史记录,仅保存容器当时的状态,相当于虚拟机快照。\n\n- 普通启动的容器\n```\nrunoob@runoob:~$ docker run ubuntu:15.10 /bin/echo \"Hello world\"\nHello world\n```\n\n>各个参数解析:\n\n- docker: Docker 的二进制执行文件。\n\n- run:与前面的 docker 组合来运行一个容器。\n\n- ubuntu:15.10指定要运行的镜像,Docker首先从本地主机上查找镜像是否存在,如果不存在,Docker 就会从镜像仓库 Docker Hub 下载公共镜像。\n\n- /bin/echo \"Hello world\": 在启动的容器里执行的命令\n\n- 运行交互式的容器 \n我们通过docker的两个参数 -i -t,让docker运行的容器实现\"对话\"的能力\n```\nrunoob@runoob:~$ docker run -i -t ubuntu:15.10 /bin/bash\nroot@dc0050c79503:/#\n```\n>各个参数解析:\n\n-t:在新容器内指定一个伪终端或终端。\n\n-i:允许你对容器内的标准输入 (STDIN) 进行交互。\n\n启动容器(后台模式)\n使用以下命令创建一个以进程方式运行的容器\n```\nrunoob@runoob:~$ docker run -d ubuntu:15.10 /bin/sh -c \"while true; do echo hello world; sleep 1; done\"\n2b1b7a428627c51ab8810d541d759f072b4fc75487eed05812646b8534a2fe63\n```\n- 首先,我们需要确认容器有在运行,可以通过 docker ps 来查看\n\n`runoob@runoob:~$ docker ps`\n\nCONTAINER ID:容器ID\n\nNAMES:自动分配的容器名称\n\n在容器内使用docker logs命令,查看容器内的标准输出\n\n`runoob@runoob:~$ docker logs 2b1b7a428627` \n\n\n### 构建镜像\n我们使用命令 docker build , 从零开始来创建一个新的镜像。为此,我们需要创建一个 Dockerfile 文件,其中包含一组指令来告诉 Docker 如何构建我们的镜像。\n```\nrunoob@runoob:~$ cat Dockerfile \nFROM centos:6.7\nMAINTAINER Fisher \"fisher@sudops.com\"\nRUN /bin/echo 'root:123456' |chpasswd\nRUN useradd runoob\nRUN /bin/echo 'runoob:123456' |chpasswd\nRUN /bin/echo -e \"LANG=\\\"en_US.UTF-8\\\"\" >/etc/default/local\nEXPOSE 22\nEXPOSE 80\nCMD /usr/sbin/sshd -D\n```\n每一个指令都会在镜像上创建一个新的层,每一个指令的前缀都必须是大写的。\n第一条FROM,指定使用哪个镜像源\nRUN 指令告诉docker 在镜像内执行命令,安装了什么。。。\n然后,我们使用 Dockerfile 文件,通过 docker build 命令来构建一个镜像。\n```\nrunoob@runoob:~$ docker build -t runoob/centos:6.7 .\nSending build context to Docker daemon 17.92 kB\nStep 1 : FROM centos:6.7\n ---> d95b5ca17cc3\nStep 2 : MAINTAINER Fisher \"fisher@sudops.com\"\n ---> Using cache\n ---> 0c92299c6f03\nStep 3 : RUN /bin/echo 'root:123456' |chpasswd\n ---> Using cache\n ---> 0397ce2fbd0a\nStep 4 : RUN useradd runoob\n```\n>参数说明:\n\n-t :指定要创建的目标镜像名\n\n. :Dockerfile 文件所在目录,可以指定Dockerfile 的绝对路径\n\n使用docker images 查看创建的镜像已经在列表中存在,镜像ID为860c279d2fec\n\nrunoob@runoob:~$ docker images \nREPOSITORY TAG IMAGE ID CREATED SIZE\n\n我们可以使用新的镜像来创建容器\n\nrunoob@runoob:~$ docker run -t -i runoob/centos:6.7 /bin/bash\n[root@41c28d18b5fb /]# id runoob\nuid=500(runoob) gid=500(runoob) groups=500(runoob)\n从上面看到新镜像已经包含我们创建的用户runoob\n\n网络端口映射\n我们创建了一个 python 应用的容器。\n```\nrunoob@runoob:~$ docker run -d -P training/webapp python app.py\nfce072cc88cee71b1cdceb57c2821d054a4a59f67da6b416fceb5593f059fc6d\n```\n另外,我们可以指定容器绑定的网络地址,比如绑定 127.0.0.1。\n\n我们使用 -P 参数创建一个容器,使用 docker ps 来看到端口5000绑定主机端口32768。\n\n另外,我们可以指定容器绑定的网络地址,比如绑定127.0.0.1。\n```\nrunoob@runoob:~$ docker run -d -p 127.0.0.1:5001:5000 training/webapp python app.py\n95c6ceef88ca3e71eaf303c2833fd6701d8d1b2572b5613b5a932dfdfe8a857c\n```\n这样我们就可以通过访问127.0.0.1:5001来访问容器的5000端口。\n\n上面的例子中,默认都是绑定 tcp 端口,如果要绑定 UDP 端口,可以在端口后面加上 /udp。\n```\nrunoob@runoob:~$ docker run -d -p 127.0.0.1:5000:5000/udp training/webapp python app.py\n6779686f06f6204579c1d655dd8b2b31e8e809b245a97b2d3a8e35abe9dcd22a\n```\ndocker port 命令可以让我们快捷地查看端口的绑定情况。\n```\nrunoob@runoob:~$ docker port adoring_stonebraker 5000\n127.0.0.1:5001\n```\n### 容器连接\n端口映射并不是唯一把 docker 连接到另一个容器的方法。\n\ndocker有一个连接系统允许将多个容器连接在一起,共享连接信息。\n\ndocker连接会创建一个父子关系,其中父容器可以看到子容器的信息。\n\n容器命名\n当我们创建一个容器的时候,docker会自动对它进行命名。另外,我们也可以使用--name标识来命名容器,例如:\n\nrunoob@runoob:~$ docker run -d -P --name runoob training/webapp python app.py\n43780a6eabaaf14e590b6e849235c75f3012995403f97749775e38436db9a441\n我们可以使用 docker ps 命令来查看容器名称。\n```\nrunoob@runoob:~$ docker ps -l\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n43780a6eabaa training/webapp \"python app.py\" 3 minutes ago Up 3 minutes 0.0.0.0:32769->5000/tcp runoob\n```\n\n- Docker文件目录和容器内部操作\n- Docker默认的文件目录位于Linux server的/var/lib/docker 下面。目录结构如下\n\n|-----containers:用于存储容器信息\n|-----image:用来存储镜像中间件及本身信息,大小,依赖信息\n|-----network\n|-----swarm\n|-----tmp:docker临时目录\n|-----trust:docker信任目录\n|-----volumes:docker卷目录\n\n>还可以通过docker指令确认文件位置:\n`docker info`\n \n### 查看某个容器的文件目录\n docker exec 容器name ls\n\n### 文件互相拷贝\n\n- 将本地文件拷贝到docker 镜像内\n```\n docker cp 本地路径 容器Id或name:容器目录\n docker cp /Users/howey/Documents/apache-maven-3.5.2/ containername:/opt\n```\n \n- 将docker内文件拷贝到本地文件夹内\n```\n docker cp 容器Id或name:本地路径 镜像路径\n docker cp containername:/Users/howey/Documents/apache-maven-3.5.2 /opt/\n```\n\n>如何进入容器内部呢:使用docker exec可以进入Docker容器并运行指令 \n```\n#docker exec 在运行的容器中执行命令\ndocker exec [OPTIONS] CONTAINER COMMAND [ARG...]\n```\nOPTIONS说明: \n-d :分离模式: 在后台运行 \n-i :即使没有附加也保持STDIN 打开 \n-t :分配一个伪终端 \n通过 exec 命令对指定的容器执行 bash: \n`docker exec -it 容器ID或name bash` \n>-it : 目前的理解浅薄,就是要等在容器内的命令执行完毕才会出来到当前操作; 没有-it的加 就相当于在容器内执行一下命令,不等容器内部是否执行完毕直接出来.\n案例:在容器内创建sqlserver目录,如下所示,安装sqlserver后实际上已经自动创建了data目录,映射的时候无需再次创建直接使用即可.\n\n```\n# docker exec -it sqlserver bash\nmssql@649b4b891718:/$ mkdir /var/opt/mssql/data\nmkdir: cannot create directory '/var/opt/mssql/data': File exists\nmssql@649b4b891718:/$ ls #查看目录列表\nbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var\nmssql@649b4b891718:/$ cd /var/opt #转到opt目录\nmssql@649b4b891718:/var/opt$ ls #查看opt目录\nmssql\nmssql@649b4b891718:/var/opt$ cd mssql \nmssql@649b4b891718:/var/opt/mssql$ ls\ndata log secrets\nmssql@649b4b891718:/var/opt/mssql$ \n```","slug":"docker","published":1,"date":"2024-02-13T00:32:03.420Z","updated":"2024-02-13T00:38:50.000Z","_id":"clsjmshs50000locz6we83dkm","comments":1,"layout":"post","photos":[],"content":"<p>docker相关的常用命令及各种镜像使用</p>\n<h1 id=\"docker\"><a href=\"#docker\" class=\"headerlink\" title=\"docker\"></a>docker</h1><blockquote>\n<p>建议使用linux系统安装docker,如果使用windows则需要bios开启虚拟化,cpu为64位,系统安装hyper-v的组件 </p>\n</blockquote>\n<ul>\n<li>网上资料解释:<br>Docker 底层的核心技术包括 Linux 上的名字空间( Namespaces) 、 控制组( Control groups) 、 Union 文<br>件系统( Union file systems) 和容器格式( Container format) 。<br>我们知道, 传统的虚拟机通过在宿主主机中运行 hypervisor 来模拟一整套完整的硬件环境提供给虚拟机的<br>操作系统。 虚拟机系统看到的环境是可限制的, 也是彼此隔离的。 这种直接的做法实现了对资源最完整的<br>封装, 但很多时候往往意味着系统资源的浪费。<br>例如, 以宿主机和虚拟机系统都为 Linux 系统为例, 虚拟机中运行的应用其实可以利用宿主机系统中的运行环境。<br>我们知道, 在操作系统中, 包括内核、 文件系统、 网络、 PID、 UID、 IPC、 内存、 硬盘、 CPU 等等, 所有<br>的资源都是应用进程直接共享的。 要想实现虚拟化, 除了要实现对内存、 CPU、 网络IO、 硬盘IO、 存储空<br>间等的限制外, 还要实现文件系统、 网络、 PID、 UID、 IPC等等的相互隔离。 前者相对容易实现一些, 后<br>者则需要宿主机系统的深入支持。<br>随着 Linux 系统对于名字空间功能的完善实现, 程序员已经可以实现上面的所有需求, 让某些进程在彼此<br>隔离的名字空间中运行。 大家虽然都共用一个内核和某些运行时环境( 例如一些系统命令和系统库) , 但<br>是彼此却看不到, 都以为系统中只有自己的存在。 这种机制就是容器( Container) , 利用名字空间来做权<br>限的隔离控制, 利用 cgroups 来做资源分配。</li>\n</ul>\n<h2 id=\"安装\"><a href=\"#安装\" class=\"headerlink\" title=\"安装\"></a>安装</h2><h3 id=\"linux\"><a href=\"#linux\" class=\"headerlink\" title=\"linux\"></a>linux</h3><ul>\n<li><p>安装组件:<code>sudo apt install curl</code></p>\n</li>\n<li><p>阿里云镜像安装</p>\n<ul>\n<li>下载路径:<code>sudo curl -fsSL https://get.docker.com | bash -s</code> <code>docker --mirror Aliyun</code></li>\n</ul>\n</li>\n<li><p>官方安装</p>\n<ul>\n<li><code>$ curl -fsSL https://get.docker.com -o get-docker.sh</code></li>\n<li><code>$ sudo sh get-docker.sh</code><br>如果提示<code>无法定位软件包 docker-compose-plugin</code>,则update或者更换源</li>\n</ul>\n</li>\n<li><p>下载完成后查看一下版本信息<br><code>docker -v</code></p>\n</li>\n<li><p>Debian下可直接通过apt安装<br><code>apt install docker.io</code> </p>\n</li>\n<li><p>Ubuntu下离线安装</p>\n</li>\n</ul>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">1. 在联网的环境中拉取Docker的安装包和镜像</span><br><span class=\"line\">bash</span><br><span class=\"line\">curl -fsSL get.docker.com -o get-docker.sh</span><br><span class=\"line\">sudo sh get-docker.sh </span><br><span class=\"line\">docker pull ubuntu:16.04 # 拉取一个示例镜像用于测试</span><br><span class=\"line\">2. 导出刚拉取的Docker安装包、镜像和其他依赖</span><br><span class=\"line\">bash</span><br><span class=\"line\">\\\\导出Docker安装包</span><br><span class=\"line\">sudo tar -cvf docker.tar /usr/bin/docker /usr/share/doc/docker*</span><br><span class=\"line\">\\\\导出Docker镜像</span><br><span class=\"line\">docker save -o ubuntu.tar ubuntu:16.04 </span><br><span class=\"line\">\\\\导出依赖</span><br><span class=\"line\">sudo tar -cvf docker-deps.tar /var/lib/docker /var/run/docker.sock /etc/docker</span><br><span class=\"line\">3. 将导出的 docker.tar、ubuntu.tar和docker-deps.tar复制到离线环境</span><br><span class=\"line\">4. 在离线环境中安装Docker</span><br><span class=\"line\">bash</span><br><span class=\"line\">\\\\解压依赖</span><br><span class=\"line\">sudo tar -xvf docker-deps.tar</span><br><span class=\"line\">\\\\安装Docker</span><br><span class=\"line\">sudo tar -xvf docker.tar -C /</span><br><span class=\"line\">\\\\导入镜像 </span><br><span class=\"line\">docker load -i ubuntu.tar</span><br><span class=\"line\">5. 验证安装是否成功</span><br><span class=\"line\">bash</span><br><span class=\"line\">docker version # 验证Docker版本</span><br><span class=\"line\">docker run -it ubuntu:16.04 /bin/bash # 运行导出的ubuntu镜像</span><br><span class=\"line\">如果能成功运行容器并进到bash,则证明Docker已成功安装。</span><br><span class=\"line\">需要注意的是:</span><br><span class=\"line\">1) 导出和导入的镜像是架构相关的,比如amd64架构的镜像无法在arm64架构的机器上运行。</span><br><span class=\"line\">2) 如果Docker有更新版本,则需要重新进行离线部署的步骤拉取最新版本的安装包和依赖。</span><br><span class=\"line\">3) 可以导出更多的依赖组件,比如 containerd、runc 等,以确保离线环境有更完整的环境。</span><br></pre></td></tr></table></figure></div>\n\n<p>-windows下,则下载官方桌面端,双击安装。记得先打开系统的虚拟化组件。<br> >vbox虚拟机和docker,或者wsl只能用一个</p>\n<pre><code>管理员身份启动cmd \n关闭 \n`bcdedit /set hypervisorlaunchtype off` \n开启 \n`bcdedit /set hypervisorlaunchtype auto` \n关闭虚拟机平台,vbox可启动 \n打开的化,vbox无法使用,可使用windos本身的虚拟机\n</code></pre>\n<h3 id=\"windows\"><a href=\"#windows\" class=\"headerlink\" title=\"windows\"></a>windows</h3><ul>\n<li>在docker官网直接下载dockers desktop</li>\n<li>如果没有hyper支持,可以用旧版本的docker toolbox,在<a class=\"link\" href=\"https://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/?spm=a2c6h.25603864.0.0.298a2767ua94JZ\" >阿里云镜像站docker页面 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a>,这个是一组套件,相当于在vbox虚拟机里运行docker。</li>\n</ul>\n<h3 id=\"配置加速器\"><a href=\"#配置加速器\" class=\"headerlink\" title=\"配置加速器\"></a>配置加速器</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">针对安装了Docker Toolbox的用户,您可以参考以下配置步骤:</span><br><span class=\"line\">创建一台安装有Docker环境的Linux虚拟机,指定机器名称为default,同时配置Docker加速器地址。</span><br><span class=\"line\">docker-machine create --engine-registry-mirror=https://esmp74oa.mirror.aliyuncs.com -d virtualbox default</span><br><span class=\"line\">查看机器的环境配置,并配置到本地,并通过Docker客户端访问Docker服务。</span><br><span class=\"line\">docker-machine env default</span><br><span class=\"line\">eval "$(docker-machine env default)"</span><br><span class=\"line\">docker info</span><br><span class=\"line\">针对安装了Docker for Windows的用户,您可以参考以下配置步骤:</span><br><span class=\"line\">在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:</span><br><span class=\"line\">{</span><br><span class=\"line\"> "registry-mirrors": ["https://esmp74oa.mirror.aliyuncs.com"]</span><br><span class=\"line\">}</span><br><span class=\"line\">编辑完成后点击 Apply 保存按钮,等待Docker重启并应用配置的镜像加速器。 </span><br><span class=\"line\">linux环境下,编辑配置文件/etc/docker/daemon.json</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>start working→</p>\n</blockquote>\n<h2 id=\"使用\"><a href=\"#使用\" class=\"headerlink\" title=\"使用\"></a>使用</h2><h3 id=\"jenkins\"><a href=\"#jenkins\" class=\"headerlink\" title=\"jenkins\"></a>jenkins</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull jenkins/jenkins</span><br><span class=\"line\">sudo mkdir /var/jenkins_home/</span><br><span class=\"line\">sudo chmod 777 /usr/jenkins_home/</span><br><span class=\"line\">docker run -u root -it --name jenkins -p 8080:8080 -p 50000:50000 -v /usr/jenkins_home:/jenkins_home -d jenkins/jenkins</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"net6\"><a href=\"#net6\" class=\"headerlink\" title=\"net6\"></a>net6</h3><ul>\n<li>镜像创建<ul>\n<li>Dockfile<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.</span><br><span class=\"line\">FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base</span><br><span class=\"line\">WORKDIR /app</span><br><span class=\"line\">EXPOSE 1888</span><br><span class=\"line\">FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build</span><br><span class=\"line\">WORKDIR /src</span><br><span class=\"line\">COPY . .</span><br><span class=\"line\">ENTRYPOINT ["dotnet", "XXXX.dll"]</span><br></pre></td></tr></table></figure></div></li>\n<li>publish<br>发布选项对应平台记得匹配docker的系统,linux或者win</li>\n<li>进入发布好的目录<br>命令行,执行<code>docker build -t myimagename .</code></li>\n</ul>\n</li>\n<li>启动<br>这里主要,最好把静态文件和配置文件映射出来方便修改,还有端口<br><code>docker run -itd --name myname-p myport:1802 -v myfile/appsettings.Production.json:/src/appsettings.Production.json --network bridge diyname /bin/bash</code></li>\n<li>网络<br>面的命令网络选择为网桥,所以会有一个虚拟网络地址转换。如何要实现和宿主机或者其他容器的通讯,首先在命令界面<code>ipconfig /all</code>查出本机虚拟网卡的实际地址,如果win系统开启了虚拟化,则虚拟网卡名称为<code>Hyper-V Virtual Ethernet Adapter</code>,这个就是宿主机的虚拟网络中的地址。因为我的mysql是装在宿主机,所以容器连接需要使用该地址。</li>\n<li>mysql授权<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mysql> use mysql;</span><br><span class=\"line\">Database changed</span><br><span class=\"line\">mysql> update user set host = '%' where user = 'root';</span><br><span class=\"line\">Query OK, 1 row affected (0.02 sec)</span><br><span class=\"line\">Rows matched: 1 Changed: 1 Warnings: 0</span><br><span class=\"line\">mysql> FLUSH PRIVILEGES;</span><br><span class=\"line\">Query OK, 0 rows affected (0.01 sec)</span><br></pre></td></tr></table></figure></div></li>\n<li>遇到问题<br>部分页面打开报错,提示找不到Views下的Index,这里主要的原因时因为,页面名称为小写的i,index的都打不开,但在win系统下是可以的。</li>\n</ul>\n<h3 id=\"ghost\"><a href=\"#ghost\" class=\"headerlink\" title=\"ghost\"></a>ghost</h3><p><a class=\"link\" href=\"https://hub.docker.com/_/ghost/\" >ghost官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<blockquote>\n<p>nodejs轻量级博客系统 </p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull ghost</span><br><span class=\"line\">$ docker run -d --name some-ghost -e NODE_ENV=development -e url=http://localhost:3001 -p 3001:2368 ghost</span><br><span class=\"line\">$ docker exec <container-id> node --version</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"wikiJS\"><a href=\"#wikiJS\" class=\"headerlink\" title=\"wikiJS\"></a>wikiJS</h3><p><a class=\"link\" href=\"http://requarks.io/\" >Docker | Wiki.js <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br><a class=\"link\" href=\"https://hub.docker.com/r/requarks/wiki\" >requarks/wiki - Docker Image | Docker Hub <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#这里之前错误的拉成了arm的版本,导致无法启动,可以不填具体版本,默认就行</span><br><span class=\"line\">docker pull requarks/wiki</span><br><span class=\"line\">#wiki</span><br><span class=\"line\">#8080为映射的本地端口</span><br><span class=\"line\">docker run -d -p 8080:3000 --name wiki --restart unless-stopped -e "DB_TYPE=mysql" -e "DB_HOST=192.168.8.103" -e "DB_PORT=3308" -e "DB_USER=root" -e "DB_PASS=root" -e "DB_NAME=wiki" 3065654519c8</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"aria2\"><a href=\"#aria2\" class=\"headerlink\" title=\"aria2\"></a>aria2</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">oldiy/aria2-ui-ng</span><br><span class=\"line\">#Aria2+WebUI+AriaNG+FilesWeb-Docker</span><br><span class=\"line\">docker run -d --name aria2 -p 80:80 -p 6800:6800 -p 443:443 </span><br><span class=\"line\">-p 81:81 -p 8080:8080 -e SECRET=oldiy </span><br><span class=\"line\">-v /your/data:/data -v /your/conf:/conf oldiy/aria2-ui-ng:latest</span><br><span class=\"line\">//实测</span><br><span class=\"line\">docker run -d --name aria2 -p 14153:80 -p 6800:6800 </span><br><span class=\"line\">-p 14152:443 -p 14151:81 -p 14150:8080 </span><br><span class=\"line\">-e SECRET=oldiy </span><br><span class=\"line\">-v /volume2/3t-Data/aria2-data:/data oldiy/aria2-ui-ng:latest</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"tomcat\"><a href=\"#tomcat\" class=\"headerlink\" title=\"tomcat\"></a>tomcat</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ sudo docker run -itd ubuntu:14.04 /bin/bash </span><br><span class=\"line\">docker run -d -p 58080:8080 -v /root/webapps/:/opt/tomcat/webapps/ --name mytomcat_1 mytomcat:1.0 </span><br><span class=\"line\">docker run -d -p 8080:8080 tomcat(镜像名)</span><br><span class=\"line\">docker run <相关参数> <镜像 ID> <初始命令></span><br><span class=\"line\">docker run -i -t -v /root/software/:/mnt/software/ e934 /bin/bash </span><br></pre></td></tr></table></figure></div>\n<p>-i:表示以“交互模式”运行容器<br>-t:表示容器启动后会进入其命令行<br>-v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录></p>\n<h3 id=\"mysql\"><a href=\"#mysql\" class=\"headerlink\" title=\"mysql\"></a>mysql</h3><ul>\n<li>arm版本:<code>docker pull arm64v8/mysql</code></li>\n<li>普通版:<code>docker pull mysql:8.0.31</code></li>\n</ul>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"># docker run -itd --name mysql</span><br><span class=\"line\"> -restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7</span><br><span class=\"line\">#mysql8</span><br><span class=\"line\">#官方启动代码</span><br><span class=\"line\">docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag</span><br><span class=\"line\">#自定义配置文件启动</span><br><span class=\"line\">docker run --name mysql8 -p 3308:3306 --restart=always -v /localdisk/mysql8/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=111111 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci</span><br><span class=\"line\">#映射目录出现未授权建立文件的情况</span><br><span class=\"line\">docker run -d --name mysql8 -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=11111 --privilege</span><br><span class=\"line\">d=true 70325c69f1fe</span><br><span class=\"line\">#远程连接授权</span><br><span class=\"line\">GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; #修改权限</span><br><span class=\"line\">#Mysql 8.0的加密规则变了,在Mysql 8.0以前,加密规则为mysql_native_password,Mysql8.0以后,加密规则为caching_sha2_password caching_sha2_password是一种新的加密方式,提供了比mysql_native_password插件更安全的加密方式</span><br><span class=\"line\">#查看默认加密方式 </span><br><span class=\"line\">show variables like '%authen%'</span><br><span class=\"line\">#为root修改加密方式</span><br><span class=\"line\">alter user 'root'@'%' identified with mysql_native_password by 'root';</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"kali\"><a href=\"#kali\" class=\"headerlink\" title=\"kali\"></a>kali</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -itd --name kali 01eef62a8b9b --restart=always /bin/bash</span><br><span class=\"line\">--privileged=true //获得最高权限,可以挂载smb、</span><br><span class=\"line\">//支持中文,支持smb,支持自动启动 it是进入交互模式,d则是后台运行,attach可进</span><br><span class=\"line\"> docker run -itd --name kali </span><br><span class=\"line\"> --privileged=true </span><br><span class=\"line\"> --restart=always 616f66e03c6b env LANG=C.UTF-8 /bin/bash</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"awtrix2\"><a href=\"#awtrix2\" class=\"headerlink\" title=\"awtrix2\"></a>awtrix2</h3><blockquote>\n<p>(指定环境变量,时区) </p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d --name awtrix2 --restart always \\</span><br><span class=\"line\"> -p 8000:8000 -p 8001:8001 -v /volume2/3t-Data/awtrix2:/data \\</span><br><span class=\"line\"> -e TZ=Asia/Shanghai whyet/awtrix2</span><br><span class=\"line\">#202311更新,关闭自动更新,避免出现因为更新需要下载jar包无法连接导致启动不了的情况</span><br><span class=\"line\">docker run --name awtrix2 -p 7000:7000 -p 7001:7001 -p 5568:5568/udp --restart always -e TZ=Asia/Shanghai -e AUTOUPDATE=false -v /myfiles:/data -d whyet/awtrix2:latest</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"cloudnas-clouddrive\"><a href=\"#cloudnas-clouddrive\" class=\"headerlink\" title=\"cloudnas/clouddrive\"></a>cloudnas/clouddrive</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d --name clouddrive --restart unless-stopped -p 9798:9798 cloudnas/clouddrive</span><br><span class=\"line\">//挂载点</span><br><span class=\"line\">/CloudNAS/CloudDrive</span><br><span class=\"line\">Before run</span><br><span class=\"line\">Clouddrive uses fuse to mount cloud storages, to enable fuse in docker container and share fuse mounts to host, one of the following options should be set in host:</span><br><span class=\"line\">Option 1: enable MountFlags in docker service</span><br><span class=\"line\">#mkdir -p /etc/systemd/system/docker.service.d/</span><br><span class=\"line\">#cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf</span><br><span class=\"line\">[Service]</span><br><span class=\"line\">MountFlags=shared</span><br><span class=\"line\">EOF</span><br><span class=\"line\">Option 2: enable shared mount option for mapped volume in host</span><br><span class=\"line\">#mount --make-shared <volume contains the path to accept cloud mounts></span><br><span class=\"line\">docker run -d \\</span><br><span class=\"line\"> --name clouddrive \\</span><br><span class=\"line\"> --restart unless-stopped \\</span><br><span class=\"line\"> -v <path to accept cloud mounts>:/CloudNAS:shared \\</span><br><span class=\"line\"> -v <path to app data>:/Config \\</span><br><span class=\"line\"> -v <other local shared path>:/media:shared \\</span><br><span class=\"line\"> -p 9798:9798 \\</span><br><span class=\"line\"> --privileged \\</span><br><span class=\"line\"> --device /dev/fuse:/dev/fuse \\</span><br><span class=\"line\"> cloudnas/clouddrive</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"phpzender\"><a href=\"#phpzender\" class=\"headerlink\" title=\"phpzender\"></a>phpzender</h3><p><code>docker run -d -p 803:10081 --name phpzender2 php-zendserver:9.0-php7</code></p>\n<h3 id=\"xampp\"><a href=\"#xampp\" class=\"headerlink\" title=\"xampp\"></a>xampp</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d -p 805:80 --name xampp </span><br><span class=\"line\">-v /root/www/:/opt/lampp/htdocs xampp:7</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"openauth\"><a href=\"#openauth\" class=\"headerlink\" title=\"openauth\"></a>openauth</h3><ul>\n<li>根据自制的镜像启动</li>\n<li>在项目目录下新建Dockerfile,然后运行docker build,生成image<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine</span><br><span class=\"line\">COPY . /publish</span><br><span class=\"line\">WORKDIR /publish</span><br><span class=\"line\">EXPOSE 6000</span><br><span class=\"line\">CMD ["dotnet", "OpenAuth.App.dll", "--server.urls", "http://*:60000"]:q</span><br><span class=\"line\">docker run -d -v /root/publish/:/publish/ </span><br><span class=\"line\">--name openauth -p 6000:6000 openauth:v1</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>要重新打tag的话,语法是:<br><code>docker tag imageId repository:newTag</code></p>\n</blockquote>\n</li>\n</ul>\n<h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><h3 id=\"清除所有运行的容器包括镜像\"><a href=\"#清除所有运行的容器包括镜像\" class=\"headerlink\" title=\"清除所有运行的容器包括镜像\"></a>清除所有运行的容器包括镜像</h3><p><code>docker system prune -a -f</code></p>\n<h3 id=\"启动容器支持中文\"><a href=\"#启动容器支持中文\" class=\"headerlink\" title=\"启动容器支持中文\"></a>启动容器支持中文</h3><p><code>docker run -i -t mysql env LANG=C.UTF-8 /bin/bash</code></p>\n<ul>\n<li><p>创建一个守护态的Docker容器<br><code>$ sudo docker run -itd ubuntu:14.04 /bin/bash</code></p>\n</li>\n<li><p>进入一个已经在运行的容器</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ sudo docker ps</span><br><span class=\"line\">$ sudo docker exec -it 775c7c9ee1e1 /bin/bash</span><br><span class=\"line\">$ sudo docker exec -it 775c7c9ee1e1 /bin/sh</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>如果容器本身以bash建立,直接用attach进入,不是则exec</p>\n</blockquote>\n</li>\n</ul>\n<h3 id=\"创建一个容器,退出时删除\"><a href=\"#创建一个容器,退出时删除\" class=\"headerlink\" title=\"创建一个容器,退出时删除\"></a>创建一个容器,退出时删除</h3><p><code>$ docker run --rm <container_id></code></p>\n<h3 id=\"暂停和恢复\"><a href=\"#暂停和恢复\" class=\"headerlink\" title=\"暂停和恢复\"></a>暂停和恢复</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pause</span><br><span class=\"line\">docker unpause</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"修改参数\"><a href=\"#修改参数\" class=\"headerlink\" title=\"修改参数\"></a>修改参数</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//docker container update --restart=always</span><br><span class=\"line\">docker update kali --restart always</span><br><span class=\"line\">docker container update --restart=always kali </span><br></pre></td></tr></table></figure></div>\n<h3 id=\"保存新的镜像\"><a href=\"#保存新的镜像\" class=\"headerlink\" title=\"保存新的镜像\"></a>保存新的镜像</h3><p>将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1</span><br><span class=\"line\">-a :提交的镜像作者; </span><br><span class=\"line\">-c :使用Dockerfile指令来创建镜像; </span><br><span class=\"line\">-m :提交时的说明文字; </span><br><span class=\"line\">-p :在commit时,将容器暂停。</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li>导出<br><code>docker save ae513a47849c > nginx-save.tar</code></li>\n</ul>\n<h3 id=\"提交到docker-hub\"><a href=\"#提交到docker-hub\" class=\"headerlink\" title=\"提交到docker hub\"></a>提交到docker hub</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//登录后,需要在docker仓库先creat</span><br><span class=\"line\">docker login</span><br><span class=\"line\">docker push XXXX/kali</span><br><span class=\"line\">docker pull XXXX/kali:latest</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"查询docker日志的存储目录\"><a href=\"#查询docker日志的存储目录\" class=\"headerlink\" title=\"查询docker日志的存储目录\"></a>查询docker日志的存储目录</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker inspect container_ID | grep json.log`</span><br><span class=\"line\">docker inspect container_name | grep json.log</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"清docker日志\"><a href=\"#清docker日志\" class=\"headerlink\" title=\"清docker日志\"></a>清docker日志</h3><p><code>cat /dev/null > /var/log/…log-json.log</code></p>\n<h3 id=\"查询并取消容器挂载位置\"><a href=\"#查询并取消容器挂载位置\" class=\"headerlink\" title=\"查询并取消容器挂载位置\"></a>查询并取消容器挂载位置</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">cat /proc/mounts |grep "docker" |grep "caf8ef20f3c1"</span><br><span class=\"line\">#umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets</span><br><span class=\"line\"># umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li><p>进行安装htop工具<br><code>$:sudo apt-get install htop</code></p>\n<ul>\n<li>安装后使用$:htop命令可以更直观查看CPU使用信息</li>\n</ul>\n</li>\n<li><p>防火墙</p>\n<ul>\n<li><p>查看防火墙状态<br>sudo ufw status</p>\n</li>\n<li><p>开启防火墙<br>sudo ufw enable</p>\n</li>\n<li><p>关闭防火墙<br>sudo ufw disable</p>\n</li>\n<li><p>防火墙没问题可能就是80端口没开,执行:<br>iptables -I INPUT -p tcp –dport 36572 -j ACCEPT</p>\n<ul>\n<li>1、清空iptables所有配置(新系统操作)</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<p>sudo iptables -F<br>sudo iptables -X<br>sudo iptables -Z </p>\n<pre><code>- 2、放行SSH远程22端口及lookback规则: \n</code></pre>\n<p>sudo iptables -A INPUT -i lo -j ACCEPT<br>sudo iptables -A OUTPUT -o lo -j ACCEPT<br>sudo iptables -A INPUT -p tcp –dport 22 -j ACCEPT </p>\n<pre><code>- 3、配置默认动作为拒绝,只允许流出数据: \n</code></pre>\n<p>sudo iptables –policy OUTPUT ACCEPT<br>sudo iptables –policy FORWARD DROP<br>sudo iptables -P INPUT DROP<br> >操作这部之前,请确保放行了ssh或者其他远程端口.</p>\n<pre><code>- 4、配置放行的关联规则包\n</code></pre>\n <div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</span><br><span class=\"line\">sudo iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</span><br></pre></td></tr></table></figure></div>\n<pre><code>- 5、Ubuntu保存iptables配置与开机启动(root账号下)\n>如果是普通用户,请切换到root\n</code></pre>\n <div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">super@super:~$ su - root</span><br><span class=\"line\">Password: </span><br><span class=\"line\">root@super:~# iptables-save > /etc/iptables-rules # 保存配置</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li><p>5.1、ubuntu配置规则开机自启动(可以普通账号下)</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">super@super:~$ more /etc/rc.local </span><br><span class=\"line\">#请先配置rc.local服务自启动</span><br><span class=\"line\">#!/bin/bash</span><br><span class=\"line\">#rc.local启动</span><br></pre></td></tr></table></figure></div>\n</li>\n<li><p>iptables配置恢复,默认重启系统iptables配置丢失.</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">iptables-restore < /etc/iptables-rules</span><br><span class=\"line\">exit 0</span><br></pre></td></tr></table></figure></div></li>\n</ul>\n<h3 id=\"Docker-镜像和容器的导入导出\"><a href=\"#Docker-镜像和容器的导入导出\" class=\"headerlink\" title=\"Docker 镜像和容器的导入导出\"></a>Docker 镜像和容器的导入导出</h3><ul>\n<li>镜像的导出和导入</li>\n<li>镜像的保存</li>\n</ul>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master ~]# docker images</span><br><span class=\"line\">REPOSITORY TAG IMAGE ID CREATED SIZE</span><br><span class=\"line\">nginx latest ae513a47849c 2 months ago 109MB</span><br><span class=\"line\">debian jessie 4eb8376dc2a3 2 months ago 127MB</span><br><span class=\"line\">rabbitmq 3.6.8 8cdcbee37f62 15 months ago 179MB</span><br><span class=\"line\">[root@k8s-master tmp]# docker save ae513a47849c > nginx-save.tar</span><br><span class=\"line\">[root@k8s-master tmp]# ls -lh</span><br><span class=\"line\">total 108M</span><br><span class=\"line\">-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li>第二种写法:<br><code>docker save -o nginx-save.tar ae513a47849c</code></li>\n<li>2.镜像的导入<ul>\n<li>可以将导出的nginx-save.tar包传到需要的docker主机上面,然后执行导入命令.</li>\n</ul>\n</li>\n</ul>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master tmp]# ls -lh</span><br><span class=\"line\">total 108M</span><br><span class=\"line\">-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar</span><br><span class=\"line\">[root@k8s-master tmp]# docker load < nginx-save.tar </span><br><span class=\"line\">82b81d779f83: Loading layer [==================================================>] 54.21MB/54.21MB</span><br><span class=\"line\">7ab428981537: Loading layer [==================================================>] 3.584kB/3.584kB</span><br><span class=\"line\">Loaded image ID: sha256:ae513a47849c895a155ddfb868d6ba247f60240ec8495482eca74c4a2c13a881</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li>第三种写法:<br><code>docker load -i nginx-save.tar</code></li>\n</ul>\n<h3 id=\"容器的导出和导入\"><a href=\"#容器的导出和导入\" class=\"headerlink\" title=\"容器的导出和导入\"></a>容器的导出和导入</h3><ul>\n<li><p>1.容器的导出</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master tmp]# docker ps</span><br><span class=\"line\">CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES</span><br><span class=\"line\">220aee82cfea tomcat:7 "catalina.sh run" 9 seconds ago Up 7 seconds 8080/tcp tomcat7</span><br><span class=\"line\">docker export -o mysql-`date +%Y%m%d`.tar 220aee82cfea</span><br></pre></td></tr></table></figure></div></li>\n<li><p>2.容器的导入<br><code>docker import my_ubuntu_v3.tar runoob/ubuntu:v4 </code></p>\n</li>\n<li><p>镜像和容器 导出和导入的区别: </p>\n<ul>\n<li><p>1.镜像导入 是复制的过程</p>\n</li>\n<li><p>2.容器导入 是将当前容器 变成一个新的镜像</p>\n</li>\n<li><p>save 和 export区别:</p>\n<ul>\n<li>1)save 保存镜像所有的信息-包含历史</li>\n<li>2)export 只导出当前的信息</li>\n</ul>\n</li>\n<li><p>docker save images_name: </p>\n<ul>\n<li>将一个镜像导出为文件,再使用docker load命令将文件导入为一个镜像,会保存该镜像的的所有历史记录。比docker export命令导出的文件大,很好理解,因为会保存镜像的所有历史记录。 </li>\n<li>docker export container_id: <ul>\n<li>将一个容器导出为文件,再使用docker import命令将容器导入成为一个新的镜像,但是相比docker save命令,容器文件会丢失所有元数据和历史记录,仅保存容器当时的状态,相当于虚拟机快照。</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><p>普通启动的容器</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run ubuntu:15.10 /bin/echo "Hello world"</span><br><span class=\"line\">Hello world</span><br></pre></td></tr></table></figure></div></li>\n</ul>\n<blockquote>\n<p>各个参数解析:</p>\n</blockquote>\n<ul>\n<li><p>docker: Docker 的二进制执行文件。</p>\n</li>\n<li><p>run:与前面的 docker 组合来运行一个容器。</p>\n</li>\n<li><p>ubuntu:15.10指定要运行的镜像,Docker首先从本地主机上查找镜像是否存在,如果不存在,Docker 就会从镜像仓库 Docker Hub 下载公共镜像。</p>\n</li>\n<li><p>/bin/echo “Hello world”: 在启动的容器里执行的命令</p>\n</li>\n<li><p>运行交互式的容器<br>我们通过docker的两个参数 -i -t,让docker运行的容器实现”对话”的能力</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -i -t ubuntu:15.10 /bin/bash</span><br><span class=\"line\">root@dc0050c79503:/#</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>各个参数解析:</p>\n</blockquote>\n</li>\n</ul>\n<p>-t:在新容器内指定一个伪终端或终端。</p>\n<p>-i:允许你对容器内的标准输入 (STDIN) 进行交互。</p>\n<p>启动容器(后台模式)<br>使用以下命令创建一个以进程方式运行的容器</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d ubuntu:15.10 /bin/sh -c "while true; do echo hello world; sleep 1; done"</span><br><span class=\"line\">2b1b7a428627c51ab8810d541d759f072b4fc75487eed05812646b8534a2fe63</span><br></pre></td></tr></table></figure></div>\n<ul>\n<li>首先,我们需要确认容器有在运行,可以通过 docker ps 来查看</li>\n</ul>\n<p><code>runoob@runoob:~$ docker ps</code></p>\n<p>CONTAINER ID:容器ID</p>\n<p>NAMES:自动分配的容器名称</p>\n<p>在容器内使用docker logs命令,查看容器内的标准输出</p>\n<p><code>runoob@runoob:~$ docker logs 2b1b7a428627</code> </p>\n<h3 id=\"构建镜像\"><a href=\"#构建镜像\" class=\"headerlink\" title=\"构建镜像\"></a>构建镜像</h3><p>我们使用命令 docker build , 从零开始来创建一个新的镜像。为此,我们需要创建一个 Dockerfile 文件,其中包含一组指令来告诉 Docker 如何构建我们的镜像。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ cat Dockerfile </span><br><span class=\"line\">FROM centos:6.7</span><br><span class=\"line\">MAINTAINER Fisher "fisher@sudops.com"</span><br><span class=\"line\">RUN /bin/echo 'root:123456' |chpasswd</span><br><span class=\"line\">RUN useradd runoob</span><br><span class=\"line\">RUN /bin/echo 'runoob:123456' |chpasswd</span><br><span class=\"line\">RUN /bin/echo -e "LANG=\\"en_US.UTF-8\\"" >/etc/default/local</span><br><span class=\"line\">EXPOSE 22</span><br><span class=\"line\">EXPOSE 80</span><br><span class=\"line\">CMD /usr/sbin/sshd -D</span><br></pre></td></tr></table></figure></div>\n<p>每一个指令都会在镜像上创建一个新的层,每一个指令的前缀都必须是大写的。<br>第一条FROM,指定使用哪个镜像源<br>RUN 指令告诉docker 在镜像内执行命令,安装了什么。。。<br>然后,我们使用 Dockerfile 文件,通过 docker build 命令来构建一个镜像。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker build -t runoob/centos:6.7 .</span><br><span class=\"line\">Sending build context to Docker daemon 17.92 kB</span><br><span class=\"line\">Step 1 : FROM centos:6.7</span><br><span class=\"line\"> ---&gt; d95b5ca17cc3</span><br><span class=\"line\">Step 2 : MAINTAINER Fisher "fisher@sudops.com"</span><br><span class=\"line\"> ---&gt; Using cache</span><br><span class=\"line\"> ---&gt; 0c92299c6f03</span><br><span class=\"line\">Step 3 : RUN /bin/echo 'root:123456' |chpasswd</span><br><span class=\"line\"> ---&gt; Using cache</span><br><span class=\"line\"> ---&gt; 0397ce2fbd0a</span><br><span class=\"line\">Step 4 : RUN useradd runoob</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>参数说明:</p>\n</blockquote>\n<p>-t :指定要创建的目标镜像名</p>\n<p>. :Dockerfile 文件所在目录,可以指定Dockerfile 的绝对路径</p>\n<p>使用docker images 查看创建的镜像已经在列表中存在,镜像ID为860c279d2fec</p>\n<p>runoob@runoob:~$ docker images<br>REPOSITORY TAG IMAGE ID CREATED SIZE</p>\n<p>我们可以使用新的镜像来创建容器</p>\n<p>runoob@runoob:~$ docker run -t -i runoob/centos:6.7 /bin/bash<br>[root@41c28d18b5fb /]# id runoob<br>uid=500(runoob) gid=500(runoob) groups=500(runoob)<br>从上面看到新镜像已经包含我们创建的用户runoob</p>\n<p>网络端口映射<br>我们创建了一个 python 应用的容器。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -P training/webapp python app.py</span><br><span class=\"line\">fce072cc88cee71b1cdceb57c2821d054a4a59f67da6b416fceb5593f059fc6d</span><br></pre></td></tr></table></figure></div>\n<p>另外,我们可以指定容器绑定的网络地址,比如绑定 127.0.0.1。</p>\n<p>我们使用 -P 参数创建一个容器,使用 docker ps 来看到端口5000绑定主机端口32768。</p>\n<p>另外,我们可以指定容器绑定的网络地址,比如绑定127.0.0.1。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -p 127.0.0.1:5001:5000 training/webapp python app.py</span><br><span class=\"line\">95c6ceef88ca3e71eaf303c2833fd6701d8d1b2572b5613b5a932dfdfe8a857c</span><br></pre></td></tr></table></figure></div>\n<p>这样我们就可以通过访问127.0.0.1:5001来访问容器的5000端口。</p>\n<p>上面的例子中,默认都是绑定 tcp 端口,如果要绑定 UDP 端口,可以在端口后面加上 /udp。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -p 127.0.0.1:5000:5000/udp training/webapp python app.py</span><br><span class=\"line\">6779686f06f6204579c1d655dd8b2b31e8e809b245a97b2d3a8e35abe9dcd22a</span><br></pre></td></tr></table></figure></div>\n<p>docker port 命令可以让我们快捷地查看端口的绑定情况。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker port adoring_stonebraker 5000</span><br><span class=\"line\">127.0.0.1:5001</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"容器连接\"><a href=\"#容器连接\" class=\"headerlink\" title=\"容器连接\"></a>容器连接</h3><p>端口映射并不是唯一把 docker 连接到另一个容器的方法。</p>\n<p>docker有一个连接系统允许将多个容器连接在一起,共享连接信息。</p>\n<p>docker连接会创建一个父子关系,其中父容器可以看到子容器的信息。</p>\n<p>容器命名<br>当我们创建一个容器的时候,docker会自动对它进行命名。另外,我们也可以使用–name标识来命名容器,例如:</p>\n<p>runoob@runoob:~$ docker run -d -P –name runoob training/webapp python app.py<br>43780a6eabaaf14e590b6e849235c75f3012995403f97749775e38436db9a441<br>我们可以使用 docker ps 命令来查看容器名称。</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker ps -l</span><br><span class=\"line\">CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES</span><br><span class=\"line\">43780a6eabaa training/webapp "python app.py" 3 minutes ago Up 3 minutes 0.0.0.0:32769->5000/tcp runoob</span><br></pre></td></tr></table></figure></div>\n\n<ul>\n<li>Docker文件目录和容器内部操作</li>\n<li>Docker默认的文件目录位于Linux server的/var/lib/docker 下面。目录结构如下</li>\n</ul>\n<p>|—–containers:用于存储容器信息<br>|—–image:用来存储镜像中间件及本身信息,大小,依赖信息<br>|—–network<br>|—–swarm<br>|—–tmp:docker临时目录<br>|—–trust:docker信任目录<br>|—–volumes:docker卷目录</p>\n<blockquote>\n<p>还可以通过docker指令确认文件位置:<br><code>docker info</code>\n </p>\n</blockquote>\n<h3 id=\"查看某个容器的文件目录\"><a href=\"#查看某个容器的文件目录\" class=\"headerlink\" title=\"查看某个容器的文件目录\"></a>查看某个容器的文件目录</h3><p> docker exec 容器name ls</p>\n<h3 id=\"文件互相拷贝\"><a href=\"#文件互相拷贝\" class=\"headerlink\" title=\"文件互相拷贝\"></a>文件互相拷贝</h3><ul>\n<li>将本地文件拷贝到docker 镜像内<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"> docker cp 本地路径 容器Id或name:容器目录</span><br><span class=\"line\">docker cp /Users/howey/Documents/apache-maven-3.5.2/ containername:/opt</span><br></pre></td></tr></table></figure></div>\n</li>\n<li>将docker内文件拷贝到本地文件夹内<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker cp 容器Id或name:本地路径 镜像路径</span><br><span class=\"line\">docker cp containername:/Users/howey/Documents/apache-maven-3.5.2 /opt/</span><br></pre></td></tr></table></figure></div></li>\n</ul>\n<blockquote>\n<p>如何进入容器内部呢:使用docker exec可以进入Docker容器并运行指令 </p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#docker exec 在运行的容器中执行命令</span><br><span class=\"line\">docker exec [OPTIONS] CONTAINER COMMAND [ARG...]</span><br></pre></td></tr></table></figure></div>\n<p>OPTIONS说明:<br>-d :分离模式: 在后台运行<br>-i :即使没有附加也保持STDIN 打开<br>-t :分配一个伪终端<br>通过 exec 命令对指定的容器执行 bash:<br><code>docker exec -it 容器ID或name bash</code> </p>\n<blockquote>\n<p>-it : 目前的理解浅薄,就是要等在容器内的命令执行完毕才会出来到当前操作; 没有-it的加 就相当于在容器内执行一下命令,不等容器内部是否执行完毕直接出来.<br>案例:在容器内创建sqlserver目录,如下所示,安装sqlserver后实际上已经自动创建了data目录,映射的时候无需再次创建直接使用即可.</p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"># docker exec -it sqlserver bash</span><br><span class=\"line\">mssql@649b4b891718:/$ mkdir /var/opt/mssql/data</span><br><span class=\"line\">mkdir: cannot create directory '/var/opt/mssql/data': File exists</span><br><span class=\"line\">mssql@649b4b891718:/$ ls #查看目录列表</span><br><span class=\"line\">bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var</span><br><span class=\"line\">mssql@649b4b891718:/$ cd /var/opt #转到opt目录</span><br><span class=\"line\">mssql@649b4b891718:/var/opt$ ls #查看opt目录</span><br><span class=\"line\">mssql</span><br><span class=\"line\">mssql@649b4b891718:/var/opt$ cd mssql </span><br><span class=\"line\">mssql@649b4b891718:/var/opt/mssql$ ls</span><br><span class=\"line\">data log secrets</span><br><span class=\"line\">mssql@649b4b891718:/var/opt/mssql$ </span><br></pre></td></tr></table></figure></div>","excerpt":"","more":"<p>docker相关的常用命令及各种镜像使用</p>\n<h1 id=\"docker\"><a href=\"#docker\" class=\"headerlink\" title=\"docker\"></a>docker</h1><blockquote>\n<p>建议使用linux系统安装docker,如果使用windows则需要bios开启虚拟化,cpu为64位,系统安装hyper-v的组件 </p>\n</blockquote>\n<ul>\n<li>网上资料解释:<br>Docker 底层的核心技术包括 Linux 上的名字空间( Namespaces) 、 控制组( Control groups) 、 Union 文<br>件系统( Union file systems) 和容器格式( Container format) 。<br>我们知道, 传统的虚拟机通过在宿主主机中运行 hypervisor 来模拟一整套完整的硬件环境提供给虚拟机的<br>操作系统。 虚拟机系统看到的环境是可限制的, 也是彼此隔离的。 这种直接的做法实现了对资源最完整的<br>封装, 但很多时候往往意味着系统资源的浪费。<br>例如, 以宿主机和虚拟机系统都为 Linux 系统为例, 虚拟机中运行的应用其实可以利用宿主机系统中的运行环境。<br>我们知道, 在操作系统中, 包括内核、 文件系统、 网络、 PID、 UID、 IPC、 内存、 硬盘、 CPU 等等, 所有<br>的资源都是应用进程直接共享的。 要想实现虚拟化, 除了要实现对内存、 CPU、 网络IO、 硬盘IO、 存储空<br>间等的限制外, 还要实现文件系统、 网络、 PID、 UID、 IPC等等的相互隔离。 前者相对容易实现一些, 后<br>者则需要宿主机系统的深入支持。<br>随着 Linux 系统对于名字空间功能的完善实现, 程序员已经可以实现上面的所有需求, 让某些进程在彼此<br>隔离的名字空间中运行。 大家虽然都共用一个内核和某些运行时环境( 例如一些系统命令和系统库) , 但<br>是彼此却看不到, 都以为系统中只有自己的存在。 这种机制就是容器( Container) , 利用名字空间来做权<br>限的隔离控制, 利用 cgroups 来做资源分配。</li>\n</ul>\n<h2 id=\"安装\"><a href=\"#安装\" class=\"headerlink\" title=\"安装\"></a>安装</h2><h3 id=\"linux\"><a href=\"#linux\" class=\"headerlink\" title=\"linux\"></a>linux</h3><ul>\n<li><p>安装组件:<code>sudo apt install curl</code></p>\n</li>\n<li><p>阿里云镜像安装</p>\n<ul>\n<li>下载路径:<code>sudo curl -fsSL https://get.docker.com | bash -s</code> <code>docker --mirror Aliyun</code></li>\n</ul>\n</li>\n<li><p>官方安装</p>\n<ul>\n<li><code>$ curl -fsSL https://get.docker.com -o get-docker.sh</code></li>\n<li><code>$ sudo sh get-docker.sh</code><br>如果提示<code>无法定位软件包 docker-compose-plugin</code>,则update或者更换源</li>\n</ul>\n</li>\n<li><p>下载完成后查看一下版本信息<br><code>docker -v</code></p>\n</li>\n<li><p>Debian下可直接通过apt安装<br><code>apt install docker.io</code> </p>\n</li>\n<li><p>Ubuntu下离线安装</p>\n</li>\n</ul>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">1. 在联网的环境中拉取Docker的安装包和镜像</span><br><span class=\"line\">bash</span><br><span class=\"line\">curl -fsSL get.docker.com -o get-docker.sh</span><br><span class=\"line\">sudo sh get-docker.sh </span><br><span class=\"line\">docker pull ubuntu:16.04 # 拉取一个示例镜像用于测试</span><br><span class=\"line\">2. 导出刚拉取的Docker安装包、镜像和其他依赖</span><br><span class=\"line\">bash</span><br><span class=\"line\">\\\\导出Docker安装包</span><br><span class=\"line\">sudo tar -cvf docker.tar /usr/bin/docker /usr/share/doc/docker*</span><br><span class=\"line\">\\\\导出Docker镜像</span><br><span class=\"line\">docker save -o ubuntu.tar ubuntu:16.04 </span><br><span class=\"line\">\\\\导出依赖</span><br><span class=\"line\">sudo tar -cvf docker-deps.tar /var/lib/docker /var/run/docker.sock /etc/docker</span><br><span class=\"line\">3. 将导出的 docker.tar、ubuntu.tar和docker-deps.tar复制到离线环境</span><br><span class=\"line\">4. 在离线环境中安装Docker</span><br><span class=\"line\">bash</span><br><span class=\"line\">\\\\解压依赖</span><br><span class=\"line\">sudo tar -xvf docker-deps.tar</span><br><span class=\"line\">\\\\安装Docker</span><br><span class=\"line\">sudo tar -xvf docker.tar -C /</span><br><span class=\"line\">\\\\导入镜像 </span><br><span class=\"line\">docker load -i ubuntu.tar</span><br><span class=\"line\">5. 验证安装是否成功</span><br><span class=\"line\">bash</span><br><span class=\"line\">docker version # 验证Docker版本</span><br><span class=\"line\">docker run -it ubuntu:16.04 /bin/bash # 运行导出的ubuntu镜像</span><br><span class=\"line\">如果能成功运行容器并进到bash,则证明Docker已成功安装。</span><br><span class=\"line\">需要注意的是:</span><br><span class=\"line\">1) 导出和导入的镜像是架构相关的,比如amd64架构的镜像无法在arm64架构的机器上运行。</span><br><span class=\"line\">2) 如果Docker有更新版本,则需要重新进行离线部署的步骤拉取最新版本的安装包和依赖。</span><br><span class=\"line\">3) 可以导出更多的依赖组件,比如 containerd、runc 等,以确保离线环境有更完整的环境。</span><br></pre></td></tr></table></figure>\n\n<p>-windows下,则下载官方桌面端,双击安装。记得先打开系统的虚拟化组件。<br> >vbox虚拟机和docker,或者wsl只能用一个</p>\n<pre><code>管理员身份启动cmd \n关闭 \n`bcdedit /set hypervisorlaunchtype off` \n开启 \n`bcdedit /set hypervisorlaunchtype auto` \n关闭虚拟机平台,vbox可启动 \n打开的化,vbox无法使用,可使用windos本身的虚拟机\n</code></pre>\n<h3 id=\"windows\"><a href=\"#windows\" class=\"headerlink\" title=\"windows\"></a>windows</h3><ul>\n<li>在docker官网直接下载dockers desktop</li>\n<li>如果没有hyper支持,可以用旧版本的docker toolbox,在<a class=\"link\" href=\"https://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/?spm=a2c6h.25603864.0.0.298a2767ua94JZ\" >阿里云镜像站docker页面 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a>,这个是一组套件,相当于在vbox虚拟机里运行docker。</li>\n</ul>\n<h3 id=\"配置加速器\"><a href=\"#配置加速器\" class=\"headerlink\" title=\"配置加速器\"></a>配置加速器</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">针对安装了Docker Toolbox的用户,您可以参考以下配置步骤:</span><br><span class=\"line\">创建一台安装有Docker环境的Linux虚拟机,指定机器名称为default,同时配置Docker加速器地址。</span><br><span class=\"line\">docker-machine create --engine-registry-mirror=https://esmp74oa.mirror.aliyuncs.com -d virtualbox default</span><br><span class=\"line\">查看机器的环境配置,并配置到本地,并通过Docker客户端访问Docker服务。</span><br><span class=\"line\">docker-machine env default</span><br><span class=\"line\">eval "$(docker-machine env default)"</span><br><span class=\"line\">docker info</span><br><span class=\"line\">针对安装了Docker for Windows的用户,您可以参考以下配置步骤:</span><br><span class=\"line\">在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:</span><br><span class=\"line\">{</span><br><span class=\"line\"> "registry-mirrors": ["https://esmp74oa.mirror.aliyuncs.com"]</span><br><span class=\"line\">}</span><br><span class=\"line\">编辑完成后点击 Apply 保存按钮,等待Docker重启并应用配置的镜像加速器。 </span><br><span class=\"line\">linux环境下,编辑配置文件/etc/docker/daemon.json</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>start working→</p>\n</blockquote>\n<h2 id=\"使用\"><a href=\"#使用\" class=\"headerlink\" title=\"使用\"></a>使用</h2><h3 id=\"jenkins\"><a href=\"#jenkins\" class=\"headerlink\" title=\"jenkins\"></a>jenkins</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull jenkins/jenkins</span><br><span class=\"line\">sudo mkdir /var/jenkins_home/</span><br><span class=\"line\">sudo chmod 777 /usr/jenkins_home/</span><br><span class=\"line\">docker run -u root -it --name jenkins -p 8080:8080 -p 50000:50000 -v /usr/jenkins_home:/jenkins_home -d jenkins/jenkins</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"net6\"><a href=\"#net6\" class=\"headerlink\" title=\"net6\"></a>net6</h3><ul>\n<li>镜像创建<ul>\n<li>Dockfile<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.</span><br><span class=\"line\">FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base</span><br><span class=\"line\">WORKDIR /app</span><br><span class=\"line\">EXPOSE 1888</span><br><span class=\"line\">FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build</span><br><span class=\"line\">WORKDIR /src</span><br><span class=\"line\">COPY . .</span><br><span class=\"line\">ENTRYPOINT ["dotnet", "XXXX.dll"]</span><br></pre></td></tr></table></figure></li>\n<li>publish<br>发布选项对应平台记得匹配docker的系统,linux或者win</li>\n<li>进入发布好的目录<br>命令行,执行<code>docker build -t myimagename .</code></li>\n</ul>\n</li>\n<li>启动<br>这里主要,最好把静态文件和配置文件映射出来方便修改,还有端口<br><code>docker run -itd --name myname-p myport:1802 -v myfile/appsettings.Production.json:/src/appsettings.Production.json --network bridge diyname /bin/bash</code></li>\n<li>网络<br>面的命令网络选择为网桥,所以会有一个虚拟网络地址转换。如何要实现和宿主机或者其他容器的通讯,首先在命令界面<code>ipconfig /all</code>查出本机虚拟网卡的实际地址,如果win系统开启了虚拟化,则虚拟网卡名称为<code>Hyper-V Virtual Ethernet Adapter</code>,这个就是宿主机的虚拟网络中的地址。因为我的mysql是装在宿主机,所以容器连接需要使用该地址。</li>\n<li>mysql授权<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mysql> use mysql;</span><br><span class=\"line\">Database changed</span><br><span class=\"line\">mysql> update user set host = '%' where user = 'root';</span><br><span class=\"line\">Query OK, 1 row affected (0.02 sec)</span><br><span class=\"line\">Rows matched: 1 Changed: 1 Warnings: 0</span><br><span class=\"line\">mysql> FLUSH PRIVILEGES;</span><br><span class=\"line\">Query OK, 0 rows affected (0.01 sec)</span><br></pre></td></tr></table></figure></li>\n<li>遇到问题<br>部分页面打开报错,提示找不到Views下的Index,这里主要的原因时因为,页面名称为小写的i,index的都打不开,但在win系统下是可以的。</li>\n</ul>\n<h3 id=\"ghost\"><a href=\"#ghost\" class=\"headerlink\" title=\"ghost\"></a>ghost</h3><p><a class=\"link\" href=\"https://hub.docker.com/_/ghost/\" >ghost官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<blockquote>\n<p>nodejs轻量级博客系统 </p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull ghost</span><br><span class=\"line\">$ docker run -d --name some-ghost -e NODE_ENV=development -e url=http://localhost:3001 -p 3001:2368 ghost</span><br><span class=\"line\">$ docker exec <container-id> node --version</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"wikiJS\"><a href=\"#wikiJS\" class=\"headerlink\" title=\"wikiJS\"></a>wikiJS</h3><p><a class=\"link\" href=\"http://requarks.io/\" >Docker | Wiki.js <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br><a class=\"link\" href=\"https://hub.docker.com/r/requarks/wiki\" >requarks/wiki - Docker Image | Docker Hub <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#这里之前错误的拉成了arm的版本,导致无法启动,可以不填具体版本,默认就行</span><br><span class=\"line\">docker pull requarks/wiki</span><br><span class=\"line\">#wiki</span><br><span class=\"line\">#8080为映射的本地端口</span><br><span class=\"line\">docker run -d -p 8080:3000 --name wiki --restart unless-stopped -e "DB_TYPE=mysql" -e "DB_HOST=192.168.8.103" -e "DB_PORT=3308" -e "DB_USER=root" -e "DB_PASS=root" -e "DB_NAME=wiki" 3065654519c8</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"aria2\"><a href=\"#aria2\" class=\"headerlink\" title=\"aria2\"></a>aria2</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">oldiy/aria2-ui-ng</span><br><span class=\"line\">#Aria2+WebUI+AriaNG+FilesWeb-Docker</span><br><span class=\"line\">docker run -d --name aria2 -p 80:80 -p 6800:6800 -p 443:443 </span><br><span class=\"line\">-p 81:81 -p 8080:8080 -e SECRET=oldiy </span><br><span class=\"line\">-v /your/data:/data -v /your/conf:/conf oldiy/aria2-ui-ng:latest</span><br><span class=\"line\">//实测</span><br><span class=\"line\">docker run -d --name aria2 -p 14153:80 -p 6800:6800 </span><br><span class=\"line\">-p 14152:443 -p 14151:81 -p 14150:8080 </span><br><span class=\"line\">-e SECRET=oldiy </span><br><span class=\"line\">-v /volume2/3t-Data/aria2-data:/data oldiy/aria2-ui-ng:latest</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"tomcat\"><a href=\"#tomcat\" class=\"headerlink\" title=\"tomcat\"></a>tomcat</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ sudo docker run -itd ubuntu:14.04 /bin/bash </span><br><span class=\"line\">docker run -d -p 58080:8080 -v /root/webapps/:/opt/tomcat/webapps/ --name mytomcat_1 mytomcat:1.0 </span><br><span class=\"line\">docker run -d -p 8080:8080 tomcat(镜像名)</span><br><span class=\"line\">docker run <相关参数> <镜像 ID> <初始命令></span><br><span class=\"line\">docker run -i -t -v /root/software/:/mnt/software/ e934 /bin/bash </span><br></pre></td></tr></table></figure>\n<p>-i:表示以“交互模式”运行容器<br>-t:表示容器启动后会进入其命令行<br>-v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录></p>\n<h3 id=\"mysql\"><a href=\"#mysql\" class=\"headerlink\" title=\"mysql\"></a>mysql</h3><ul>\n<li>arm版本:<code>docker pull arm64v8/mysql</code></li>\n<li>普通版:<code>docker pull mysql:8.0.31</code></li>\n</ul>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"># docker run -itd --name mysql</span><br><span class=\"line\"> -restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7</span><br><span class=\"line\">#mysql8</span><br><span class=\"line\">#官方启动代码</span><br><span class=\"line\">docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag</span><br><span class=\"line\">#自定义配置文件启动</span><br><span class=\"line\">docker run --name mysql8 -p 3308:3306 --restart=always -v /localdisk/mysql8/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=111111 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci</span><br><span class=\"line\">#映射目录出现未授权建立文件的情况</span><br><span class=\"line\">docker run -d --name mysql8 -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=11111 --privilege</span><br><span class=\"line\">d=true 70325c69f1fe</span><br><span class=\"line\">#远程连接授权</span><br><span class=\"line\">GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; #修改权限</span><br><span class=\"line\">#Mysql 8.0的加密规则变了,在Mysql 8.0以前,加密规则为mysql_native_password,Mysql8.0以后,加密规则为caching_sha2_password caching_sha2_password是一种新的加密方式,提供了比mysql_native_password插件更安全的加密方式</span><br><span class=\"line\">#查看默认加密方式 </span><br><span class=\"line\">show variables like '%authen%'</span><br><span class=\"line\">#为root修改加密方式</span><br><span class=\"line\">alter user 'root'@'%' identified with mysql_native_password by 'root';</span><br></pre></td></tr></table></figure>\n<h3 id=\"kali\"><a href=\"#kali\" class=\"headerlink\" title=\"kali\"></a>kali</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -itd --name kali 01eef62a8b9b --restart=always /bin/bash</span><br><span class=\"line\">--privileged=true //获得最高权限,可以挂载smb、</span><br><span class=\"line\">//支持中文,支持smb,支持自动启动 it是进入交互模式,d则是后台运行,attach可进</span><br><span class=\"line\"> docker run -itd --name kali </span><br><span class=\"line\"> --privileged=true </span><br><span class=\"line\"> --restart=always 616f66e03c6b env LANG=C.UTF-8 /bin/bash</span><br></pre></td></tr></table></figure>\n<h3 id=\"awtrix2\"><a href=\"#awtrix2\" class=\"headerlink\" title=\"awtrix2\"></a>awtrix2</h3><blockquote>\n<p>(指定环境变量,时区) </p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d --name awtrix2 --restart always \\</span><br><span class=\"line\"> -p 8000:8000 -p 8001:8001 -v /volume2/3t-Data/awtrix2:/data \\</span><br><span class=\"line\"> -e TZ=Asia/Shanghai whyet/awtrix2</span><br><span class=\"line\">#202311更新,关闭自动更新,避免出现因为更新需要下载jar包无法连接导致启动不了的情况</span><br><span class=\"line\">docker run --name awtrix2 -p 7000:7000 -p 7001:7001 -p 5568:5568/udp --restart always -e TZ=Asia/Shanghai -e AUTOUPDATE=false -v /myfiles:/data -d whyet/awtrix2:latest</span><br></pre></td></tr></table></figure>\n<h3 id=\"cloudnas-clouddrive\"><a href=\"#cloudnas-clouddrive\" class=\"headerlink\" title=\"cloudnas/clouddrive\"></a>cloudnas/clouddrive</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d --name clouddrive --restart unless-stopped -p 9798:9798 cloudnas/clouddrive</span><br><span class=\"line\">//挂载点</span><br><span class=\"line\">/CloudNAS/CloudDrive</span><br><span class=\"line\">Before run</span><br><span class=\"line\">Clouddrive uses fuse to mount cloud storages, to enable fuse in docker container and share fuse mounts to host, one of the following options should be set in host:</span><br><span class=\"line\">Option 1: enable MountFlags in docker service</span><br><span class=\"line\">#mkdir -p /etc/systemd/system/docker.service.d/</span><br><span class=\"line\">#cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf</span><br><span class=\"line\">[Service]</span><br><span class=\"line\">MountFlags=shared</span><br><span class=\"line\">EOF</span><br><span class=\"line\">Option 2: enable shared mount option for mapped volume in host</span><br><span class=\"line\">#mount --make-shared <volume contains the path to accept cloud mounts></span><br><span class=\"line\">docker run -d \\</span><br><span class=\"line\"> --name clouddrive \\</span><br><span class=\"line\"> --restart unless-stopped \\</span><br><span class=\"line\"> -v <path to accept cloud mounts>:/CloudNAS:shared \\</span><br><span class=\"line\"> -v <path to app data>:/Config \\</span><br><span class=\"line\"> -v <other local shared path>:/media:shared \\</span><br><span class=\"line\"> -p 9798:9798 \\</span><br><span class=\"line\"> --privileged \\</span><br><span class=\"line\"> --device /dev/fuse:/dev/fuse \\</span><br><span class=\"line\"> cloudnas/clouddrive</span><br></pre></td></tr></table></figure>\n<h3 id=\"phpzender\"><a href=\"#phpzender\" class=\"headerlink\" title=\"phpzender\"></a>phpzender</h3><p><code>docker run -d -p 803:10081 --name phpzender2 php-zendserver:9.0-php7</code></p>\n<h3 id=\"xampp\"><a href=\"#xampp\" class=\"headerlink\" title=\"xampp\"></a>xampp</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker run -d -p 805:80 --name xampp </span><br><span class=\"line\">-v /root/www/:/opt/lampp/htdocs xampp:7</span><br></pre></td></tr></table></figure>\n<h3 id=\"openauth\"><a href=\"#openauth\" class=\"headerlink\" title=\"openauth\"></a>openauth</h3><ul>\n<li>根据自制的镜像启动</li>\n<li>在项目目录下新建Dockerfile,然后运行docker build,生成image<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine</span><br><span class=\"line\">COPY . /publish</span><br><span class=\"line\">WORKDIR /publish</span><br><span class=\"line\">EXPOSE 6000</span><br><span class=\"line\">CMD ["dotnet", "OpenAuth.App.dll", "--server.urls", "http://*:60000"]:q</span><br><span class=\"line\">docker run -d -v /root/publish/:/publish/ </span><br><span class=\"line\">--name openauth -p 6000:6000 openauth:v1</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>要重新打tag的话,语法是:<br><code>docker tag imageId repository:newTag</code></p>\n</blockquote>\n</li>\n</ul>\n<h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><h3 id=\"清除所有运行的容器包括镜像\"><a href=\"#清除所有运行的容器包括镜像\" class=\"headerlink\" title=\"清除所有运行的容器包括镜像\"></a>清除所有运行的容器包括镜像</h3><p><code>docker system prune -a -f</code></p>\n<h3 id=\"启动容器支持中文\"><a href=\"#启动容器支持中文\" class=\"headerlink\" title=\"启动容器支持中文\"></a>启动容器支持中文</h3><p><code>docker run -i -t mysql env LANG=C.UTF-8 /bin/bash</code></p>\n<ul>\n<li><p>创建一个守护态的Docker容器<br><code>$ sudo docker run -itd ubuntu:14.04 /bin/bash</code></p>\n</li>\n<li><p>进入一个已经在运行的容器</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ sudo docker ps</span><br><span class=\"line\">$ sudo docker exec -it 775c7c9ee1e1 /bin/bash</span><br><span class=\"line\">$ sudo docker exec -it 775c7c9ee1e1 /bin/sh</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>如果容器本身以bash建立,直接用attach进入,不是则exec</p>\n</blockquote>\n</li>\n</ul>\n<h3 id=\"创建一个容器,退出时删除\"><a href=\"#创建一个容器,退出时删除\" class=\"headerlink\" title=\"创建一个容器,退出时删除\"></a>创建一个容器,退出时删除</h3><p><code>$ docker run --rm <container_id></code></p>\n<h3 id=\"暂停和恢复\"><a href=\"#暂停和恢复\" class=\"headerlink\" title=\"暂停和恢复\"></a>暂停和恢复</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pause</span><br><span class=\"line\">docker unpause</span><br></pre></td></tr></table></figure>\n<h3 id=\"修改参数\"><a href=\"#修改参数\" class=\"headerlink\" title=\"修改参数\"></a>修改参数</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//docker container update --restart=always</span><br><span class=\"line\">docker update kali --restart always</span><br><span class=\"line\">docker container update --restart=always kali </span><br></pre></td></tr></table></figure>\n<h3 id=\"保存新的镜像\"><a href=\"#保存新的镜像\" class=\"headerlink\" title=\"保存新的镜像\"></a>保存新的镜像</h3><p>将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1</span><br><span class=\"line\">-a :提交的镜像作者; </span><br><span class=\"line\">-c :使用Dockerfile指令来创建镜像; </span><br><span class=\"line\">-m :提交时的说明文字; </span><br><span class=\"line\">-p :在commit时,将容器暂停。</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li>导出<br><code>docker save ae513a47849c > nginx-save.tar</code></li>\n</ul>\n<h3 id=\"提交到docker-hub\"><a href=\"#提交到docker-hub\" class=\"headerlink\" title=\"提交到docker hub\"></a>提交到docker hub</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//登录后,需要在docker仓库先creat</span><br><span class=\"line\">docker login</span><br><span class=\"line\">docker push XXXX/kali</span><br><span class=\"line\">docker pull XXXX/kali:latest</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"查询docker日志的存储目录\"><a href=\"#查询docker日志的存储目录\" class=\"headerlink\" title=\"查询docker日志的存储目录\"></a>查询docker日志的存储目录</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker inspect container_ID | grep json.log`</span><br><span class=\"line\">docker inspect container_name | grep json.log</span><br></pre></td></tr></table></figure>\n<h3 id=\"清docker日志\"><a href=\"#清docker日志\" class=\"headerlink\" title=\"清docker日志\"></a>清docker日志</h3><p><code>cat /dev/null > /var/log/…log-json.log</code></p>\n<h3 id=\"查询并取消容器挂载位置\"><a href=\"#查询并取消容器挂载位置\" class=\"headerlink\" title=\"查询并取消容器挂载位置\"></a>查询并取消容器挂载位置</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">cat /proc/mounts |grep "docker" |grep "caf8ef20f3c1"</span><br><span class=\"line\">#umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets</span><br><span class=\"line\"># umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li><p>进行安装htop工具<br><code>$:sudo apt-get install htop</code></p>\n<ul>\n<li>安装后使用$:htop命令可以更直观查看CPU使用信息</li>\n</ul>\n</li>\n<li><p>防火墙</p>\n<ul>\n<li><p>查看防火墙状态<br>sudo ufw status</p>\n</li>\n<li><p>开启防火墙<br>sudo ufw enable</p>\n</li>\n<li><p>关闭防火墙<br>sudo ufw disable</p>\n</li>\n<li><p>防火墙没问题可能就是80端口没开,执行:<br>iptables -I INPUT -p tcp –dport 36572 -j ACCEPT</p>\n<ul>\n<li>1、清空iptables所有配置(新系统操作)</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<p>sudo iptables -F<br>sudo iptables -X<br>sudo iptables -Z </p>\n<pre><code>- 2、放行SSH远程22端口及lookback规则: \n</code></pre>\n<p>sudo iptables -A INPUT -i lo -j ACCEPT<br>sudo iptables -A OUTPUT -o lo -j ACCEPT<br>sudo iptables -A INPUT -p tcp –dport 22 -j ACCEPT </p>\n<pre><code>- 3、配置默认动作为拒绝,只允许流出数据: \n</code></pre>\n<p>sudo iptables –policy OUTPUT ACCEPT<br>sudo iptables –policy FORWARD DROP<br>sudo iptables -P INPUT DROP<br> >操作这部之前,请确保放行了ssh或者其他远程端口.</p>\n<pre><code>- 4、配置放行的关联规则包\n</code></pre>\n <figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</span><br><span class=\"line\">sudo iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</span><br></pre></td></tr></table></figure>\n<pre><code>- 5、Ubuntu保存iptables配置与开机启动(root账号下)\n>如果是普通用户,请切换到root\n</code></pre>\n <figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">super@super:~$ su - root</span><br><span class=\"line\">Password: </span><br><span class=\"line\">root@super:~# iptables-save > /etc/iptables-rules # 保存配置</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li><p>5.1、ubuntu配置规则开机自启动(可以普通账号下)</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">super@super:~$ more /etc/rc.local </span><br><span class=\"line\">#请先配置rc.local服务自启动</span><br><span class=\"line\">#!/bin/bash</span><br><span class=\"line\">#rc.local启动</span><br></pre></td></tr></table></figure>\n</li>\n<li><p>iptables配置恢复,默认重启系统iptables配置丢失.</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">iptables-restore < /etc/iptables-rules</span><br><span class=\"line\">exit 0</span><br></pre></td></tr></table></figure></li>\n</ul>\n<h3 id=\"Docker-镜像和容器的导入导出\"><a href=\"#Docker-镜像和容器的导入导出\" class=\"headerlink\" title=\"Docker 镜像和容器的导入导出\"></a>Docker 镜像和容器的导入导出</h3><ul>\n<li>镜像的导出和导入</li>\n<li>镜像的保存</li>\n</ul>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master ~]# docker images</span><br><span class=\"line\">REPOSITORY TAG IMAGE ID CREATED SIZE</span><br><span class=\"line\">nginx latest ae513a47849c 2 months ago 109MB</span><br><span class=\"line\">debian jessie 4eb8376dc2a3 2 months ago 127MB</span><br><span class=\"line\">rabbitmq 3.6.8 8cdcbee37f62 15 months ago 179MB</span><br><span class=\"line\">[root@k8s-master tmp]# docker save ae513a47849c > nginx-save.tar</span><br><span class=\"line\">[root@k8s-master tmp]# ls -lh</span><br><span class=\"line\">total 108M</span><br><span class=\"line\">-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li>第二种写法:<br><code>docker save -o nginx-save.tar ae513a47849c</code></li>\n<li>2.镜像的导入<ul>\n<li>可以将导出的nginx-save.tar包传到需要的docker主机上面,然后执行导入命令.</li>\n</ul>\n</li>\n</ul>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master tmp]# ls -lh</span><br><span class=\"line\">total 108M</span><br><span class=\"line\">-rw-r--r-- 1 root root 108M Jul 4 09:32 nginx-save.tar</span><br><span class=\"line\">[root@k8s-master tmp]# docker load < nginx-save.tar </span><br><span class=\"line\">82b81d779f83: Loading layer [==================================================>] 54.21MB/54.21MB</span><br><span class=\"line\">7ab428981537: Loading layer [==================================================>] 3.584kB/3.584kB</span><br><span class=\"line\">Loaded image ID: sha256:ae513a47849c895a155ddfb868d6ba247f60240ec8495482eca74c4a2c13a881</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li>第三种写法:<br><code>docker load -i nginx-save.tar</code></li>\n</ul>\n<h3 id=\"容器的导出和导入\"><a href=\"#容器的导出和导入\" class=\"headerlink\" title=\"容器的导出和导入\"></a>容器的导出和导入</h3><ul>\n<li><p>1.容器的导出</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">[root@k8s-master tmp]# docker ps</span><br><span class=\"line\">CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES</span><br><span class=\"line\">220aee82cfea tomcat:7 "catalina.sh run" 9 seconds ago Up 7 seconds 8080/tcp tomcat7</span><br><span class=\"line\">docker export -o mysql-`date +%Y%m%d`.tar 220aee82cfea</span><br></pre></td></tr></table></figure></li>\n<li><p>2.容器的导入<br><code>docker import my_ubuntu_v3.tar runoob/ubuntu:v4 </code></p>\n</li>\n<li><p>镜像和容器 导出和导入的区别: </p>\n<ul>\n<li><p>1.镜像导入 是复制的过程</p>\n</li>\n<li><p>2.容器导入 是将当前容器 变成一个新的镜像</p>\n</li>\n<li><p>save 和 export区别:</p>\n<ul>\n<li>1)save 保存镜像所有的信息-包含历史</li>\n<li>2)export 只导出当前的信息</li>\n</ul>\n</li>\n<li><p>docker save images_name: </p>\n<ul>\n<li>将一个镜像导出为文件,再使用docker load命令将文件导入为一个镜像,会保存该镜像的的所有历史记录。比docker export命令导出的文件大,很好理解,因为会保存镜像的所有历史记录。 </li>\n<li>docker export container_id: <ul>\n<li>将一个容器导出为文件,再使用docker import命令将容器导入成为一个新的镜像,但是相比docker save命令,容器文件会丢失所有元数据和历史记录,仅保存容器当时的状态,相当于虚拟机快照。</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><p>普通启动的容器</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run ubuntu:15.10 /bin/echo "Hello world"</span><br><span class=\"line\">Hello world</span><br></pre></td></tr></table></figure></li>\n</ul>\n<blockquote>\n<p>各个参数解析:</p>\n</blockquote>\n<ul>\n<li><p>docker: Docker 的二进制执行文件。</p>\n</li>\n<li><p>run:与前面的 docker 组合来运行一个容器。</p>\n</li>\n<li><p>ubuntu:15.10指定要运行的镜像,Docker首先从本地主机上查找镜像是否存在,如果不存在,Docker 就会从镜像仓库 Docker Hub 下载公共镜像。</p>\n</li>\n<li><p>/bin/echo “Hello world”: 在启动的容器里执行的命令</p>\n</li>\n<li><p>运行交互式的容器<br>我们通过docker的两个参数 -i -t,让docker运行的容器实现”对话”的能力</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -i -t ubuntu:15.10 /bin/bash</span><br><span class=\"line\">root@dc0050c79503:/#</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>各个参数解析:</p>\n</blockquote>\n</li>\n</ul>\n<p>-t:在新容器内指定一个伪终端或终端。</p>\n<p>-i:允许你对容器内的标准输入 (STDIN) 进行交互。</p>\n<p>启动容器(后台模式)<br>使用以下命令创建一个以进程方式运行的容器</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d ubuntu:15.10 /bin/sh -c "while true; do echo hello world; sleep 1; done"</span><br><span class=\"line\">2b1b7a428627c51ab8810d541d759f072b4fc75487eed05812646b8534a2fe63</span><br></pre></td></tr></table></figure>\n<ul>\n<li>首先,我们需要确认容器有在运行,可以通过 docker ps 来查看</li>\n</ul>\n<p><code>runoob@runoob:~$ docker ps</code></p>\n<p>CONTAINER ID:容器ID</p>\n<p>NAMES:自动分配的容器名称</p>\n<p>在容器内使用docker logs命令,查看容器内的标准输出</p>\n<p><code>runoob@runoob:~$ docker logs 2b1b7a428627</code> </p>\n<h3 id=\"构建镜像\"><a href=\"#构建镜像\" class=\"headerlink\" title=\"构建镜像\"></a>构建镜像</h3><p>我们使用命令 docker build , 从零开始来创建一个新的镜像。为此,我们需要创建一个 Dockerfile 文件,其中包含一组指令来告诉 Docker 如何构建我们的镜像。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ cat Dockerfile </span><br><span class=\"line\">FROM centos:6.7</span><br><span class=\"line\">MAINTAINER Fisher "fisher@sudops.com"</span><br><span class=\"line\">RUN /bin/echo 'root:123456' |chpasswd</span><br><span class=\"line\">RUN useradd runoob</span><br><span class=\"line\">RUN /bin/echo 'runoob:123456' |chpasswd</span><br><span class=\"line\">RUN /bin/echo -e "LANG=\\"en_US.UTF-8\\"" >/etc/default/local</span><br><span class=\"line\">EXPOSE 22</span><br><span class=\"line\">EXPOSE 80</span><br><span class=\"line\">CMD /usr/sbin/sshd -D</span><br></pre></td></tr></table></figure>\n<p>每一个指令都会在镜像上创建一个新的层,每一个指令的前缀都必须是大写的。<br>第一条FROM,指定使用哪个镜像源<br>RUN 指令告诉docker 在镜像内执行命令,安装了什么。。。<br>然后,我们使用 Dockerfile 文件,通过 docker build 命令来构建一个镜像。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker build -t runoob/centos:6.7 .</span><br><span class=\"line\">Sending build context to Docker daemon 17.92 kB</span><br><span class=\"line\">Step 1 : FROM centos:6.7</span><br><span class=\"line\"> ---&gt; d95b5ca17cc3</span><br><span class=\"line\">Step 2 : MAINTAINER Fisher "fisher@sudops.com"</span><br><span class=\"line\"> ---&gt; Using cache</span><br><span class=\"line\"> ---&gt; 0c92299c6f03</span><br><span class=\"line\">Step 3 : RUN /bin/echo 'root:123456' |chpasswd</span><br><span class=\"line\"> ---&gt; Using cache</span><br><span class=\"line\"> ---&gt; 0397ce2fbd0a</span><br><span class=\"line\">Step 4 : RUN useradd runoob</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>参数说明:</p>\n</blockquote>\n<p>-t :指定要创建的目标镜像名</p>\n<p>. :Dockerfile 文件所在目录,可以指定Dockerfile 的绝对路径</p>\n<p>使用docker images 查看创建的镜像已经在列表中存在,镜像ID为860c279d2fec</p>\n<p>runoob@runoob:~$ docker images<br>REPOSITORY TAG IMAGE ID CREATED SIZE</p>\n<p>我们可以使用新的镜像来创建容器</p>\n<p>runoob@runoob:~$ docker run -t -i runoob/centos:6.7 /bin/bash<br>[root@41c28d18b5fb /]# id runoob<br>uid=500(runoob) gid=500(runoob) groups=500(runoob)<br>从上面看到新镜像已经包含我们创建的用户runoob</p>\n<p>网络端口映射<br>我们创建了一个 python 应用的容器。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -P training/webapp python app.py</span><br><span class=\"line\">fce072cc88cee71b1cdceb57c2821d054a4a59f67da6b416fceb5593f059fc6d</span><br></pre></td></tr></table></figure>\n<p>另外,我们可以指定容器绑定的网络地址,比如绑定 127.0.0.1。</p>\n<p>我们使用 -P 参数创建一个容器,使用 docker ps 来看到端口5000绑定主机端口32768。</p>\n<p>另外,我们可以指定容器绑定的网络地址,比如绑定127.0.0.1。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -p 127.0.0.1:5001:5000 training/webapp python app.py</span><br><span class=\"line\">95c6ceef88ca3e71eaf303c2833fd6701d8d1b2572b5613b5a932dfdfe8a857c</span><br></pre></td></tr></table></figure>\n<p>这样我们就可以通过访问127.0.0.1:5001来访问容器的5000端口。</p>\n<p>上面的例子中,默认都是绑定 tcp 端口,如果要绑定 UDP 端口,可以在端口后面加上 /udp。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker run -d -p 127.0.0.1:5000:5000/udp training/webapp python app.py</span><br><span class=\"line\">6779686f06f6204579c1d655dd8b2b31e8e809b245a97b2d3a8e35abe9dcd22a</span><br></pre></td></tr></table></figure>\n<p>docker port 命令可以让我们快捷地查看端口的绑定情况。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker port adoring_stonebraker 5000</span><br><span class=\"line\">127.0.0.1:5001</span><br></pre></td></tr></table></figure>\n<h3 id=\"容器连接\"><a href=\"#容器连接\" class=\"headerlink\" title=\"容器连接\"></a>容器连接</h3><p>端口映射并不是唯一把 docker 连接到另一个容器的方法。</p>\n<p>docker有一个连接系统允许将多个容器连接在一起,共享连接信息。</p>\n<p>docker连接会创建一个父子关系,其中父容器可以看到子容器的信息。</p>\n<p>容器命名<br>当我们创建一个容器的时候,docker会自动对它进行命名。另外,我们也可以使用–name标识来命名容器,例如:</p>\n<p>runoob@runoob:~$ docker run -d -P –name runoob training/webapp python app.py<br>43780a6eabaaf14e590b6e849235c75f3012995403f97749775e38436db9a441<br>我们可以使用 docker ps 命令来查看容器名称。</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">runoob@runoob:~$ docker ps -l</span><br><span class=\"line\">CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES</span><br><span class=\"line\">43780a6eabaa training/webapp "python app.py" 3 minutes ago Up 3 minutes 0.0.0.0:32769->5000/tcp runoob</span><br></pre></td></tr></table></figure>\n\n<ul>\n<li>Docker文件目录和容器内部操作</li>\n<li>Docker默认的文件目录位于Linux server的/var/lib/docker 下面。目录结构如下</li>\n</ul>\n<p>|—–containers:用于存储容器信息<br>|—–image:用来存储镜像中间件及本身信息,大小,依赖信息<br>|—–network<br>|—–swarm<br>|—–tmp:docker临时目录<br>|—–trust:docker信任目录<br>|—–volumes:docker卷目录</p>\n<blockquote>\n<p>还可以通过docker指令确认文件位置:<br><code>docker info</code>\n </p>\n</blockquote>\n<h3 id=\"查看某个容器的文件目录\"><a href=\"#查看某个容器的文件目录\" class=\"headerlink\" title=\"查看某个容器的文件目录\"></a>查看某个容器的文件目录</h3><p> docker exec 容器name ls</p>\n<h3 id=\"文件互相拷贝\"><a href=\"#文件互相拷贝\" class=\"headerlink\" title=\"文件互相拷贝\"></a>文件互相拷贝</h3><ul>\n<li>将本地文件拷贝到docker 镜像内<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"> docker cp 本地路径 容器Id或name:容器目录</span><br><span class=\"line\">docker cp /Users/howey/Documents/apache-maven-3.5.2/ containername:/opt</span><br></pre></td></tr></table></figure>\n</li>\n<li>将docker内文件拷贝到本地文件夹内<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker cp 容器Id或name:本地路径 镜像路径</span><br><span class=\"line\">docker cp containername:/Users/howey/Documents/apache-maven-3.5.2 /opt/</span><br></pre></td></tr></table></figure></li>\n</ul>\n<blockquote>\n<p>如何进入容器内部呢:使用docker exec可以进入Docker容器并运行指令 </p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#docker exec 在运行的容器中执行命令</span><br><span class=\"line\">docker exec [OPTIONS] CONTAINER COMMAND [ARG...]</span><br></pre></td></tr></table></figure>\n<p>OPTIONS说明:<br>-d :分离模式: 在后台运行<br>-i :即使没有附加也保持STDIN 打开<br>-t :分配一个伪终端<br>通过 exec 命令对指定的容器执行 bash:<br><code>docker exec -it 容器ID或name bash</code> </p>\n<blockquote>\n<p>-it : 目前的理解浅薄,就是要等在容器内的命令执行完毕才会出来到当前操作; 没有-it的加 就相当于在容器内执行一下命令,不等容器内部是否执行完毕直接出来.<br>案例:在容器内创建sqlserver目录,如下所示,安装sqlserver后实际上已经自动创建了data目录,映射的时候无需再次创建直接使用即可.</p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"># docker exec -it sqlserver bash</span><br><span class=\"line\">mssql@649b4b891718:/$ mkdir /var/opt/mssql/data</span><br><span class=\"line\">mkdir: cannot create directory '/var/opt/mssql/data': File exists</span><br><span class=\"line\">mssql@649b4b891718:/$ ls #查看目录列表</span><br><span class=\"line\">bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var</span><br><span class=\"line\">mssql@649b4b891718:/$ cd /var/opt #转到opt目录</span><br><span class=\"line\">mssql@649b4b891718:/var/opt$ ls #查看opt目录</span><br><span class=\"line\">mssql</span><br><span class=\"line\">mssql@649b4b891718:/var/opt$ cd mssql </span><br><span class=\"line\">mssql@649b4b891718:/var/opt/mssql$ ls</span><br><span class=\"line\">data log secrets</span><br><span class=\"line\">mssql@649b4b891718:/var/opt/mssql$ </span><br></pre></td></tr></table></figure>"},{"title":"Linux系统基础及软件使用","_content":"Linux系统基础及软件使用 知识干货的整理\n\n# Linux\n>除了知识干货的整理,会穿擦很多操作的感悟和总结 \n## 常用命令\n- 更新\n ```\n apt-get update # 更新源 \n apt-get upgrade # 更新所有已安装的包 \n apt-get dist-upgrade # 发行版升级\n ```\n- 清空历史记录 \\\n`vi ~/.bash_history` \n`history -c`\n\n- 系统版本升级 \n`do-release-upgrade` \n>升级系统版本比如20.0升级到22.0 \n>neofetch或类似工具来获取操作系统详细信息\n\n- 查看监听端口 \n`lsof -i -P -n | grep LISTEN `\n\n## 安装\n我自己在笔记本装了win和ubuntu的双系统,win里也有linux的虚拟机,从微软商店直接下载就行了,但是内核更新受限于wsl,其实它就是wsl的一个发布版本。 \n\n另外,如果想用ARM系统的话,可以装在树莓派上,早以前我用树莓派3b装的kali学习网络安全,后来出了4b,性能好了很多,直接装ubuntu22带桌面的系统也可以跑得很流畅。\n\n这里注意了,流畅的前提,选择一个速度更快的sd卡,或者把系统装在高速的U盘或者ssd当中,用sd卡做一个引导就可以了。ubuntu还是比树莓派本身的系统要耗性能。\n\n具体安装过程,还没时间整理,先列一下,学习linux系统的几种安装方式\n- 真机安装 \n 这个是最麻烦的,但是装好以后比较好用。\n- 树莓派\n- vm虚拟机 \n 可以直接在对应系统的官方下载vm的文件,导入即可使用\n- wsl \n 微软商店搜索系统名称直接下载打开就行了\n- 云主机 \n 这里可以在服务器商直接购买便宜一些的云服,选择想使用的linux系统就可以了\n\n## 内核升级\n[linux官网](https://www.kernel.org/) \n[ubuntu官网](https://kernel.ubuntu.com/~kernel-ppa/mainline/)\n\n#### 方案1\n```\n点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号):\n1. linux-image-X.Y.Z-generic-*.deb\n2. linux-modules-X.Y.Z-generic-.deb\n在终端中改变到文件所在的目录,然后执行此命令手动安装内核:\n$ sudo dpkg --install *.deb\n重启系统,使用新内核:\n$ sudo reboot\n检查是否如你所愿:\n$ uname -r\n```\n \n#### 方案2\nhttps://github.com/pimlie/ubuntu-mainline-kernel.sh\n\n```\napt install wget\nwget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh\nchmod +x ubuntu-mainline-kernel.sh\nsudo mv ubuntu-mainline-kernel.sh /usr/local/bin/\nInstall latest version:\n ~ $ sudo ubuntu-mainline-kernel.sh -i\n#指定版本,注意是三个数字,如下\n ubuntu-mainline-kernel.sh -i v5.15.0\n```\n#### 方案3\n#查看当前内核版本\n`uname -r` \\\n#查看软件库中可下载的内核\n`sudo apt list | grep linux-generic*`\n\n#### 操作日志\n*2022.09.03* \n升级了笔记ubuntu系统的内核,从5.15到5.19.使用方案三。启动以后遇到了sign的签名错误,根据提示,关闭了bios里的\nboot secure选项。如果遇到lib版本的错误,要升级系统版本来解决依赖问题。同时,因为带桌面端,可借助软件更新器\n清理不使用的内核包或者是软件。\n至此,系统和内核均升级到了最新版本。\n\n## 工具\n### vim full版本\nubuntu默认安装的是vim tiny版本: \n$sudo apt-get remove vim-common \n$sudo apt-get install vim \n\n### 全局缩放\n>登陆以后设置的缩放比例,重启后不生效,需要修改全局\n```\ncd cd /usr/share/glib-2.0/schemas\ncd /usr/share/glib-2.0/schemas\nvi org.gnome.desktop.interface.gschema.xml\n<key name=\"scaling-factor\" type=\"u\">\n <default>2</default>\n <summary>Window scaling factor</summary>\nsudo glib-compile-schemas /usr/share/glib-2.0/schemas/\n```\n\n### scrapy\n- 安装\n - 官网:https://scrapy.org/\n - `pip install scrapy`\n- 创建项目和虫\n```\nscrapy startproject 项目名\ncd 项目名 \nscrapy genspider 虫名称 \"域名\" \nscrapy.cfg 文件:是虫项目的配置文件\n//创建好spider以后脚本如下\nimport scrapy\nclass xxxSpider(scrapy.Spider):\n name = \"xxx\"\n allowed_domains = [\"www.xxx.xx\"]\n start_urls = ['http://xxxx.cn/']\n\n def parse(self, response):\n for selector in response.xpath(\"//div[@class='article']\"):\n title=selector.xpath('./h2/a/text()').extract_first()\n url=selector.xpath('./h2/a/@href').extract_first()\n #yield {'title': title,'url':url}\n yield scrapy.Request(\n url,\n callback=self.parse_detail,\n meta={\"title\": title}\n ) \n def parse_detail(self, response):\n title = response.meta[\"title\"]\n # 获取详情页的内容、图片\n content = response.xpath(\"//div[@id='link-report-intra']/span/text()\").extract_first()\n yield {'title': title,'content':content} # 对返回的数据进行处理\n#运行\nscrapy runspider spiders/xxx.py\n#排除常规日志\nscrapy runspider --loglevel=ERROR spiders/xx.py \n#输出运行结果到excel\nscrapy crawl xxspider-o data.csv\nscrapy crawl xxspider-o data.json\n```\n\n### pip\n\n```\n#Requires the latest pip\npip install --upgrade pip\n#Current stable release for CPU and GPU\npip install tensorflow\n# r try the preview build (unstable)\npip install tf-nightly\n# 罗列软件包的版本\npip list --outdated\n#升级特定软件包\npip install package_name -U\n```\n\n### pnpm\n\n```\n#如果出现验证失败则临时去掉ssl验证\nnpm config set strict-ssl false\nnpm install -g pnpm\npnpm config set registry https://registry.npm.taobao.org/\n#检查\npnpm config get registry\n#查看ts-node的所有版本\npnpm view ts-node versions\n#等价与npm i nodemon -g\npnpm add nodemon -g\n#npm i\npnpm i\n#查看依赖(全局)\npnpm list [-g]\n#较好用的地方是: npm run dev/test/build\npnpm dev\n#当然习惯npm的也可以用 pnpm run dev\n#win下配置全局变量\npnpm config set store-dir \"D:\\Program Files\\pnpm\\storeDir\" \npnpm config set global-dir \"D:\\Program Files\\pnpm\\globalDir\"\npnpm config set global-bin-dir \"D:\\Program Files\\pnpm\\globalBinDir\"\npnpm config set state-dir \"D:\\Program Files\\pnpm\\state\"\npnpm config set cache-dir \"D:\\Program Files\\pnpm\\cache\"\n```\n\n### TensorFlow2\n- Python 3.6–3.9\n- Ubuntu 16.04 或更高版本\n- docker\n```\n docker pull tensorflow/tensorflow:latest # Download latest stable image\n docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter # Start Jupyter server \n```\n- 教程学习 \n - [tensor官方,for js](https://www.tensorflow.org/js/tutorials)\n - [tensor官方中文站](https://tensorflow.google.cn/)\n\n### nodejs\n>NPM的全称是Node Package Manager,是一个NodeJS包管理和分发工具,已经成为了非官方的发布Node模块(包)的标准\nNode.js发布于2009年5月,由Ryan Dahl开发,是一个基于 Chrome V8 引擎的 JavaScript 运行环境,是一个让 JavaScript 运行在服务端的开发平台\n\n```\nsudo apt install nodejs-legacy\nsudo apt install npm\n#菜鸟\nsudo apt-get install nodejs\nsudo apt-get install npm\nnode -v\n#设置为淘宝镜像\nnpm config set registry https://registry.npm.taobao.org/\nyarn config set registry https://registry.npm.taobao.org/\n#查看当前镜像\nnpm get registry \nyarn config get registry\n#淘宝镜像到期报错\nnpm config set strict-ssl false\n```\n>更换完以后清除缓存yarn cache clean,并删除项目下的yarn.lock文件\n\n### SMB\n### SSHD\n敲入sshd,系统会提示安装的软件,也可输入以下命令直接安装 \n`apt install openssh-server`\n\n### nginx\n>带https,多站点反向代理\n\n### net7 net8\n(https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository)\n```\nmkdir net7\ncd net7/\nsudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0\nsudo apt-get update && sudo apt-get install -y aspnetcore-runtime-7.0\n//如果提示找不到库,则先添加 Microsoft 包存储库再重新运行\nwget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb\nsudo dpkg -i packages-microsoft-prod.deb\nrm packages-microsoft-prod.deb\ndotnet --info\n```\n\n### v2\n> linux系统下服务端\n- 可以直接安装工具(推荐,更省心) \n` bash <(curl -s -L https://git.io/v2[Delete]ray.sh)`\n- 或者使用docker,自己配置\n- 客户端一般在win系统,用git开源的core,带了一个N字头的UI\n#### 常见问题\n - 经常出现无法连接网站,这个首先要在服务端查看日志,看看客户端是否连接上,如果连接上,可能是服务端的配置问题,如果直接用的工具,更新工具版本就行了,如果是自己的配置,查一下最近官方的消息推荐的配置更改。\n - 如果服务端没有客户端连接的消息,那么检查客户端的输出框报错提示进行解决 \n - 记一次问题解决 \n - 报错 \n `failed to listen on address: 127.0.0.1:10808 > listen tcp 127.0.0.1:10808: bind: An attempt was made to access a socket in a way forbidden by its access permissions.`\n - 解决 \n - 运行`netsh winsock reset`后,重启系统。(这些一般就是百度一下报错信息,就能找到解决方案了,win系统就容易出现这种奇奇怪怪的报错)\n - 接着如下`connection refused by remote machine`的报错,进入服务器查询监听端口,发现端口不在了,重新配置以后,重启服务,再回看客户端,已成功连接\n\n## 系统相关\n### dpkg\n```\ndpkg -i microsoft-edge-stable \ndpkg -P --purge microsoft-edge-stable \n\n```\n\n### 查看cpu型号\n`cat /proc/cpuinfo | grep 'model name' |uniq`\n\n### 查看cpu温度\n```\napt install install lm_sensors\nsensors\n```\n\n### 磁盘测试\n```\nhdparm -Tt /dev/sda\n/dev/sda:\nTiming cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec\nTiming buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec\n可以看到,2秒钟读取了6676MB的缓存,约合3340.18 MB/sec;\n```\n### 换源\n>务必要更换对应的codename \nwindows wsl ubuntu的codename为jammy(22),facal为20.0 \n可用`lsb_release -a`查询 \nhttps://mirrors.ustc.edu.cn/repogen/\n\n```\nvim /etc/apt/sources.list\ndeb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\n\n#kali官方源\ndeb http://http.kali.org/kali kali-rolling main non-free contrib\n\n#中科大的源\ndeb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib\ndeb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib\ndeb http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free\ndeb-src http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free\ndeb http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free\ndeb-src http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free\n```\n#### 常见问题\n- respi执行update报错`The repository 'http://http.re4son-kernel.com/re4son kali-pi InRelease' is not signed` \n更新key签名`apt-key adv --keyserver keys.gnupg.net --recv-keys 11764EE8AC24832F`可解决\n","source":"_posts/linux.md","raw":"---\ntitle: Linux系统基础及软件使用\ntags:\n - \"Linux\"\n - \"Ubuntu\"\ncategories:\n - \"工具教程\"\n---\nLinux系统基础及软件使用 知识干货的整理\n\n# Linux\n>除了知识干货的整理,会穿擦很多操作的感悟和总结 \n## 常用命令\n- 更新\n ```\n apt-get update # 更新源 \n apt-get upgrade # 更新所有已安装的包 \n apt-get dist-upgrade # 发行版升级\n ```\n- 清空历史记录 \\\n`vi ~/.bash_history` \n`history -c`\n\n- 系统版本升级 \n`do-release-upgrade` \n>升级系统版本比如20.0升级到22.0 \n>neofetch或类似工具来获取操作系统详细信息\n\n- 查看监听端口 \n`lsof -i -P -n | grep LISTEN `\n\n## 安装\n我自己在笔记本装了win和ubuntu的双系统,win里也有linux的虚拟机,从微软商店直接下载就行了,但是内核更新受限于wsl,其实它就是wsl的一个发布版本。 \n\n另外,如果想用ARM系统的话,可以装在树莓派上,早以前我用树莓派3b装的kali学习网络安全,后来出了4b,性能好了很多,直接装ubuntu22带桌面的系统也可以跑得很流畅。\n\n这里注意了,流畅的前提,选择一个速度更快的sd卡,或者把系统装在高速的U盘或者ssd当中,用sd卡做一个引导就可以了。ubuntu还是比树莓派本身的系统要耗性能。\n\n具体安装过程,还没时间整理,先列一下,学习linux系统的几种安装方式\n- 真机安装 \n 这个是最麻烦的,但是装好以后比较好用。\n- 树莓派\n- vm虚拟机 \n 可以直接在对应系统的官方下载vm的文件,导入即可使用\n- wsl \n 微软商店搜索系统名称直接下载打开就行了\n- 云主机 \n 这里可以在服务器商直接购买便宜一些的云服,选择想使用的linux系统就可以了\n\n## 内核升级\n[linux官网](https://www.kernel.org/) \n[ubuntu官网](https://kernel.ubuntu.com/~kernel-ppa/mainline/)\n\n#### 方案1\n```\n点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号):\n1. linux-image-X.Y.Z-generic-*.deb\n2. linux-modules-X.Y.Z-generic-.deb\n在终端中改变到文件所在的目录,然后执行此命令手动安装内核:\n$ sudo dpkg --install *.deb\n重启系统,使用新内核:\n$ sudo reboot\n检查是否如你所愿:\n$ uname -r\n```\n \n#### 方案2\nhttps://github.com/pimlie/ubuntu-mainline-kernel.sh\n\n```\napt install wget\nwget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh\nchmod +x ubuntu-mainline-kernel.sh\nsudo mv ubuntu-mainline-kernel.sh /usr/local/bin/\nInstall latest version:\n ~ $ sudo ubuntu-mainline-kernel.sh -i\n#指定版本,注意是三个数字,如下\n ubuntu-mainline-kernel.sh -i v5.15.0\n```\n#### 方案3\n#查看当前内核版本\n`uname -r` \\\n#查看软件库中可下载的内核\n`sudo apt list | grep linux-generic*`\n\n#### 操作日志\n*2022.09.03* \n升级了笔记ubuntu系统的内核,从5.15到5.19.使用方案三。启动以后遇到了sign的签名错误,根据提示,关闭了bios里的\nboot secure选项。如果遇到lib版本的错误,要升级系统版本来解决依赖问题。同时,因为带桌面端,可借助软件更新器\n清理不使用的内核包或者是软件。\n至此,系统和内核均升级到了最新版本。\n\n## 工具\n### vim full版本\nubuntu默认安装的是vim tiny版本: \n$sudo apt-get remove vim-common \n$sudo apt-get install vim \n\n### 全局缩放\n>登陆以后设置的缩放比例,重启后不生效,需要修改全局\n```\ncd cd /usr/share/glib-2.0/schemas\ncd /usr/share/glib-2.0/schemas\nvi org.gnome.desktop.interface.gschema.xml\n<key name=\"scaling-factor\" type=\"u\">\n <default>2</default>\n <summary>Window scaling factor</summary>\nsudo glib-compile-schemas /usr/share/glib-2.0/schemas/\n```\n\n### scrapy\n- 安装\n - 官网:https://scrapy.org/\n - `pip install scrapy`\n- 创建项目和虫\n```\nscrapy startproject 项目名\ncd 项目名 \nscrapy genspider 虫名称 \"域名\" \nscrapy.cfg 文件:是虫项目的配置文件\n//创建好spider以后脚本如下\nimport scrapy\nclass xxxSpider(scrapy.Spider):\n name = \"xxx\"\n allowed_domains = [\"www.xxx.xx\"]\n start_urls = ['http://xxxx.cn/']\n\n def parse(self, response):\n for selector in response.xpath(\"//div[@class='article']\"):\n title=selector.xpath('./h2/a/text()').extract_first()\n url=selector.xpath('./h2/a/@href').extract_first()\n #yield {'title': title,'url':url}\n yield scrapy.Request(\n url,\n callback=self.parse_detail,\n meta={\"title\": title}\n ) \n def parse_detail(self, response):\n title = response.meta[\"title\"]\n # 获取详情页的内容、图片\n content = response.xpath(\"//div[@id='link-report-intra']/span/text()\").extract_first()\n yield {'title': title,'content':content} # 对返回的数据进行处理\n#运行\nscrapy runspider spiders/xxx.py\n#排除常规日志\nscrapy runspider --loglevel=ERROR spiders/xx.py \n#输出运行结果到excel\nscrapy crawl xxspider-o data.csv\nscrapy crawl xxspider-o data.json\n```\n\n### pip\n\n```\n#Requires the latest pip\npip install --upgrade pip\n#Current stable release for CPU and GPU\npip install tensorflow\n# r try the preview build (unstable)\npip install tf-nightly\n# 罗列软件包的版本\npip list --outdated\n#升级特定软件包\npip install package_name -U\n```\n\n### pnpm\n\n```\n#如果出现验证失败则临时去掉ssl验证\nnpm config set strict-ssl false\nnpm install -g pnpm\npnpm config set registry https://registry.npm.taobao.org/\n#检查\npnpm config get registry\n#查看ts-node的所有版本\npnpm view ts-node versions\n#等价与npm i nodemon -g\npnpm add nodemon -g\n#npm i\npnpm i\n#查看依赖(全局)\npnpm list [-g]\n#较好用的地方是: npm run dev/test/build\npnpm dev\n#当然习惯npm的也可以用 pnpm run dev\n#win下配置全局变量\npnpm config set store-dir \"D:\\Program Files\\pnpm\\storeDir\" \npnpm config set global-dir \"D:\\Program Files\\pnpm\\globalDir\"\npnpm config set global-bin-dir \"D:\\Program Files\\pnpm\\globalBinDir\"\npnpm config set state-dir \"D:\\Program Files\\pnpm\\state\"\npnpm config set cache-dir \"D:\\Program Files\\pnpm\\cache\"\n```\n\n### TensorFlow2\n- Python 3.6–3.9\n- Ubuntu 16.04 或更高版本\n- docker\n```\n docker pull tensorflow/tensorflow:latest # Download latest stable image\n docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter # Start Jupyter server \n```\n- 教程学习 \n - [tensor官方,for js](https://www.tensorflow.org/js/tutorials)\n - [tensor官方中文站](https://tensorflow.google.cn/)\n\n### nodejs\n>NPM的全称是Node Package Manager,是一个NodeJS包管理和分发工具,已经成为了非官方的发布Node模块(包)的标准\nNode.js发布于2009年5月,由Ryan Dahl开发,是一个基于 Chrome V8 引擎的 JavaScript 运行环境,是一个让 JavaScript 运行在服务端的开发平台\n\n```\nsudo apt install nodejs-legacy\nsudo apt install npm\n#菜鸟\nsudo apt-get install nodejs\nsudo apt-get install npm\nnode -v\n#设置为淘宝镜像\nnpm config set registry https://registry.npm.taobao.org/\nyarn config set registry https://registry.npm.taobao.org/\n#查看当前镜像\nnpm get registry \nyarn config get registry\n#淘宝镜像到期报错\nnpm config set strict-ssl false\n```\n>更换完以后清除缓存yarn cache clean,并删除项目下的yarn.lock文件\n\n### SMB\n### SSHD\n敲入sshd,系统会提示安装的软件,也可输入以下命令直接安装 \n`apt install openssh-server`\n\n### nginx\n>带https,多站点反向代理\n\n### net7 net8\n(https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository)\n```\nmkdir net7\ncd net7/\nsudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0\nsudo apt-get update && sudo apt-get install -y aspnetcore-runtime-7.0\n//如果提示找不到库,则先添加 Microsoft 包存储库再重新运行\nwget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb\nsudo dpkg -i packages-microsoft-prod.deb\nrm packages-microsoft-prod.deb\ndotnet --info\n```\n\n### v2\n> linux系统下服务端\n- 可以直接安装工具(推荐,更省心) \n` bash <(curl -s -L https://git.io/v2[Delete]ray.sh)`\n- 或者使用docker,自己配置\n- 客户端一般在win系统,用git开源的core,带了一个N字头的UI\n#### 常见问题\n - 经常出现无法连接网站,这个首先要在服务端查看日志,看看客户端是否连接上,如果连接上,可能是服务端的配置问题,如果直接用的工具,更新工具版本就行了,如果是自己的配置,查一下最近官方的消息推荐的配置更改。\n - 如果服务端没有客户端连接的消息,那么检查客户端的输出框报错提示进行解决 \n - 记一次问题解决 \n - 报错 \n `failed to listen on address: 127.0.0.1:10808 > listen tcp 127.0.0.1:10808: bind: An attempt was made to access a socket in a way forbidden by its access permissions.`\n - 解决 \n - 运行`netsh winsock reset`后,重启系统。(这些一般就是百度一下报错信息,就能找到解决方案了,win系统就容易出现这种奇奇怪怪的报错)\n - 接着如下`connection refused by remote machine`的报错,进入服务器查询监听端口,发现端口不在了,重新配置以后,重启服务,再回看客户端,已成功连接\n\n## 系统相关\n### dpkg\n```\ndpkg -i microsoft-edge-stable \ndpkg -P --purge microsoft-edge-stable \n\n```\n\n### 查看cpu型号\n`cat /proc/cpuinfo | grep 'model name' |uniq`\n\n### 查看cpu温度\n```\napt install install lm_sensors\nsensors\n```\n\n### 磁盘测试\n```\nhdparm -Tt /dev/sda\n/dev/sda:\nTiming cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec\nTiming buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec\n可以看到,2秒钟读取了6676MB的缓存,约合3340.18 MB/sec;\n```\n### 换源\n>务必要更换对应的codename \nwindows wsl ubuntu的codename为jammy(22),facal为20.0 \n可用`lsb_release -a`查询 \nhttps://mirrors.ustc.edu.cn/repogen/\n\n```\nvim /etc/apt/sources.list\ndeb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\n\n#kali官方源\ndeb http://http.kali.org/kali kali-rolling main non-free contrib\n\n#中科大的源\ndeb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib\ndeb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib\ndeb http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free\ndeb-src http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free\ndeb http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free\ndeb-src http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free\n```\n#### 常见问题\n- respi执行update报错`The repository 'http://http.re4son-kernel.com/re4son kali-pi InRelease' is not signed` \n更新key签名`apt-key adv --keyserver keys.gnupg.net --recv-keys 11764EE8AC24832F`可解决\n","slug":"linux","published":1,"date":"2024-02-13T00:36:14.290Z","updated":"2024-02-13T00:37:42.000Z","_id":"clsjmub7a0005loczgrp91e1u","comments":1,"layout":"post","photos":[],"content":"<p>Linux系统基础及软件使用 知识干货的整理</p>\n<h1 id=\"Linux\"><a href=\"#Linux\" class=\"headerlink\" title=\"Linux\"></a>Linux</h1><blockquote>\n<p>除了知识干货的整理,会穿擦很多操作的感悟和总结 </p>\n</blockquote>\n<h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><ul>\n<li><p>更新</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt-get update # 更新源 </span><br><span class=\"line\">apt-get upgrade # 更新所有已安装的包 </span><br><span class=\"line\">apt-get dist-upgrade # 发行版升级</span><br></pre></td></tr></table></figure></div></li>\n<li><p>清空历史记录 <br><code>vi ~/.bash_history</code><br><code>history -c</code></p>\n</li>\n<li><p>系统版本升级<br><code>do-release-upgrade</code> </p>\n<blockquote>\n<p>升级系统版本比如20.0升级到22.0<br>neofetch或类似工具来获取操作系统详细信息</p>\n</blockquote>\n</li>\n<li><p>查看监听端口<br><code>lsof -i -P -n | grep LISTEN </code></p>\n</li>\n</ul>\n<h2 id=\"安装\"><a href=\"#安装\" class=\"headerlink\" title=\"安装\"></a>安装</h2><p>我自己在笔记本装了win和ubuntu的双系统,win里也有linux的虚拟机,从微软商店直接下载就行了,但是内核更新受限于wsl,其实它就是wsl的一个发布版本。 </p>\n<p>另外,如果想用ARM系统的话,可以装在树莓派上,早以前我用树莓派3b装的kali学习网络安全,后来出了4b,性能好了很多,直接装ubuntu22带桌面的系统也可以跑得很流畅。</p>\n<p>这里注意了,流畅的前提,选择一个速度更快的sd卡,或者把系统装在高速的U盘或者ssd当中,用sd卡做一个引导就可以了。ubuntu还是比树莓派本身的系统要耗性能。</p>\n<p>具体安装过程,还没时间整理,先列一下,学习linux系统的几种安装方式</p>\n<ul>\n<li>真机安装<br>这个是最麻烦的,但是装好以后比较好用。</li>\n<li>树莓派</li>\n<li>vm虚拟机<br>可以直接在对应系统的官方下载vm的文件,导入即可使用</li>\n<li>wsl<br>微软商店搜索系统名称直接下载打开就行了</li>\n<li>云主机<br>这里可以在服务器商直接购买便宜一些的云服,选择想使用的linux系统就可以了</li>\n</ul>\n<h2 id=\"内核升级\"><a href=\"#内核升级\" class=\"headerlink\" title=\"内核升级\"></a>内核升级</h2><p><a class=\"link\" href=\"https://www.kernel.org/\" >linux官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br><a class=\"link\" href=\"https://kernel.ubuntu.com/~kernel-ppa/mainline/\" >ubuntu官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<h4 id=\"方案1\"><a href=\"#方案1\" class=\"headerlink\" title=\"方案1\"></a>方案1</h4><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号):</span><br><span class=\"line\">1. linux-image-X.Y.Z-generic-*.deb</span><br><span class=\"line\">2. linux-modules-X.Y.Z-generic-.deb</span><br><span class=\"line\">在终端中改变到文件所在的目录,然后执行此命令手动安装内核:</span><br><span class=\"line\">$ sudo dpkg --install *.deb</span><br><span class=\"line\">重启系统,使用新内核:</span><br><span class=\"line\">$ sudo reboot</span><br><span class=\"line\">检查是否如你所愿:</span><br><span class=\"line\">$ uname -r</span><br></pre></td></tr></table></figure></div>\n<h4 id=\"方案2\"><a href=\"#方案2\" class=\"headerlink\" title=\"方案2\"></a>方案2</h4><p><a class=\"link\" href=\"https://github.com/pimlie/ubuntu-mainline-kernel.sh\" >https://github.com/pimlie/ubuntu-mainline-kernel.sh <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt install wget</span><br><span class=\"line\">wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh</span><br><span class=\"line\">chmod +x ubuntu-mainline-kernel.sh</span><br><span class=\"line\">sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/</span><br><span class=\"line\">Install latest version:</span><br><span class=\"line\"> ~ $ sudo ubuntu-mainline-kernel.sh -i</span><br><span class=\"line\">#指定版本,注意是三个数字,如下</span><br><span class=\"line\"> ubuntu-mainline-kernel.sh -i v5.15.0</span><br></pre></td></tr></table></figure></div>\n<h4 id=\"方案3\"><a href=\"#方案3\" class=\"headerlink\" title=\"方案3\"></a>方案3</h4><p>#查看当前内核版本<br><code>uname -r</code> <br>#查看软件库中可下载的内核<br><code>sudo apt list | grep linux-generic*</code></p>\n<h4 id=\"操作日志\"><a href=\"#操作日志\" class=\"headerlink\" title=\"操作日志\"></a>操作日志</h4><p><em>2022.09.03</em><br>升级了笔记ubuntu系统的内核,从5.15到5.19.使用方案三。启动以后遇到了sign的签名错误,根据提示,关闭了bios里的<br>boot secure选项。如果遇到lib版本的错误,要升级系统版本来解决依赖问题。同时,因为带桌面端,可借助软件更新器<br>清理不使用的内核包或者是软件。<br>至此,系统和内核均升级到了最新版本。</p>\n<h2 id=\"工具\"><a href=\"#工具\" class=\"headerlink\" title=\"工具\"></a>工具</h2><h3 id=\"vim-full版本\"><a href=\"#vim-full版本\" class=\"headerlink\" title=\"vim full版本\"></a>vim full版本</h3><p>ubuntu默认安装的是vim tiny版本:<br>$sudo apt-get remove vim-common<br>$sudo apt-get install vim </p>\n<h3 id=\"全局缩放\"><a href=\"#全局缩放\" class=\"headerlink\" title=\"全局缩放\"></a>全局缩放</h3><blockquote>\n<p>登陆以后设置的缩放比例,重启后不生效,需要修改全局</p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">cd cd /usr/share/glib-2.0/schemas</span><br><span class=\"line\">cd /usr/share/glib-2.0/schemas</span><br><span class=\"line\">vi org.gnome.desktop.interface.gschema.xml</span><br><span class=\"line\"><key name="scaling-factor" type="u"></span><br><span class=\"line\"> <default>2</default></span><br><span class=\"line\"> <summary>Window scaling factor</summary></span><br><span class=\"line\">sudo glib-compile-schemas /usr/share/glib-2.0/schemas/</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"scrapy\"><a href=\"#scrapy\" class=\"headerlink\" title=\"scrapy\"></a>scrapy</h3><ul>\n<li>安装<ul>\n<li>官网:<a class=\"link\" href=\"https://scrapy.org/\" >https://scrapy.org/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><code>pip install scrapy</code></li>\n</ul>\n</li>\n<li>创建项目和虫<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br><span class=\"line\">33</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">scrapy startproject 项目名</span><br><span class=\"line\">cd 项目名 </span><br><span class=\"line\">scrapy genspider 虫名称 "域名" </span><br><span class=\"line\">scrapy.cfg 文件:是虫项目的配置文件</span><br><span class=\"line\">//创建好spider以后脚本如下</span><br><span class=\"line\">import scrapy</span><br><span class=\"line\">class xxxSpider(scrapy.Spider):</span><br><span class=\"line\"> name = "xxx"</span><br><span class=\"line\"> allowed_domains = ["www.xxx.xx"]</span><br><span class=\"line\"> start_urls = ['http://xxxx.cn/']</span><br><span class=\"line\"></span><br><span class=\"line\"> def parse(self, response):</span><br><span class=\"line\"> for selector in response.xpath("//div[@class='article']"):</span><br><span class=\"line\"> title=selector.xpath('./h2/a/text()').extract_first()</span><br><span class=\"line\"> url=selector.xpath('./h2/a/@href').extract_first()</span><br><span class=\"line\"> #yield {'title': title,'url':url}</span><br><span class=\"line\"> yield scrapy.Request(</span><br><span class=\"line\"> url,</span><br><span class=\"line\"> callback=self.parse_detail,</span><br><span class=\"line\"> meta={"title": title}</span><br><span class=\"line\"> ) </span><br><span class=\"line\"> def parse_detail(self, response):</span><br><span class=\"line\"> title = response.meta["title"]</span><br><span class=\"line\"> # 获取详情页的内容、图片</span><br><span class=\"line\"> content = response.xpath("//div[@id='link-report-intra']/span/text()").extract_first()</span><br><span class=\"line\"> yield {'title': title,'content':content} # 对返回的数据进行处理</span><br><span class=\"line\">#运行</span><br><span class=\"line\">scrapy runspider spiders/xxx.py</span><br><span class=\"line\">#排除常规日志</span><br><span class=\"line\">scrapy runspider --loglevel=ERROR spiders/xx.py </span><br><span class=\"line\">#输出运行结果到excel</span><br><span class=\"line\">scrapy crawl xxspider-o data.csv</span><br><span class=\"line\">scrapy crawl xxspider-o data.json</span><br></pre></td></tr></table></figure></div></li>\n</ul>\n<h3 id=\"pip\"><a href=\"#pip\" class=\"headerlink\" title=\"pip\"></a>pip</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#Requires the latest pip</span><br><span class=\"line\">pip install --upgrade pip</span><br><span class=\"line\">#Current stable release for CPU and GPU</span><br><span class=\"line\">pip install tensorflow</span><br><span class=\"line\"># r try the preview build (unstable)</span><br><span class=\"line\">pip install tf-nightly</span><br><span class=\"line\"># 罗列软件包的版本</span><br><span class=\"line\">pip list --outdated</span><br><span class=\"line\">#升级特定软件包</span><br><span class=\"line\">pip install package_name -U</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"pnpm\"><a href=\"#pnpm\" class=\"headerlink\" title=\"pnpm\"></a>pnpm</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#如果出现验证失败则临时去掉ssl验证</span><br><span class=\"line\">npm config set strict-ssl false</span><br><span class=\"line\">npm install -g pnpm</span><br><span class=\"line\">pnpm config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">#检查</span><br><span class=\"line\">pnpm config get registry</span><br><span class=\"line\">#查看ts-node的所有版本</span><br><span class=\"line\">pnpm view ts-node versions</span><br><span class=\"line\">#等价与npm i nodemon -g</span><br><span class=\"line\">pnpm add nodemon -g</span><br><span class=\"line\">#npm i</span><br><span class=\"line\">pnpm i</span><br><span class=\"line\">#查看依赖(全局)</span><br><span class=\"line\">pnpm list [-g]</span><br><span class=\"line\">#较好用的地方是: npm run dev/test/build</span><br><span class=\"line\">pnpm dev</span><br><span class=\"line\">#当然习惯npm的也可以用 pnpm run dev</span><br><span class=\"line\">#win下配置全局变量</span><br><span class=\"line\">pnpm config set store-dir "D:\\Program Files\\pnpm\\storeDir" </span><br><span class=\"line\">pnpm config set global-dir "D:\\Program Files\\pnpm\\globalDir"</span><br><span class=\"line\">pnpm config set global-bin-dir "D:\\Program Files\\pnpm\\globalBinDir"</span><br><span class=\"line\">pnpm config set state-dir "D:\\Program Files\\pnpm\\state"</span><br><span class=\"line\">pnpm config set cache-dir "D:\\Program Files\\pnpm\\cache"</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"TensorFlow2\"><a href=\"#TensorFlow2\" class=\"headerlink\" title=\"TensorFlow2\"></a>TensorFlow2</h3><ul>\n<li>Python 3.6–3.9</li>\n<li>Ubuntu 16.04 或更高版本</li>\n<li>docker<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull tensorflow/tensorflow:latest # Download latest stable image</span><br><span class=\"line\">docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter # Start Jupyter server </span><br></pre></td></tr></table></figure></div></li>\n<li>教程学习 <ul>\n<li><a class=\"link\" href=\"https://www.tensorflow.org/js/tutorials\" >tensor官方,for js <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://tensorflow.google.cn/\" >tensor官方中文站 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n</li>\n</ul>\n<h3 id=\"nodejs\"><a href=\"#nodejs\" class=\"headerlink\" title=\"nodejs\"></a>nodejs</h3><blockquote>\n<p>NPM的全称是Node Package Manager,是一个NodeJS包管理和分发工具,已经成为了非官方的发布Node模块(包)的标准<br>Node.js发布于2009年5月,由Ryan Dahl开发,是一个基于 Chrome V8 引擎的 JavaScript 运行环境,是一个让 JavaScript 运行在服务端的开发平台</p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo apt install nodejs-legacy</span><br><span class=\"line\">sudo apt install npm</span><br><span class=\"line\">#菜鸟</span><br><span class=\"line\">sudo apt-get install nodejs</span><br><span class=\"line\">sudo apt-get install npm</span><br><span class=\"line\">node -v</span><br><span class=\"line\">#设置为淘宝镜像</span><br><span class=\"line\">npm config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">yarn config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">#查看当前镜像</span><br><span class=\"line\">npm get registry </span><br><span class=\"line\">yarn config get registry</span><br><span class=\"line\">#淘宝镜像到期报错</span><br><span class=\"line\">npm config set strict-ssl false</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>更换完以后清除缓存yarn cache clean,并删除项目下的yarn.lock文件</p>\n</blockquote>\n<h3 id=\"SMB\"><a href=\"#SMB\" class=\"headerlink\" title=\"SMB\"></a>SMB</h3><h3 id=\"SSHD\"><a href=\"#SSHD\" class=\"headerlink\" title=\"SSHD\"></a>SSHD</h3><p>敲入sshd,系统会提示安装的软件,也可输入以下命令直接安装<br><code>apt install openssh-server</code></p>\n<h3 id=\"nginx\"><a href=\"#nginx\" class=\"headerlink\" title=\"nginx\"></a>nginx</h3><blockquote>\n<p>带https,多站点反向代理</p>\n</blockquote>\n<h3 id=\"net7-net8\"><a href=\"#net7-net8\" class=\"headerlink\" title=\"net7 net8\"></a>net7 net8</h3><p>(<a class=\"link\" href=\"https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository\" >https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a>)</p>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mkdir net7</span><br><span class=\"line\">cd net7/</span><br><span class=\"line\">sudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0</span><br><span class=\"line\">sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-7.0</span><br><span class=\"line\">//如果提示找不到库,则先添加 Microsoft 包存储库再重新运行</span><br><span class=\"line\">wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb</span><br><span class=\"line\">sudo dpkg -i packages-microsoft-prod.deb</span><br><span class=\"line\">rm packages-microsoft-prod.deb</span><br><span class=\"line\">dotnet --info</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"v2\"><a href=\"#v2\" class=\"headerlink\" title=\"v2\"></a>v2</h3><blockquote>\n<p>linux系统下服务端</p>\n</blockquote>\n<ul>\n<li>可以直接安装工具(推荐,更省心)<br><code> bash <(curl -s -L https://git.io/v2[Delete]ray.sh)</code></li>\n<li>或者使用docker,自己配置</li>\n<li>客户端一般在win系统,用git开源的core,带了一个N字头的UI</li>\n</ul>\n<h4 id=\"常见问题\"><a href=\"#常见问题\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h4><ul>\n<li>经常出现无法连接网站,这个首先要在服务端查看日志,看看客户端是否连接上,如果连接上,可能是服务端的配置问题,如果直接用的工具,更新工具版本就行了,如果是自己的配置,查一下最近官方的消息推荐的配置更改。</li>\n<li>如果服务端没有客户端连接的消息,那么检查客户端的输出框报错提示进行解决 </li>\n<li>记一次问题解决 <ul>\n<li>报错<br> <code>failed to listen on address: 127.0.0.1:10808 > listen tcp 127.0.0.1:10808: bind: An attempt was made to access a socket in a way forbidden by its access permissions.</code></li>\n<li>解决 <ul>\n<li>运行<code>netsh winsock reset</code>后,重启系统。(这些一般就是百度一下报错信息,就能找到解决方案了,win系统就容易出现这种奇奇怪怪的报错)</li>\n<li>接着如下<code>connection refused by remote machine</code>的报错,进入服务器查询监听端口,发现端口不在了,重新配置以后,重启服务,再回看客户端,已成功连接</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"系统相关\"><a href=\"#系统相关\" class=\"headerlink\" title=\"系统相关\"></a>系统相关</h2><h3 id=\"dpkg\"><a href=\"#dpkg\" class=\"headerlink\" title=\"dpkg\"></a>dpkg</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">dpkg -i microsoft-edge-stable </span><br><span class=\"line\">dpkg -P --purge microsoft-edge-stable </span><br><span class=\"line\"></span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"查看cpu型号\"><a href=\"#查看cpu型号\" class=\"headerlink\" title=\"查看cpu型号\"></a>查看cpu型号</h3><p><code>cat /proc/cpuinfo | grep 'model name' |uniq</code></p>\n<h3 id=\"查看cpu温度\"><a href=\"#查看cpu温度\" class=\"headerlink\" title=\"查看cpu温度\"></a>查看cpu温度</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt install install lm_sensors</span><br><span class=\"line\">sensors</span><br></pre></td></tr></table></figure></div>\n\n<h3 id=\"磁盘测试\"><a href=\"#磁盘测试\" class=\"headerlink\" title=\"磁盘测试\"></a>磁盘测试</h3><div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">hdparm -Tt /dev/sda</span><br><span class=\"line\">/dev/sda:</span><br><span class=\"line\">Timing cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec</span><br><span class=\"line\">Timing buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec</span><br><span class=\"line\">可以看到,2秒钟读取了6676MB的缓存,约合3340.18 MB/sec;</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"换源\"><a href=\"#换源\" class=\"headerlink\" title=\"换源\"></a>换源</h3><blockquote>\n<p>务必要更换对应的codename<br>windows wsl ubuntu的codename为jammy(22),facal为20.0<br>可用<code>lsb_release -a</code>查询<br><a class=\"link\" href=\"https://mirrors.ustc.edu.cn/repogen/\" >https://mirrors.ustc.edu.cn/repogen/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">vim /etc/apt/sources.list</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse</span><br><span class=\"line\"></span><br><span class=\"line\">#kali官方源</span><br><span class=\"line\">deb http://http.kali.org/kali kali-rolling main non-free contrib</span><br><span class=\"line\"></span><br><span class=\"line\">#中科大的源</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free</span><br></pre></td></tr></table></figure></div>\n<h4 id=\"常见问题-1\"><a href=\"#常见问题-1\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h4><ul>\n<li>respi执行update报错<code>The repository 'http://http.re4son-kernel.com/re4son kali-pi InRelease' is not signed</code><br>更新key签名<code>apt-key adv --keyserver keys.gnupg.net --recv-keys 11764EE8AC24832F</code>可解决</li>\n</ul>\n","excerpt":"","more":"<p>Linux系统基础及软件使用 知识干货的整理</p>\n<h1 id=\"Linux\"><a href=\"#Linux\" class=\"headerlink\" title=\"Linux\"></a>Linux</h1><blockquote>\n<p>除了知识干货的整理,会穿擦很多操作的感悟和总结 </p>\n</blockquote>\n<h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><ul>\n<li><p>更新</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt-get update # 更新源 </span><br><span class=\"line\">apt-get upgrade # 更新所有已安装的包 </span><br><span class=\"line\">apt-get dist-upgrade # 发行版升级</span><br></pre></td></tr></table></figure></li>\n<li><p>清空历史记录 <br><code>vi ~/.bash_history</code><br><code>history -c</code></p>\n</li>\n<li><p>系统版本升级<br><code>do-release-upgrade</code> </p>\n<blockquote>\n<p>升级系统版本比如20.0升级到22.0<br>neofetch或类似工具来获取操作系统详细信息</p>\n</blockquote>\n</li>\n<li><p>查看监听端口<br><code>lsof -i -P -n | grep LISTEN </code></p>\n</li>\n</ul>\n<h2 id=\"安装\"><a href=\"#安装\" class=\"headerlink\" title=\"安装\"></a>安装</h2><p>我自己在笔记本装了win和ubuntu的双系统,win里也有linux的虚拟机,从微软商店直接下载就行了,但是内核更新受限于wsl,其实它就是wsl的一个发布版本。 </p>\n<p>另外,如果想用ARM系统的话,可以装在树莓派上,早以前我用树莓派3b装的kali学习网络安全,后来出了4b,性能好了很多,直接装ubuntu22带桌面的系统也可以跑得很流畅。</p>\n<p>这里注意了,流畅的前提,选择一个速度更快的sd卡,或者把系统装在高速的U盘或者ssd当中,用sd卡做一个引导就可以了。ubuntu还是比树莓派本身的系统要耗性能。</p>\n<p>具体安装过程,还没时间整理,先列一下,学习linux系统的几种安装方式</p>\n<ul>\n<li>真机安装<br>这个是最麻烦的,但是装好以后比较好用。</li>\n<li>树莓派</li>\n<li>vm虚拟机<br>可以直接在对应系统的官方下载vm的文件,导入即可使用</li>\n<li>wsl<br>微软商店搜索系统名称直接下载打开就行了</li>\n<li>云主机<br>这里可以在服务器商直接购买便宜一些的云服,选择想使用的linux系统就可以了</li>\n</ul>\n<h2 id=\"内核升级\"><a href=\"#内核升级\" class=\"headerlink\" title=\"内核升级\"></a>内核升级</h2><p><a class=\"link\" href=\"https://www.kernel.org/\" >linux官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br><a class=\"link\" href=\"https://kernel.ubuntu.com/~kernel-ppa/mainline/\" >ubuntu官网 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<h4 id=\"方案1\"><a href=\"#方案1\" class=\"headerlink\" title=\"方案1\"></a>方案1</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号):</span><br><span class=\"line\">1. linux-image-X.Y.Z-generic-*.deb</span><br><span class=\"line\">2. linux-modules-X.Y.Z-generic-.deb</span><br><span class=\"line\">在终端中改变到文件所在的目录,然后执行此命令手动安装内核:</span><br><span class=\"line\">$ sudo dpkg --install *.deb</span><br><span class=\"line\">重启系统,使用新内核:</span><br><span class=\"line\">$ sudo reboot</span><br><span class=\"line\">检查是否如你所愿:</span><br><span class=\"line\">$ uname -r</span><br></pre></td></tr></table></figure>\n<h4 id=\"方案2\"><a href=\"#方案2\" class=\"headerlink\" title=\"方案2\"></a>方案2</h4><p><a class=\"link\" href=\"https://github.com/pimlie/ubuntu-mainline-kernel.sh\" >https://github.com/pimlie/ubuntu-mainline-kernel.sh <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt install wget</span><br><span class=\"line\">wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh</span><br><span class=\"line\">chmod +x ubuntu-mainline-kernel.sh</span><br><span class=\"line\">sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/</span><br><span class=\"line\">Install latest version:</span><br><span class=\"line\"> ~ $ sudo ubuntu-mainline-kernel.sh -i</span><br><span class=\"line\">#指定版本,注意是三个数字,如下</span><br><span class=\"line\"> ubuntu-mainline-kernel.sh -i v5.15.0</span><br></pre></td></tr></table></figure>\n<h4 id=\"方案3\"><a href=\"#方案3\" class=\"headerlink\" title=\"方案3\"></a>方案3</h4><p>#查看当前内核版本<br><code>uname -r</code> <br>#查看软件库中可下载的内核<br><code>sudo apt list | grep linux-generic*</code></p>\n<h4 id=\"操作日志\"><a href=\"#操作日志\" class=\"headerlink\" title=\"操作日志\"></a>操作日志</h4><p><em>2022.09.03</em><br>升级了笔记ubuntu系统的内核,从5.15到5.19.使用方案三。启动以后遇到了sign的签名错误,根据提示,关闭了bios里的<br>boot secure选项。如果遇到lib版本的错误,要升级系统版本来解决依赖问题。同时,因为带桌面端,可借助软件更新器<br>清理不使用的内核包或者是软件。<br>至此,系统和内核均升级到了最新版本。</p>\n<h2 id=\"工具\"><a href=\"#工具\" class=\"headerlink\" title=\"工具\"></a>工具</h2><h3 id=\"vim-full版本\"><a href=\"#vim-full版本\" class=\"headerlink\" title=\"vim full版本\"></a>vim full版本</h3><p>ubuntu默认安装的是vim tiny版本:<br>$sudo apt-get remove vim-common<br>$sudo apt-get install vim </p>\n<h3 id=\"全局缩放\"><a href=\"#全局缩放\" class=\"headerlink\" title=\"全局缩放\"></a>全局缩放</h3><blockquote>\n<p>登陆以后设置的缩放比例,重启后不生效,需要修改全局</p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">cd cd /usr/share/glib-2.0/schemas</span><br><span class=\"line\">cd /usr/share/glib-2.0/schemas</span><br><span class=\"line\">vi org.gnome.desktop.interface.gschema.xml</span><br><span class=\"line\"><key name="scaling-factor" type="u"></span><br><span class=\"line\"> <default>2</default></span><br><span class=\"line\"> <summary>Window scaling factor</summary></span><br><span class=\"line\">sudo glib-compile-schemas /usr/share/glib-2.0/schemas/</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"scrapy\"><a href=\"#scrapy\" class=\"headerlink\" title=\"scrapy\"></a>scrapy</h3><ul>\n<li>安装<ul>\n<li>官网:<a class=\"link\" href=\"https://scrapy.org/\" >https://scrapy.org/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><code>pip install scrapy</code></li>\n</ul>\n</li>\n<li>创建项目和虫<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br><span class=\"line\">33</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">scrapy startproject 项目名</span><br><span class=\"line\">cd 项目名 </span><br><span class=\"line\">scrapy genspider 虫名称 "域名" </span><br><span class=\"line\">scrapy.cfg 文件:是虫项目的配置文件</span><br><span class=\"line\">//创建好spider以后脚本如下</span><br><span class=\"line\">import scrapy</span><br><span class=\"line\">class xxxSpider(scrapy.Spider):</span><br><span class=\"line\"> name = "xxx"</span><br><span class=\"line\"> allowed_domains = ["www.xxx.xx"]</span><br><span class=\"line\"> start_urls = ['http://xxxx.cn/']</span><br><span class=\"line\"></span><br><span class=\"line\"> def parse(self, response):</span><br><span class=\"line\"> for selector in response.xpath("//div[@class='article']"):</span><br><span class=\"line\"> title=selector.xpath('./h2/a/text()').extract_first()</span><br><span class=\"line\"> url=selector.xpath('./h2/a/@href').extract_first()</span><br><span class=\"line\"> #yield {'title': title,'url':url}</span><br><span class=\"line\"> yield scrapy.Request(</span><br><span class=\"line\"> url,</span><br><span class=\"line\"> callback=self.parse_detail,</span><br><span class=\"line\"> meta={"title": title}</span><br><span class=\"line\"> ) </span><br><span class=\"line\"> def parse_detail(self, response):</span><br><span class=\"line\"> title = response.meta["title"]</span><br><span class=\"line\"> # 获取详情页的内容、图片</span><br><span class=\"line\"> content = response.xpath("//div[@id='link-report-intra']/span/text()").extract_first()</span><br><span class=\"line\"> yield {'title': title,'content':content} # 对返回的数据进行处理</span><br><span class=\"line\">#运行</span><br><span class=\"line\">scrapy runspider spiders/xxx.py</span><br><span class=\"line\">#排除常规日志</span><br><span class=\"line\">scrapy runspider --loglevel=ERROR spiders/xx.py </span><br><span class=\"line\">#输出运行结果到excel</span><br><span class=\"line\">scrapy crawl xxspider-o data.csv</span><br><span class=\"line\">scrapy crawl xxspider-o data.json</span><br></pre></td></tr></table></figure></li>\n</ul>\n<h3 id=\"pip\"><a href=\"#pip\" class=\"headerlink\" title=\"pip\"></a>pip</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#Requires the latest pip</span><br><span class=\"line\">pip install --upgrade pip</span><br><span class=\"line\">#Current stable release for CPU and GPU</span><br><span class=\"line\">pip install tensorflow</span><br><span class=\"line\"># r try the preview build (unstable)</span><br><span class=\"line\">pip install tf-nightly</span><br><span class=\"line\"># 罗列软件包的版本</span><br><span class=\"line\">pip list --outdated</span><br><span class=\"line\">#升级特定软件包</span><br><span class=\"line\">pip install package_name -U</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"pnpm\"><a href=\"#pnpm\" class=\"headerlink\" title=\"pnpm\"></a>pnpm</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">#如果出现验证失败则临时去掉ssl验证</span><br><span class=\"line\">npm config set strict-ssl false</span><br><span class=\"line\">npm install -g pnpm</span><br><span class=\"line\">pnpm config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">#检查</span><br><span class=\"line\">pnpm config get registry</span><br><span class=\"line\">#查看ts-node的所有版本</span><br><span class=\"line\">pnpm view ts-node versions</span><br><span class=\"line\">#等价与npm i nodemon -g</span><br><span class=\"line\">pnpm add nodemon -g</span><br><span class=\"line\">#npm i</span><br><span class=\"line\">pnpm i</span><br><span class=\"line\">#查看依赖(全局)</span><br><span class=\"line\">pnpm list [-g]</span><br><span class=\"line\">#较好用的地方是: npm run dev/test/build</span><br><span class=\"line\">pnpm dev</span><br><span class=\"line\">#当然习惯npm的也可以用 pnpm run dev</span><br><span class=\"line\">#win下配置全局变量</span><br><span class=\"line\">pnpm config set store-dir "D:\\Program Files\\pnpm\\storeDir" </span><br><span class=\"line\">pnpm config set global-dir "D:\\Program Files\\pnpm\\globalDir"</span><br><span class=\"line\">pnpm config set global-bin-dir "D:\\Program Files\\pnpm\\globalBinDir"</span><br><span class=\"line\">pnpm config set state-dir "D:\\Program Files\\pnpm\\state"</span><br><span class=\"line\">pnpm config set cache-dir "D:\\Program Files\\pnpm\\cache"</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"TensorFlow2\"><a href=\"#TensorFlow2\" class=\"headerlink\" title=\"TensorFlow2\"></a>TensorFlow2</h3><ul>\n<li>Python 3.6–3.9</li>\n<li>Ubuntu 16.04 或更高版本</li>\n<li>docker<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">docker pull tensorflow/tensorflow:latest # Download latest stable image</span><br><span class=\"line\">docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter # Start Jupyter server </span><br></pre></td></tr></table></figure></li>\n<li>教程学习 <ul>\n<li><a class=\"link\" href=\"https://www.tensorflow.org/js/tutorials\" >tensor官方,for js <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://tensorflow.google.cn/\" >tensor官方中文站 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n</li>\n</ul>\n<h3 id=\"nodejs\"><a href=\"#nodejs\" class=\"headerlink\" title=\"nodejs\"></a>nodejs</h3><blockquote>\n<p>NPM的全称是Node Package Manager,是一个NodeJS包管理和分发工具,已经成为了非官方的发布Node模块(包)的标准<br>Node.js发布于2009年5月,由Ryan Dahl开发,是一个基于 Chrome V8 引擎的 JavaScript 运行环境,是一个让 JavaScript 运行在服务端的开发平台</p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo apt install nodejs-legacy</span><br><span class=\"line\">sudo apt install npm</span><br><span class=\"line\">#菜鸟</span><br><span class=\"line\">sudo apt-get install nodejs</span><br><span class=\"line\">sudo apt-get install npm</span><br><span class=\"line\">node -v</span><br><span class=\"line\">#设置为淘宝镜像</span><br><span class=\"line\">npm config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">yarn config set registry https://registry.npm.taobao.org/</span><br><span class=\"line\">#查看当前镜像</span><br><span class=\"line\">npm get registry </span><br><span class=\"line\">yarn config get registry</span><br><span class=\"line\">#淘宝镜像到期报错</span><br><span class=\"line\">npm config set strict-ssl false</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>更换完以后清除缓存yarn cache clean,并删除项目下的yarn.lock文件</p>\n</blockquote>\n<h3 id=\"SMB\"><a href=\"#SMB\" class=\"headerlink\" title=\"SMB\"></a>SMB</h3><h3 id=\"SSHD\"><a href=\"#SSHD\" class=\"headerlink\" title=\"SSHD\"></a>SSHD</h3><p>敲入sshd,系统会提示安装的软件,也可输入以下命令直接安装<br><code>apt install openssh-server</code></p>\n<h3 id=\"nginx\"><a href=\"#nginx\" class=\"headerlink\" title=\"nginx\"></a>nginx</h3><blockquote>\n<p>带https,多站点反向代理</p>\n</blockquote>\n<h3 id=\"net7-net8\"><a href=\"#net7-net8\" class=\"headerlink\" title=\"net7 net8\"></a>net7 net8</h3><p>(<a class=\"link\" href=\"https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository\" >https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu-2004#add-the-microsoft-package-repository <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a>)</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mkdir net7</span><br><span class=\"line\">cd net7/</span><br><span class=\"line\">sudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0</span><br><span class=\"line\">sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-7.0</span><br><span class=\"line\">//如果提示找不到库,则先添加 Microsoft 包存储库再重新运行</span><br><span class=\"line\">wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb</span><br><span class=\"line\">sudo dpkg -i packages-microsoft-prod.deb</span><br><span class=\"line\">rm packages-microsoft-prod.deb</span><br><span class=\"line\">dotnet --info</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"v2\"><a href=\"#v2\" class=\"headerlink\" title=\"v2\"></a>v2</h3><blockquote>\n<p>linux系统下服务端</p>\n</blockquote>\n<ul>\n<li>可以直接安装工具(推荐,更省心)<br><code> bash <(curl -s -L https://git.io/v2[Delete]ray.sh)</code></li>\n<li>或者使用docker,自己配置</li>\n<li>客户端一般在win系统,用git开源的core,带了一个N字头的UI</li>\n</ul>\n<h4 id=\"常见问题\"><a href=\"#常见问题\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h4><ul>\n<li>经常出现无法连接网站,这个首先要在服务端查看日志,看看客户端是否连接上,如果连接上,可能是服务端的配置问题,如果直接用的工具,更新工具版本就行了,如果是自己的配置,查一下最近官方的消息推荐的配置更改。</li>\n<li>如果服务端没有客户端连接的消息,那么检查客户端的输出框报错提示进行解决 </li>\n<li>记一次问题解决 <ul>\n<li>报错<br> <code>failed to listen on address: 127.0.0.1:10808 > listen tcp 127.0.0.1:10808: bind: An attempt was made to access a socket in a way forbidden by its access permissions.</code></li>\n<li>解决 <ul>\n<li>运行<code>netsh winsock reset</code>后,重启系统。(这些一般就是百度一下报错信息,就能找到解决方案了,win系统就容易出现这种奇奇怪怪的报错)</li>\n<li>接着如下<code>connection refused by remote machine</code>的报错,进入服务器查询监听端口,发现端口不在了,重新配置以后,重启服务,再回看客户端,已成功连接</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"系统相关\"><a href=\"#系统相关\" class=\"headerlink\" title=\"系统相关\"></a>系统相关</h2><h3 id=\"dpkg\"><a href=\"#dpkg\" class=\"headerlink\" title=\"dpkg\"></a>dpkg</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">dpkg -i microsoft-edge-stable </span><br><span class=\"line\">dpkg -P --purge microsoft-edge-stable </span><br><span class=\"line\"></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"查看cpu型号\"><a href=\"#查看cpu型号\" class=\"headerlink\" title=\"查看cpu型号\"></a>查看cpu型号</h3><p><code>cat /proc/cpuinfo | grep 'model name' |uniq</code></p>\n<h3 id=\"查看cpu温度\"><a href=\"#查看cpu温度\" class=\"headerlink\" title=\"查看cpu温度\"></a>查看cpu温度</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">apt install install lm_sensors</span><br><span class=\"line\">sensors</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"磁盘测试\"><a href=\"#磁盘测试\" class=\"headerlink\" title=\"磁盘测试\"></a>磁盘测试</h3><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">hdparm -Tt /dev/sda</span><br><span class=\"line\">/dev/sda:</span><br><span class=\"line\">Timing cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec</span><br><span class=\"line\">Timing buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec</span><br><span class=\"line\">可以看到,2秒钟读取了6676MB的缓存,约合3340.18 MB/sec;</span><br></pre></td></tr></table></figure>\n<h3 id=\"换源\"><a href=\"#换源\" class=\"headerlink\" title=\"换源\"></a>换源</h3><blockquote>\n<p>务必要更换对应的codename<br>windows wsl ubuntu的codename为jammy(22),facal为20.0<br>可用<code>lsb_release -a</code>查询<br><a class=\"link\" href=\"https://mirrors.ustc.edu.cn/repogen/\" >https://mirrors.ustc.edu.cn/repogen/ <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">vim /etc/apt/sources.list</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse</span><br><span class=\"line\">deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse</span><br><span class=\"line\">deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse</span><br><span class=\"line\"></span><br><span class=\"line\">#kali官方源</span><br><span class=\"line\">deb http://http.kali.org/kali kali-rolling main non-free contrib</span><br><span class=\"line\"></span><br><span class=\"line\">#中科大的源</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free</span><br><span class=\"line\">deb http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free</span><br><span class=\"line\">deb-src http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free</span><br></pre></td></tr></table></figure>\n<h4 id=\"常见问题-1\"><a href=\"#常见问题-1\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h4><ul>\n<li>respi执行update报错<code>The repository 'http://http.re4son-kernel.com/re4son kali-pi InRelease' is not signed</code><br>更新key签名<code>apt-key adv --keyserver keys.gnupg.net --recv-keys 11764EE8AC24832F</code>可解决</li>\n</ul>\n"},{"title":"windows系统基础及软件使用","_content":"windows系统基础及软件使用 知识干货的整理\n\n# windows\n## 常用命令\n### 端口查询 \n`netstat -ano |findstr \"端口号\"`\n### 查询关闭进程\n- `tasklist /fi \"imagename eq nginx.exe\"`\n- `taskkill /F /PID 31904`\n- `taskkill /F /IM nginx.exe`\n\n## 工具\n### powershell\n>遇到执行策略的问题,自带程序终端的时候会报出\"系统禁止脚本运行的错误\"\n```\n管理员身份运行 window.powershell\nget-ExecutionPolicy,显示Restricted\net-ExecutionPolicy -Scope CurrentUser\n输入参数:RemoteSigned\n```\n### Ubuntu子系统\n>手动安装\n建好文件夹,在目录打开cmd\n- `Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_2004.2020.424.0_x64.appx -OutFile Ubuntu20.04.appx -UseBasicParsing`\n- 然后执行\n```\nRename-Item .\\Ubuntu20.04.appx Ubuntu.zip\nExpand-Archive .\\Ubuntu.zip -Verbose\ncd .\\Ubuntu\\\n.\\ubuntu2004.exe\n```\n>指定wsl默认系统为ubuntu\n```\nwsl --set-default Ubuntu-20.04\nbash //运行\n```\n\n### NGINX\n- `start nginx`\n- `nginx.exe -s reload`\n\n### HEIC图片浏览\n>win10不能直接预览苹果手机的图片格式,所以... \n- [HEIF Image Extensions](https://apps.microsoft.com/store/detail/heif-image-extensions/9PMMSR1CGPWG?hl=en-us&gl=us) \n 这个扩展不太好用,安装以后对图片还是解析不出来\n- Real HEIC File Viewer \n 不错,直接微软商店安装,免费\n还试过一些别的软件,各种问题,感觉还是微软商店的软件靠谱些\n### v2部署\n服务端windows版本的文件拷贝到服务器,从客户端导出服务器的config配置,覆盖到服务端,然后通过cmd执行v2--.exe run\n\n## 常见问题\n### 时间无法同步\n>windows11\n设置》时间和日期》相关链接》附加时钟》选择标签Internet时间》点击按钮“更改时间设置”》服务器地址修改为: \n```\n//填写后,点击立即更新,链接成功的即可用\n// 阿里云\nntp1.aliyun.com\nntp2.aliyun.com\nntp3.aliyun.com\nntp4.aliyun.com\nntp5.aliyun.com\nntp6.aliyun.com\nntp7.aliyun.com\n\n// 腾讯云\ntime1.cloud.tencent.com \ntime2.cloud.tencent.com \ntime3.cloud.tencent.com\ntime4.cloud.tencent.com\ntime5.cloud.tencent.com\n```\n","source":"_posts/widows.md","raw":"---\ntitle: windows系统基础及软件使用\ntags:\n - \"windows\"\n - \"windows11\"\ncategories:\n - \"工具教程\"\n---\nwindows系统基础及软件使用 知识干货的整理\n\n# windows\n## 常用命令\n### 端口查询 \n`netstat -ano |findstr \"端口号\"`\n### 查询关闭进程\n- `tasklist /fi \"imagename eq nginx.exe\"`\n- `taskkill /F /PID 31904`\n- `taskkill /F /IM nginx.exe`\n\n## 工具\n### powershell\n>遇到执行策略的问题,自带程序终端的时候会报出\"系统禁止脚本运行的错误\"\n```\n管理员身份运行 window.powershell\nget-ExecutionPolicy,显示Restricted\net-ExecutionPolicy -Scope CurrentUser\n输入参数:RemoteSigned\n```\n### Ubuntu子系统\n>手动安装\n建好文件夹,在目录打开cmd\n- `Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_2004.2020.424.0_x64.appx -OutFile Ubuntu20.04.appx -UseBasicParsing`\n- 然后执行\n```\nRename-Item .\\Ubuntu20.04.appx Ubuntu.zip\nExpand-Archive .\\Ubuntu.zip -Verbose\ncd .\\Ubuntu\\\n.\\ubuntu2004.exe\n```\n>指定wsl默认系统为ubuntu\n```\nwsl --set-default Ubuntu-20.04\nbash //运行\n```\n\n### NGINX\n- `start nginx`\n- `nginx.exe -s reload`\n\n### HEIC图片浏览\n>win10不能直接预览苹果手机的图片格式,所以... \n- [HEIF Image Extensions](https://apps.microsoft.com/store/detail/heif-image-extensions/9PMMSR1CGPWG?hl=en-us&gl=us) \n 这个扩展不太好用,安装以后对图片还是解析不出来\n- Real HEIC File Viewer \n 不错,直接微软商店安装,免费\n还试过一些别的软件,各种问题,感觉还是微软商店的软件靠谱些\n### v2部署\n服务端windows版本的文件拷贝到服务器,从客户端导出服务器的config配置,覆盖到服务端,然后通过cmd执行v2--.exe run\n\n## 常见问题\n### 时间无法同步\n>windows11\n设置》时间和日期》相关链接》附加时钟》选择标签Internet时间》点击按钮“更改时间设置”》服务器地址修改为: \n```\n//填写后,点击立即更新,链接成功的即可用\n// 阿里云\nntp1.aliyun.com\nntp2.aliyun.com\nntp3.aliyun.com\nntp4.aliyun.com\nntp5.aliyun.com\nntp6.aliyun.com\nntp7.aliyun.com\n\n// 腾讯云\ntime1.cloud.tencent.com \ntime2.cloud.tencent.com \ntime3.cloud.tencent.com\ntime4.cloud.tencent.com\ntime5.cloud.tencent.com\n```\n","slug":"widows","published":1,"date":"2024-02-13T00:39:41.080Z","updated":"2024-02-13T00:40:12.000Z","_id":"clsjmyqrl0000e8czah6h6xt8","comments":1,"layout":"post","photos":[],"content":"<p>windows系统基础及软件使用 知识干货的整理</p>\n<h1 id=\"windows\"><a href=\"#windows\" class=\"headerlink\" title=\"windows\"></a>windows</h1><h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><h3 id=\"端口查询\"><a href=\"#端口查询\" class=\"headerlink\" title=\"端口查询\"></a>端口查询</h3><p><code>netstat -ano |findstr "端口号"</code></p>\n<h3 id=\"查询关闭进程\"><a href=\"#查询关闭进程\" class=\"headerlink\" title=\"查询关闭进程\"></a>查询关闭进程</h3><ul>\n<li><code>tasklist /fi "imagename eq nginx.exe"</code></li>\n<li><code>taskkill /F /PID 31904</code></li>\n<li><code>taskkill /F /IM nginx.exe</code></li>\n</ul>\n<h2 id=\"工具\"><a href=\"#工具\" class=\"headerlink\" title=\"工具\"></a>工具</h2><h3 id=\"powershell\"><a href=\"#powershell\" class=\"headerlink\" title=\"powershell\"></a>powershell</h3><blockquote>\n<p>遇到执行策略的问题,自带程序终端的时候会报出”系统禁止脚本运行的错误”</p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">管理员身份运行 window.powershell</span><br><span class=\"line\">get-ExecutionPolicy,显示Restricted</span><br><span class=\"line\">et-ExecutionPolicy -Scope CurrentUser</span><br><span class=\"line\">输入参数:RemoteSigned</span><br></pre></td></tr></table></figure></div>\n<h3 id=\"Ubuntu子系统\"><a href=\"#Ubuntu子系统\" class=\"headerlink\" title=\"Ubuntu子系统\"></a>Ubuntu子系统</h3><blockquote>\n<p>手动安装<br>建好文件夹,在目录打开cmd</p>\n</blockquote>\n<ul>\n<li><code>Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_2004.2020.424.0_x64.appx -OutFile Ubuntu20.04.appx -UseBasicParsing</code></li>\n<li>然后执行<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Rename-Item .\\Ubuntu20.04.appx Ubuntu.zip</span><br><span class=\"line\">Expand-Archive .\\Ubuntu.zip -Verbose</span><br><span class=\"line\">cd .\\Ubuntu\\</span><br><span class=\"line\">.\\ubuntu2004.exe</span><br></pre></td></tr></table></figure></div>\n<blockquote>\n<p>指定wsl默认系统为ubuntu</p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">wsl --set-default Ubuntu-20.04</span><br><span class=\"line\">bash //运行</span><br></pre></td></tr></table></figure></div></li>\n</ul>\n<h3 id=\"NGINX\"><a href=\"#NGINX\" class=\"headerlink\" title=\"NGINX\"></a>NGINX</h3><ul>\n<li><code>start nginx</code></li>\n<li><code>nginx.exe -s reload</code></li>\n</ul>\n<h3 id=\"HEIC图片浏览\"><a href=\"#HEIC图片浏览\" class=\"headerlink\" title=\"HEIC图片浏览\"></a>HEIC图片浏览</h3><blockquote>\n<p>win10不能直接预览苹果手机的图片格式,所以… </p>\n</blockquote>\n<ul>\n<li><a class=\"link\" href=\"https://apps.microsoft.com/store/detail/heif-image-extensions/9PMMSR1CGPWG?hl=en-us&gl=us\" >HEIF Image Extensions <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br>这个扩展不太好用,安装以后对图片还是解析不出来</li>\n<li>Real HEIC File Viewer<br>不错,直接微软商店安装,免费<br>还试过一些别的软件,各种问题,感觉还是微软商店的软件靠谱些</li>\n</ul>\n<h3 id=\"v2部署\"><a href=\"#v2部署\" class=\"headerlink\" title=\"v2部署\"></a>v2部署</h3><p>服务端windows版本的文件拷贝到服务器,从客户端导出服务器的config配置,覆盖到服务端,然后通过cmd执行v2–.exe run</p>\n<h2 id=\"常见问题\"><a href=\"#常见问题\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h2><h3 id=\"时间无法同步\"><a href=\"#时间无法同步\" class=\"headerlink\" title=\"时间无法同步\"></a>时间无法同步</h3><blockquote>\n<p>windows11<br>设置》时间和日期》相关链接》附加时钟》选择标签Internet时间》点击按钮“更改时间设置”》服务器地址修改为: </p>\n</blockquote>\n<div class=\"highlight-container\" data-rel=\"Plaintext\"><figure class=\"iseeu highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//填写后,点击立即更新,链接成功的即可用</span><br><span class=\"line\">// 阿里云</span><br><span class=\"line\">ntp1.aliyun.com</span><br><span class=\"line\">ntp2.aliyun.com</span><br><span class=\"line\">ntp3.aliyun.com</span><br><span class=\"line\">ntp4.aliyun.com</span><br><span class=\"line\">ntp5.aliyun.com</span><br><span class=\"line\">ntp6.aliyun.com</span><br><span class=\"line\">ntp7.aliyun.com</span><br><span class=\"line\"></span><br><span class=\"line\">// 腾讯云</span><br><span class=\"line\">time1.cloud.tencent.com </span><br><span class=\"line\">time2.cloud.tencent.com </span><br><span class=\"line\">time3.cloud.tencent.com</span><br><span class=\"line\">time4.cloud.tencent.com</span><br><span class=\"line\">time5.cloud.tencent.com</span><br></pre></td></tr></table></figure></div>\n","excerpt":"","more":"<p>windows系统基础及软件使用 知识干货的整理</p>\n<h1 id=\"windows\"><a href=\"#windows\" class=\"headerlink\" title=\"windows\"></a>windows</h1><h2 id=\"常用命令\"><a href=\"#常用命令\" class=\"headerlink\" title=\"常用命令\"></a>常用命令</h2><h3 id=\"端口查询\"><a href=\"#端口查询\" class=\"headerlink\" title=\"端口查询\"></a>端口查询</h3><p><code>netstat -ano |findstr "端口号"</code></p>\n<h3 id=\"查询关闭进程\"><a href=\"#查询关闭进程\" class=\"headerlink\" title=\"查询关闭进程\"></a>查询关闭进程</h3><ul>\n<li><code>tasklist /fi "imagename eq nginx.exe"</code></li>\n<li><code>taskkill /F /PID 31904</code></li>\n<li><code>taskkill /F /IM nginx.exe</code></li>\n</ul>\n<h2 id=\"工具\"><a href=\"#工具\" class=\"headerlink\" title=\"工具\"></a>工具</h2><h3 id=\"powershell\"><a href=\"#powershell\" class=\"headerlink\" title=\"powershell\"></a>powershell</h3><blockquote>\n<p>遇到执行策略的问题,自带程序终端的时候会报出”系统禁止脚本运行的错误”</p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">管理员身份运行 window.powershell</span><br><span class=\"line\">get-ExecutionPolicy,显示Restricted</span><br><span class=\"line\">et-ExecutionPolicy -Scope CurrentUser</span><br><span class=\"line\">输入参数:RemoteSigned</span><br></pre></td></tr></table></figure>\n<h3 id=\"Ubuntu子系统\"><a href=\"#Ubuntu子系统\" class=\"headerlink\" title=\"Ubuntu子系统\"></a>Ubuntu子系统</h3><blockquote>\n<p>手动安装<br>建好文件夹,在目录打开cmd</p>\n</blockquote>\n<ul>\n<li><code>Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_2004.2020.424.0_x64.appx -OutFile Ubuntu20.04.appx -UseBasicParsing</code></li>\n<li>然后执行<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Rename-Item .\\Ubuntu20.04.appx Ubuntu.zip</span><br><span class=\"line\">Expand-Archive .\\Ubuntu.zip -Verbose</span><br><span class=\"line\">cd .\\Ubuntu\\</span><br><span class=\"line\">.\\ubuntu2004.exe</span><br></pre></td></tr></table></figure>\n<blockquote>\n<p>指定wsl默认系统为ubuntu</p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">wsl --set-default Ubuntu-20.04</span><br><span class=\"line\">bash //运行</span><br></pre></td></tr></table></figure></li>\n</ul>\n<h3 id=\"NGINX\"><a href=\"#NGINX\" class=\"headerlink\" title=\"NGINX\"></a>NGINX</h3><ul>\n<li><code>start nginx</code></li>\n<li><code>nginx.exe -s reload</code></li>\n</ul>\n<h3 id=\"HEIC图片浏览\"><a href=\"#HEIC图片浏览\" class=\"headerlink\" title=\"HEIC图片浏览\"></a>HEIC图片浏览</h3><blockquote>\n<p>win10不能直接预览苹果手机的图片格式,所以… </p>\n</blockquote>\n<ul>\n<li><a class=\"link\" href=\"https://apps.microsoft.com/store/detail/heif-image-extensions/9PMMSR1CGPWG?hl=en-us&gl=us\" >HEIF Image Extensions <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a><br>这个扩展不太好用,安装以后对图片还是解析不出来</li>\n<li>Real HEIC File Viewer<br>不错,直接微软商店安装,免费<br>还试过一些别的软件,各种问题,感觉还是微软商店的软件靠谱些</li>\n</ul>\n<h3 id=\"v2部署\"><a href=\"#v2部署\" class=\"headerlink\" title=\"v2部署\"></a>v2部署</h3><p>服务端windows版本的文件拷贝到服务器,从客户端导出服务器的config配置,覆盖到服务端,然后通过cmd执行v2–.exe run</p>\n<h2 id=\"常见问题\"><a href=\"#常见问题\" class=\"headerlink\" title=\"常见问题\"></a>常见问题</h2><h3 id=\"时间无法同步\"><a href=\"#时间无法同步\" class=\"headerlink\" title=\"时间无法同步\"></a>时间无法同步</h3><blockquote>\n<p>windows11<br>设置》时间和日期》相关链接》附加时钟》选择标签Internet时间》点击按钮“更改时间设置”》服务器地址修改为: </p>\n</blockquote>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">//填写后,点击立即更新,链接成功的即可用</span><br><span class=\"line\">// 阿里云</span><br><span class=\"line\">ntp1.aliyun.com</span><br><span class=\"line\">ntp2.aliyun.com</span><br><span class=\"line\">ntp3.aliyun.com</span><br><span class=\"line\">ntp4.aliyun.com</span><br><span class=\"line\">ntp5.aliyun.com</span><br><span class=\"line\">ntp6.aliyun.com</span><br><span class=\"line\">ntp7.aliyun.com</span><br><span class=\"line\"></span><br><span class=\"line\">// 腾讯云</span><br><span class=\"line\">time1.cloud.tencent.com </span><br><span class=\"line\">time2.cloud.tencent.com </span><br><span class=\"line\">time3.cloud.tencent.com</span><br><span class=\"line\">time4.cloud.tencent.com</span><br><span class=\"line\">time5.cloud.tencent.com</span><br></pre></td></tr></table></figure>\n"},{"title":".NET9发布了,了解一下更新了什么?","_content":"\n>来关注一下2024刚发现的.net9预览版有哪些好玩的新内容\n## 版本信息\n版本号信息如下:\n- Full version\n- 9.0.100-preview.1.24101.2\n- Visual Studio support\n- Visual Studio 2022 (v17.10 Preview 1)\n- 官方下载地址:[Download .NET 9.0 ](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)\n## 升级步骤\n- 安装官方的sdk和runtime两个包\n- 升级本地的visual studio,我自己vs的版本是2022,17.8.7,要连续更新,只能升级到17.9.0\n- 所以还得重新下载10的安装工具,下载地址:[visualstudio17.10.0](https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview)\n- <img src=\"/images/cutimg1.png\" width = \"500\" height = \"200\"/>\n- 修改项目的global.json如下\n``` json\n{\n \"sdk\": {\n \"version\": \"9.0.100\"\n }\n}\n\n```\n- 然后打开vs在各项目的属性中,选择.net9.0即可完成升级\n\n>以下新特性文档,摘自微软官方\n## 序列化\n\n在 System.Text.Json 中,.NET 9 具有用于序列化 JSON 的新选项和新的单一实例,可以更轻松地使用 Web 默认值进行序列化。\n\n### 缩进选项\n\nJsonSerializerOptions包含一些新属性,可用于自定义写入 JSON 的缩进字符和缩进大小。\n\n\n```c#\nvar options = new JsonSerializerOptions\n{\n WriteIndented = true,\n IndentCharacter = '\\t',\n IndentSize = 2,\n};\n\nstring json = JsonSerializer.Serialize(\n new { Value = 1 },\n options\n );\nConsole.WriteLine(json);\n//{\n// \"Value\": 1\n//}\n```\n\n\n### 默认 Web 选项\n\n如果要使用 ASP.NET Core 用于 Web 应用的默认选项进行序列化,请使用新的 JsonSerializerOptions.Web 单一实例。\n\n```c#\nstring webJson = JsonSerializer.Serialize(\n new { SomeValue = 42 },\n JsonSerializerOptions.Web // Defaults to camelCase naming policy.\n );\nConsole.WriteLine(webJson);\n// {\"someValue\":42}\n```\n\n## LINQ的\n\n引入了新方法CountBy和AggregateBy这些方法可以按键聚合状态,而无需通过 GroupBy\n\nCountBy 可让您快速计算每个键的频率。下面的示例查找文本字符串中最常出现的单词。\n\n```C#\nstring sourceText = \"\"\"\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Sed non risus. Suspendisse lectus tortor, dignissim sit amet, \n adipiscing nec, ultricies sed, dolor. Cras elementum ultrices amet diam.\n\"\"\";\n\n// Find the most frequent word in the text.\nKeyValuePair<string, int> mostFrequentWord = sourceText\n .Split(new char[] { ' ', '.', ',' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(word => word.ToLowerInvariant())\n .CountBy(word => word)\n .MaxBy(pair => pair.Value);\n\nConsole.WriteLine(mostFrequentWord.Key); // amet\n```\n\nAggregateBy允许您实现更多通用工作流。以下示例演示如何计算与给定键关联的分数。\n\n```C#\n(string id, int score)[] data =\n [\n (\"0\", 42),\n (\"1\", 5),\n (\"2\", 4),\n (\"1\", 10),\n (\"0\", 25),\n ];\n\nvar aggregatedData =\n data.AggregateBy(\n keySelector: entry => entry.id,\n seed: 0,\n (totalScore, curr) => totalScore + curr.score\n );\n\nforeach (var item in aggregatedData)\n{\n Console.WriteLine(item);\n}\n//(0, 67)\n//(1, 15)\n//(2, 4)\n\n///Index<TSource>(IEnumerable<TSource>)可以快速提取可枚举的隐式索引。现在,您可以编写如下代码片段,以自动为集合中的项编制索引。\n\n```c#\nIEnumerable<string> lines2 = File.ReadAllLines(\"output.txt\");\nforeach ((int index, string line) in lines2.Index())\n{\n Console.WriteLine($\"Line number: {index + 1}, Line: {line}\");\n}\n```\n\n## 密码学\n\n对于加密,.NET 9 在 CryptographicOperations类型上添加了新的一次性哈希方法。它还添加了使用 KMAC 算法的新类。\n\n### CryptographicOperations.HashData() 方法\n\n.NET 包括哈希函数和相关函数的多个静态“一次性”实现。这些 API 包括 SHA256。HashData 和 HMACSHA256。哈希数据。最好使用一次性 API,因为它们可以提供最佳性能并减少或消除分配。\n\n如果开发人员想要提供支持哈希的 API,其中调用方定义要使用的哈希算法,则通常通过接受 HashAlgorithmName 参数来完成。但是,将该模式与一次性 API 一起使用需要切换每个可能的 HashAlgorithmName,然后使用适当的方法。为了解决此问题,.NET 9 引入了 CryptographicOperations.HashData API。此 API 允许您一次性生成输入的哈希或 HMAC,其中使用的算法由 HashAlgorithmName 确定。\n\n\n```c#\nstatic void HashAndProcessData(HashAlgorithmName hashAlgorithmName, byte[] data)\n{\n byte[] hash = CryptographicOperations.HashData(hashAlgorithmName, data);\n ProcessHash(hash);\n}\n```\n\n\n### KMAC算法\n\n.NET 9 提供 NIST SP-800-185指定的 KMAC 算法。KECCAK 消息验证码 (KMAC) 是一个基于 KECCAK 的伪随机函数和键控哈希函数。\n\n以下新类使用 KMAC 算法。使用实例累积数据以生成 MAC,或使用静态方法对单个输入进行一次性处理。`HashData`\n\n- [KMAC128型](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac128)\n- [KMAC256型](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac256)\n- [KmacXof128](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof128)\n- [KmacXof256](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof256)\n\nKMAC 在具有 OpenSSL 3.0 或更高版本的 Linux 以及 Windows 11 Build 26016 或更高版本上可用。可以使用 static 属性来确定平台是否支持所需的算法。`IsSupported`\n\n\n```c#\nif (Kmac128.IsSupported)\n{\n byte[] key = GetKmacKey();\n byte[] input = GetInputToMac();\n byte[] mac = Kmac128.HashData(key, input, outputLength: 32);\n}\nelse\n{\n // Handle scenario where KMAC isn't available.\n}\n```\n\n## 反射\n\n在 .NET Core 版本和 .NET 5-8 中,对生成程序集和为动态创建的类型发出反射元数据的支持仅限于可运行的 AssemblyBuilder。缺乏对_保存_程序集的支持通常是客户从 .NET Framework 迁移到 .NET 的障碍。.NET 9 将公共 API 添加到 AssemblyBuilder以保存发出的程序集。\n\n新的持久化 AssemblyBuilder\n\n```c#\npublic void CreateAndSaveAssembly(string assemblyPath)\n{\n AssemblyBuilder ab = AssemblyBuilder.DefinePersistedAssembly(\n new AssemblyName(\"MyAssembly\"),\n typeof(object).Assembly\n );\n TypeBuilder tb = ab.DefineDynamicModule(\"MyModule\")\n .DefineType(\"MyType\", TypeAttributes.Public | TypeAttributes.Class);\n\n MethodBuilder mb = tb.DefineMethod(\n \"SumMethod\",\n MethodAttributes.Public | MethodAttributes.Static,\n typeof(int), [typeof(int), typeof(int)]\n );\n ILGenerator il = mb.GetILGenerator();\n il.Emit(OpCodes.Ldarg_0);\n il.Emit(OpCodes.Ldarg_1);\n il.Emit(OpCodes.Add);\n il.Emit(OpCodes.Ret);\n\n tb.CreateType();\n ab.Save(assemblyPath); // or could save to a Stream\n}\n\npublic void UseAssembly(string assemblyPath)\n{\n Assembly assembly = Assembly.LoadFrom(assemblyPath);\n Type type = assembly.GetType(\"MyType\");\n MethodInfo method = type.GetMethod(\"SumMethod\");\n Console.WriteLine(method.Invoke(null, [5, 10]));\n}\n```","source":"_posts/net9.md","raw":"---\ntitle: \".NET9发布了,了解一下更新了什么?\"\ntags:\n - \"C#\"\n - \".NET9\"\ncategories:\n - \"编程教程\"\n---\n\n>来关注一下2024刚发现的.net9预览版有哪些好玩的新内容\n## 版本信息\n版本号信息如下:\n- Full version\n- 9.0.100-preview.1.24101.2\n- Visual Studio support\n- Visual Studio 2022 (v17.10 Preview 1)\n- 官方下载地址:[Download .NET 9.0 ](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)\n## 升级步骤\n- 安装官方的sdk和runtime两个包\n- 升级本地的visual studio,我自己vs的版本是2022,17.8.7,要连续更新,只能升级到17.9.0\n- 所以还得重新下载10的安装工具,下载地址:[visualstudio17.10.0](https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview)\n- <img src=\"/images/cutimg1.png\" width = \"500\" height = \"200\"/>\n- 修改项目的global.json如下\n``` json\n{\n \"sdk\": {\n \"version\": \"9.0.100\"\n }\n}\n\n```\n- 然后打开vs在各项目的属性中,选择.net9.0即可完成升级\n\n>以下新特性文档,摘自微软官方\n## 序列化\n\n在 System.Text.Json 中,.NET 9 具有用于序列化 JSON 的新选项和新的单一实例,可以更轻松地使用 Web 默认值进行序列化。\n\n### 缩进选项\n\nJsonSerializerOptions包含一些新属性,可用于自定义写入 JSON 的缩进字符和缩进大小。\n\n\n```c#\nvar options = new JsonSerializerOptions\n{\n WriteIndented = true,\n IndentCharacter = '\\t',\n IndentSize = 2,\n};\n\nstring json = JsonSerializer.Serialize(\n new { Value = 1 },\n options\n );\nConsole.WriteLine(json);\n//{\n// \"Value\": 1\n//}\n```\n\n\n### 默认 Web 选项\n\n如果要使用 ASP.NET Core 用于 Web 应用的默认选项进行序列化,请使用新的 JsonSerializerOptions.Web 单一实例。\n\n```c#\nstring webJson = JsonSerializer.Serialize(\n new { SomeValue = 42 },\n JsonSerializerOptions.Web // Defaults to camelCase naming policy.\n );\nConsole.WriteLine(webJson);\n// {\"someValue\":42}\n```\n\n## LINQ的\n\n引入了新方法CountBy和AggregateBy这些方法可以按键聚合状态,而无需通过 GroupBy\n\nCountBy 可让您快速计算每个键的频率。下面的示例查找文本字符串中最常出现的单词。\n\n```C#\nstring sourceText = \"\"\"\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Sed non risus. Suspendisse lectus tortor, dignissim sit amet, \n adipiscing nec, ultricies sed, dolor. Cras elementum ultrices amet diam.\n\"\"\";\n\n// Find the most frequent word in the text.\nKeyValuePair<string, int> mostFrequentWord = sourceText\n .Split(new char[] { ' ', '.', ',' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(word => word.ToLowerInvariant())\n .CountBy(word => word)\n .MaxBy(pair => pair.Value);\n\nConsole.WriteLine(mostFrequentWord.Key); // amet\n```\n\nAggregateBy允许您实现更多通用工作流。以下示例演示如何计算与给定键关联的分数。\n\n```C#\n(string id, int score)[] data =\n [\n (\"0\", 42),\n (\"1\", 5),\n (\"2\", 4),\n (\"1\", 10),\n (\"0\", 25),\n ];\n\nvar aggregatedData =\n data.AggregateBy(\n keySelector: entry => entry.id,\n seed: 0,\n (totalScore, curr) => totalScore + curr.score\n );\n\nforeach (var item in aggregatedData)\n{\n Console.WriteLine(item);\n}\n//(0, 67)\n//(1, 15)\n//(2, 4)\n\n///Index<TSource>(IEnumerable<TSource>)可以快速提取可枚举的隐式索引。现在,您可以编写如下代码片段,以自动为集合中的项编制索引。\n\n```c#\nIEnumerable<string> lines2 = File.ReadAllLines(\"output.txt\");\nforeach ((int index, string line) in lines2.Index())\n{\n Console.WriteLine($\"Line number: {index + 1}, Line: {line}\");\n}\n```\n\n## 密码学\n\n对于加密,.NET 9 在 CryptographicOperations类型上添加了新的一次性哈希方法。它还添加了使用 KMAC 算法的新类。\n\n### CryptographicOperations.HashData() 方法\n\n.NET 包括哈希函数和相关函数的多个静态“一次性”实现。这些 API 包括 SHA256。HashData 和 HMACSHA256。哈希数据。最好使用一次性 API,因为它们可以提供最佳性能并减少或消除分配。\n\n如果开发人员想要提供支持哈希的 API,其中调用方定义要使用的哈希算法,则通常通过接受 HashAlgorithmName 参数来完成。但是,将该模式与一次性 API 一起使用需要切换每个可能的 HashAlgorithmName,然后使用适当的方法。为了解决此问题,.NET 9 引入了 CryptographicOperations.HashData API。此 API 允许您一次性生成输入的哈希或 HMAC,其中使用的算法由 HashAlgorithmName 确定。\n\n\n```c#\nstatic void HashAndProcessData(HashAlgorithmName hashAlgorithmName, byte[] data)\n{\n byte[] hash = CryptographicOperations.HashData(hashAlgorithmName, data);\n ProcessHash(hash);\n}\n```\n\n\n### KMAC算法\n\n.NET 9 提供 NIST SP-800-185指定的 KMAC 算法。KECCAK 消息验证码 (KMAC) 是一个基于 KECCAK 的伪随机函数和键控哈希函数。\n\n以下新类使用 KMAC 算法。使用实例累积数据以生成 MAC,或使用静态方法对单个输入进行一次性处理。`HashData`\n\n- [KMAC128型](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac128)\n- [KMAC256型](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac256)\n- [KmacXof128](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof128)\n- [KmacXof256](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof256)\n\nKMAC 在具有 OpenSSL 3.0 或更高版本的 Linux 以及 Windows 11 Build 26016 或更高版本上可用。可以使用 static 属性来确定平台是否支持所需的算法。`IsSupported`\n\n\n```c#\nif (Kmac128.IsSupported)\n{\n byte[] key = GetKmacKey();\n byte[] input = GetInputToMac();\n byte[] mac = Kmac128.HashData(key, input, outputLength: 32);\n}\nelse\n{\n // Handle scenario where KMAC isn't available.\n}\n```\n\n## 反射\n\n在 .NET Core 版本和 .NET 5-8 中,对生成程序集和为动态创建的类型发出反射元数据的支持仅限于可运行的 AssemblyBuilder。缺乏对_保存_程序集的支持通常是客户从 .NET Framework 迁移到 .NET 的障碍。.NET 9 将公共 API 添加到 AssemblyBuilder以保存发出的程序集。\n\n新的持久化 AssemblyBuilder\n\n```c#\npublic void CreateAndSaveAssembly(string assemblyPath)\n{\n AssemblyBuilder ab = AssemblyBuilder.DefinePersistedAssembly(\n new AssemblyName(\"MyAssembly\"),\n typeof(object).Assembly\n );\n TypeBuilder tb = ab.DefineDynamicModule(\"MyModule\")\n .DefineType(\"MyType\", TypeAttributes.Public | TypeAttributes.Class);\n\n MethodBuilder mb = tb.DefineMethod(\n \"SumMethod\",\n MethodAttributes.Public | MethodAttributes.Static,\n typeof(int), [typeof(int), typeof(int)]\n );\n ILGenerator il = mb.GetILGenerator();\n il.Emit(OpCodes.Ldarg_0);\n il.Emit(OpCodes.Ldarg_1);\n il.Emit(OpCodes.Add);\n il.Emit(OpCodes.Ret);\n\n tb.CreateType();\n ab.Save(assemblyPath); // or could save to a Stream\n}\n\npublic void UseAssembly(string assemblyPath)\n{\n Assembly assembly = Assembly.LoadFrom(assemblyPath);\n Type type = assembly.GetType(\"MyType\");\n MethodInfo method = type.GetMethod(\"SumMethod\");\n Console.WriteLine(method.Invoke(null, [5, 10]));\n}\n```","slug":"net9","published":1,"date":"2024-02-21T04:24:31.930Z","updated":"2024-02-21T05:06:22.000Z","_id":"clsvap2ab00000ocz50dk0r3m","comments":1,"layout":"post","photos":[],"content":"<blockquote>\n<p>来关注一下2024刚发现的.net9预览版有哪些好玩的新内容</p>\n</blockquote>\n<h2 id=\"版本信息\"><a href=\"#版本信息\" class=\"headerlink\" title=\"版本信息\"></a>版本信息</h2><p>版本号信息如下:</p>\n<ul>\n<li>Full version</li>\n<li>9.0.100-preview.1.24101.2</li>\n<li>Visual Studio support</li>\n<li>Visual Studio 2022 (v17.10 Preview 1)</li>\n<li>官方下载地址:<a class=\"link\" href=\"https://dotnet.microsoft.com/en-us/download/dotnet/9.0\" >Download .NET 9.0 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n<h2 id=\"升级步骤\"><a href=\"#升级步骤\" class=\"headerlink\" title=\"升级步骤\"></a>升级步骤</h2><ul>\n<li>安装官方的sdk和runtime两个包</li>\n<li>升级本地的visual studio,我自己vs的版本是2022,17.8.7,要连续更新,只能升级到17.9.0</li>\n<li>所以还得重新下载10的安装工具,下载地址:<a class=\"link\" href=\"https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview\" >visualstudio17.10.0 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><img \n lazyload\n src=\"/images/loading.svg\"\n data-src=\"/images/cutimg1.png\"\n width = \"500\" height = \"200\"\n ></li>\n<li>修改项目的global.json如下<div class=\"highlight-container\" data-rel=\"Json\"><figure class=\"iseeu highlight json\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"punctuation\">{</span></span><br><span class=\"line\"> <span class=\"attr\">"sdk"</span><span class=\"punctuation\">:</span> <span class=\"punctuation\">{</span></span><br><span class=\"line\"> <span class=\"attr\">"version"</span><span class=\"punctuation\">:</span> <span class=\"string\">"9.0.100"</span></span><br><span class=\"line\"> <span class=\"punctuation\">}</span></span><br><span class=\"line\"><span class=\"punctuation\">}</span></span><br><span class=\"line\"></span><br></pre></td></tr></table></figure></div></li>\n<li>然后打开vs在各项目的属性中,选择.net9.0即可完成升级</li>\n</ul>\n<blockquote>\n<p>以下新特性文档,摘自微软官方</p>\n</blockquote>\n<h2 id=\"序列化\"><a href=\"#序列化\" class=\"headerlink\" title=\"序列化\"></a>序列化</h2><p>在 System.Text.Json 中,.NET 9 具有用于序列化 JSON 的新选项和新的单一实例,可以更轻松地使用 Web 默认值进行序列化。</p>\n<h3 id=\"缩进选项\"><a href=\"#缩进选项\" class=\"headerlink\" title=\"缩进选项\"></a>缩进选项</h3><p>JsonSerializerOptions包含一些新属性,可用于自定义写入 JSON 的缩进字符和缩进大小。</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">var</span> options = <span class=\"keyword\">new</span> JsonSerializerOptions</span><br><span class=\"line\">{</span><br><span class=\"line\"> WriteIndented = <span class=\"literal\">true</span>,</span><br><span class=\"line\"> IndentCharacter = <span class=\"string\">'\\t'</span>,</span><br><span class=\"line\"> IndentSize = <span class=\"number\">2</span>,</span><br><span class=\"line\">};</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"built_in\">string</span> json = JsonSerializer.Serialize(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> { Value = <span class=\"number\">1</span> },</span><br><span class=\"line\"> options</span><br><span class=\"line\"> );</span><br><span class=\"line\">Console.WriteLine(json);</span><br><span class=\"line\"><span class=\"comment\">//{</span></span><br><span class=\"line\"><span class=\"comment\">// "Value": 1</span></span><br><span class=\"line\"><span class=\"comment\">//}</span></span><br></pre></td></tr></table></figure></div>\n\n\n<h3 id=\"默认-Web-选项\"><a href=\"#默认-Web-选项\" class=\"headerlink\" title=\"默认 Web 选项\"></a>默认 Web 选项</h3><p>如果要使用 ASP.NET Core 用于 Web 应用的默认选项进行序列化,请使用新的 JsonSerializerOptions.Web 单一实例。</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">string</span> webJson = JsonSerializer.Serialize(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> { SomeValue = <span class=\"number\">42</span> },</span><br><span class=\"line\"> JsonSerializerOptions.Web <span class=\"comment\">// Defaults to camelCase naming policy.</span></span><br><span class=\"line\"> );</span><br><span class=\"line\">Console.WriteLine(webJson);</span><br><span class=\"line\"><span class=\"comment\">// {"someValue":42}</span></span><br></pre></td></tr></table></figure></div>\n\n<h2 id=\"LINQ的\"><a href=\"#LINQ的\" class=\"headerlink\" title=\"LINQ的\"></a>LINQ的</h2><p>引入了新方法CountBy和AggregateBy这些方法可以按键聚合状态,而无需通过 GroupBy</p>\n<p>CountBy 可让您快速计算每个键的频率。下面的示例查找文本字符串中最常出现的单词。</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">string</span> sourceText = <span class=\"string\">""</span><span class=\"string\">"</span></span><br><span class=\"line\"><span class=\"string\"> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span></span><br><span class=\"line\"><span class=\"string\"> Sed non risus. Suspendisse lectus tortor, dignissim sit amet, </span></span><br><span class=\"line\"><span class=\"string\"> adipiscing nec, ultricies sed, dolor. Cras elementum ultrices amet diam.</span></span><br><span class=\"line\"><span class=\"string\">"</span><span class=\"string\">""</span>;</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">// Find the most frequent word in the text.</span></span><br><span class=\"line\">KeyValuePair<<span class=\"built_in\">string</span>, <span class=\"built_in\">int</span>> mostFrequentWord = sourceText</span><br><span class=\"line\"> .Split(<span class=\"keyword\">new</span> <span class=\"built_in\">char</span>[] { <span class=\"string\">' '</span>, <span class=\"string\">'.'</span>, <span class=\"string\">','</span> }, StringSplitOptions.RemoveEmptyEntries)</span><br><span class=\"line\"> .Select(word => word.ToLowerInvariant())</span><br><span class=\"line\"> .CountBy(word => word)</span><br><span class=\"line\"> .MaxBy(pair => pair.Value);</span><br><span class=\"line\"></span><br><span class=\"line\">Console.WriteLine(mostFrequentWord.Key); <span class=\"comment\">// amet</span></span><br></pre></td></tr></table></figure></div>\n\n<p>AggregateBy允许您实现更多通用工作流。以下示例演示如何计算与给定键关联的分数。</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">(<span class=\"built_in\">string</span> id, <span class=\"built_in\">int</span> score)[] data =</span><br><span class=\"line\"> [</span><br><span class=\"line\"> (<span class=\"string\">"0"</span>, <span class=\"number\">42</span>),</span><br><span class=\"line\"> (<span class=\"string\">"1"</span>, <span class=\"number\">5</span>),</span><br><span class=\"line\"> (<span class=\"string\">"2"</span>, <span class=\"number\">4</span>),</span><br><span class=\"line\"> (<span class=\"string\">"1"</span>, <span class=\"number\">10</span>),</span><br><span class=\"line\"> (<span class=\"string\">"0"</span>, <span class=\"number\">25</span>),</span><br><span class=\"line\"> ];</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">var</span> aggregatedData =</span><br><span class=\"line\"> data.AggregateBy(</span><br><span class=\"line\"> keySelector: entry => entry.id,</span><br><span class=\"line\"> seed: <span class=\"number\">0</span>,</span><br><span class=\"line\"> (totalScore, curr) => totalScore + curr.score</span><br><span class=\"line\"> );</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">foreach</span> (<span class=\"keyword\">var</span> item <span class=\"keyword\">in</span> aggregatedData)</span><br><span class=\"line\">{</span><br><span class=\"line\"> Console.WriteLine(item);</span><br><span class=\"line\">}</span><br><span class=\"line\"><span class=\"comment\">//(0, 67)</span></span><br><span class=\"line\"><span class=\"comment\">//(1, 15)</span></span><br><span class=\"line\"><span class=\"comment\">//(2, 4)</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"><span class=\"doctag\">///</span>Index<span class=\"doctag\"><TSource></span>(IEnumerable<span class=\"doctag\"><TSource></span>)可以快速提取可枚举的隐式索引。现在,您可以编写如下代码片段,以自动为集合中的项编制索引。</span></span><br><span class=\"line\"></span><br><span class=\"line\">```c<span class=\"meta\">#</span></span><br><span class=\"line\">IEnumerable<<span class=\"built_in\">string</span>> lines2 = File.ReadAllLines(<span class=\"string\">"output.txt"</span>);</span><br><span class=\"line\"><span class=\"keyword\">foreach</span> ((<span class=\"built_in\">int</span> index, <span class=\"built_in\">string</span> line) <span class=\"keyword\">in</span> lines2.Index())</span><br><span class=\"line\">{</span><br><span class=\"line\"> Console.WriteLine(<span class=\"string\">$"Line number: <span class=\"subst\">{index + <span class=\"number\">1</span>}</span>, Line: <span class=\"subst\">{line}</span>"</span>);</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure></div>\n\n<h2 id=\"密码学\"><a href=\"#密码学\" class=\"headerlink\" title=\"密码学\"></a>密码学</h2><p>对于加密,.NET 9 在 CryptographicOperations类型上添加了新的一次性哈希方法。它还添加了使用 KMAC 算法的新类。</p>\n<h3 id=\"CryptographicOperations-HashData()-方法\"><a href=\"#CryptographicOperations-HashData()-方法\" class=\"headerlink\" title=\"CryptographicOperations.HashData() 方法\"></a>CryptographicOperations.HashData() 方法</h3><p>.NET 包括哈希函数和相关函数的多个静态“一次性”实现。这些 API 包括 SHA256。HashData 和 HMACSHA256。哈希数据。最好使用一次性 API,因为它们可以提供最佳性能并减少或消除分配。</p>\n<p>如果开发人员想要提供支持哈希的 API,其中调用方定义要使用的哈希算法,则通常通过接受 HashAlgorithmName 参数来完成。但是,将该模式与一次性 API 一起使用需要切换每个可能的 HashAlgorithmName,然后使用适当的方法。为了解决此问题,.NET 9 引入了 CryptographicOperations.HashData API。此 API 允许您一次性生成输入的哈希或 HMAC,其中使用的算法由 HashAlgorithmName 确定。</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"function\"><span class=\"keyword\">static</span> <span class=\"keyword\">void</span> <span class=\"title\">HashAndProcessData</span>(<span class=\"params\">HashAlgorithmName hashAlgorithmName, <span class=\"built_in\">byte</span>[] data</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] hash = CryptographicOperations.HashData(hashAlgorithmName, data);</span><br><span class=\"line\"> ProcessHash(hash);</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure></div>\n\n\n<h3 id=\"KMAC算法\"><a href=\"#KMAC算法\" class=\"headerlink\" title=\"KMAC算法\"></a>KMAC算法</h3><p>.NET 9 提供 NIST SP-800-185指定的 KMAC 算法。KECCAK 消息验证码 (KMAC) 是一个基于 KECCAK 的伪随机函数和键控哈希函数。</p>\n<p>以下新类使用 KMAC 算法。使用实例累积数据以生成 MAC,或使用静态方法对单个输入进行一次性处理。<code>HashData</code></p>\n<ul>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac128\" >KMAC128型 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac256\" >KMAC256型 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof128\" >KmacXof128 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof256\" >KmacXof256 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n<p>KMAC 在具有 OpenSSL 3.0 或更高版本的 Linux 以及 Windows 11 Build 26016 或更高版本上可用。可以使用 static 属性来确定平台是否支持所需的算法。<code>IsSupported</code></p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">if</span> (Kmac128.IsSupported)</span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] key = GetKmacKey();</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] input = GetInputToMac();</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] mac = Kmac128.HashData(key, input, outputLength: <span class=\"number\">32</span>);</span><br><span class=\"line\">}</span><br><span class=\"line\"><span class=\"keyword\">else</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"comment\">// Handle scenario where KMAC isn't available.</span></span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure></div>\n\n<h2 id=\"反射\"><a href=\"#反射\" class=\"headerlink\" title=\"反射\"></a>反射</h2><p>在 .NET Core 版本和 .NET 5-8 中,对生成程序集和为动态创建的类型发出反射元数据的支持仅限于可运行的 AssemblyBuilder。缺乏对_保存_程序集的支持通常是客户从 .NET Framework 迁移到 .NET 的障碍。.NET 9 将公共 API 添加到 AssemblyBuilder以保存发出的程序集。</p>\n<p>新的持久化 AssemblyBuilder</p>\n<div class=\"highlight-container\" data-rel=\"C#\"><figure class=\"iseeu highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"function\"><span class=\"keyword\">public</span> <span class=\"keyword\">void</span> <span class=\"title\">CreateAndSaveAssembly</span>(<span class=\"params\"><span class=\"built_in\">string</span> assemblyPath</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> AssemblyBuilder ab = AssemblyBuilder.DefinePersistedAssembly(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> AssemblyName(<span class=\"string\">"MyAssembly"</span>),</span><br><span class=\"line\"> <span class=\"keyword\">typeof</span>(<span class=\"built_in\">object</span>).Assembly</span><br><span class=\"line\"> );</span><br><span class=\"line\"> TypeBuilder tb = ab.DefineDynamicModule(<span class=\"string\">"MyModule"</span>)</span><br><span class=\"line\"> .DefineType(<span class=\"string\">"MyType"</span>, TypeAttributes.Public | TypeAttributes.Class);</span><br><span class=\"line\"></span><br><span class=\"line\"> MethodBuilder mb = tb.DefineMethod(</span><br><span class=\"line\"> <span class=\"string\">"SumMethod"</span>,</span><br><span class=\"line\"> MethodAttributes.Public | MethodAttributes.Static,</span><br><span class=\"line\"> <span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>), [<span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>), <span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>)]</span><br><span class=\"line\"> );</span><br><span class=\"line\"> ILGenerator il = mb.GetILGenerator();</span><br><span class=\"line\"> il.Emit(OpCodes.Ldarg_0);</span><br><span class=\"line\"> il.Emit(OpCodes.Ldarg_1);</span><br><span class=\"line\"> il.Emit(OpCodes.Add);</span><br><span class=\"line\"> il.Emit(OpCodes.Ret);</span><br><span class=\"line\"></span><br><span class=\"line\"> tb.CreateType();</span><br><span class=\"line\"> ab.Save(assemblyPath); <span class=\"comment\">// or could save to a Stream</span></span><br><span class=\"line\">}</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"function\"><span class=\"keyword\">public</span> <span class=\"keyword\">void</span> <span class=\"title\">UseAssembly</span>(<span class=\"params\"><span class=\"built_in\">string</span> assemblyPath</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> Assembly assembly = Assembly.LoadFrom(assemblyPath);</span><br><span class=\"line\"> Type type = assembly.GetType(<span class=\"string\">"MyType"</span>);</span><br><span class=\"line\"> MethodInfo method = type.GetMethod(<span class=\"string\">"SumMethod"</span>);</span><br><span class=\"line\"> Console.WriteLine(method.Invoke(<span class=\"literal\">null</span>, [<span class=\"number\">5</span>, <span class=\"number\">10</span>]));</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure></div>","excerpt":"","more":"<blockquote>\n<p>来关注一下2024刚发现的.net9预览版有哪些好玩的新内容</p>\n</blockquote>\n<h2 id=\"版本信息\"><a href=\"#版本信息\" class=\"headerlink\" title=\"版本信息\"></a>版本信息</h2><p>版本号信息如下:</p>\n<ul>\n<li>Full version</li>\n<li>9.0.100-preview.1.24101.2</li>\n<li>Visual Studio support</li>\n<li>Visual Studio 2022 (v17.10 Preview 1)</li>\n<li>官方下载地址:<a class=\"link\" href=\"https://dotnet.microsoft.com/en-us/download/dotnet/9.0\" >Download .NET 9.0 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n<h2 id=\"升级步骤\"><a href=\"#升级步骤\" class=\"headerlink\" title=\"升级步骤\"></a>升级步骤</h2><ul>\n<li>安装官方的sdk和runtime两个包</li>\n<li>升级本地的visual studio,我自己vs的版本是2022,17.8.7,要连续更新,只能升级到17.9.0</li>\n<li>所以还得重新下载10的安装工具,下载地址:<a class=\"link\" href=\"https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview\" >visualstudio17.10.0 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><img \n lazyload\n src=\"/images/loading.svg\"\n data-src=\"/images/cutimg1.png\"\n width = \"500\" height = \"200\"\n ></li>\n<li>修改项目的global.json如下<figure class=\"highlight json\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"punctuation\">{</span></span><br><span class=\"line\"> <span class=\"attr\">"sdk"</span><span class=\"punctuation\">:</span> <span class=\"punctuation\">{</span></span><br><span class=\"line\"> <span class=\"attr\">"version"</span><span class=\"punctuation\">:</span> <span class=\"string\">"9.0.100"</span></span><br><span class=\"line\"> <span class=\"punctuation\">}</span></span><br><span class=\"line\"><span class=\"punctuation\">}</span></span><br><span class=\"line\"></span><br></pre></td></tr></table></figure></li>\n<li>然后打开vs在各项目的属性中,选择.net9.0即可完成升级</li>\n</ul>\n<blockquote>\n<p>以下新特性文档,摘自微软官方</p>\n</blockquote>\n<h2 id=\"序列化\"><a href=\"#序列化\" class=\"headerlink\" title=\"序列化\"></a>序列化</h2><p>在 System.Text.Json 中,.NET 9 具有用于序列化 JSON 的新选项和新的单一实例,可以更轻松地使用 Web 默认值进行序列化。</p>\n<h3 id=\"缩进选项\"><a href=\"#缩进选项\" class=\"headerlink\" title=\"缩进选项\"></a>缩进选项</h3><p>JsonSerializerOptions包含一些新属性,可用于自定义写入 JSON 的缩进字符和缩进大小。</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">var</span> options = <span class=\"keyword\">new</span> JsonSerializerOptions</span><br><span class=\"line\">{</span><br><span class=\"line\"> WriteIndented = <span class=\"literal\">true</span>,</span><br><span class=\"line\"> IndentCharacter = <span class=\"string\">'\\t'</span>,</span><br><span class=\"line\"> IndentSize = <span class=\"number\">2</span>,</span><br><span class=\"line\">};</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"built_in\">string</span> json = JsonSerializer.Serialize(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> { Value = <span class=\"number\">1</span> },</span><br><span class=\"line\"> options</span><br><span class=\"line\"> );</span><br><span class=\"line\">Console.WriteLine(json);</span><br><span class=\"line\"><span class=\"comment\">//{</span></span><br><span class=\"line\"><span class=\"comment\">// "Value": 1</span></span><br><span class=\"line\"><span class=\"comment\">//}</span></span><br></pre></td></tr></table></figure>\n\n\n<h3 id=\"默认-Web-选项\"><a href=\"#默认-Web-选项\" class=\"headerlink\" title=\"默认 Web 选项\"></a>默认 Web 选项</h3><p>如果要使用 ASP.NET Core 用于 Web 应用的默认选项进行序列化,请使用新的 JsonSerializerOptions.Web 单一实例。</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">string</span> webJson = JsonSerializer.Serialize(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> { SomeValue = <span class=\"number\">42</span> },</span><br><span class=\"line\"> JsonSerializerOptions.Web <span class=\"comment\">// Defaults to camelCase naming policy.</span></span><br><span class=\"line\"> );</span><br><span class=\"line\">Console.WriteLine(webJson);</span><br><span class=\"line\"><span class=\"comment\">// {"someValue":42}</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"LINQ的\"><a href=\"#LINQ的\" class=\"headerlink\" title=\"LINQ的\"></a>LINQ的</h2><p>引入了新方法CountBy和AggregateBy这些方法可以按键聚合状态,而无需通过 GroupBy</p>\n<p>CountBy 可让您快速计算每个键的频率。下面的示例查找文本字符串中最常出现的单词。</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">string</span> sourceText = <span class=\"string\">""</span><span class=\"string\">"</span></span><br><span class=\"line\"><span class=\"string\"> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span></span><br><span class=\"line\"><span class=\"string\"> Sed non risus. Suspendisse lectus tortor, dignissim sit amet, </span></span><br><span class=\"line\"><span class=\"string\"> adipiscing nec, ultricies sed, dolor. Cras elementum ultrices amet diam.</span></span><br><span class=\"line\"><span class=\"string\">"</span><span class=\"string\">""</span>;</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">// Find the most frequent word in the text.</span></span><br><span class=\"line\">KeyValuePair<<span class=\"built_in\">string</span>, <span class=\"built_in\">int</span>> mostFrequentWord = sourceText</span><br><span class=\"line\"> .Split(<span class=\"keyword\">new</span> <span class=\"built_in\">char</span>[] { <span class=\"string\">' '</span>, <span class=\"string\">'.'</span>, <span class=\"string\">','</span> }, StringSplitOptions.RemoveEmptyEntries)</span><br><span class=\"line\"> .Select(word => word.ToLowerInvariant())</span><br><span class=\"line\"> .CountBy(word => word)</span><br><span class=\"line\"> .MaxBy(pair => pair.Value);</span><br><span class=\"line\"></span><br><span class=\"line\">Console.WriteLine(mostFrequentWord.Key); <span class=\"comment\">// amet</span></span><br></pre></td></tr></table></figure>\n\n<p>AggregateBy允许您实现更多通用工作流。以下示例演示如何计算与给定键关联的分数。</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">(<span class=\"built_in\">string</span> id, <span class=\"built_in\">int</span> score)[] data =</span><br><span class=\"line\"> [</span><br><span class=\"line\"> (<span class=\"string\">"0"</span>, <span class=\"number\">42</span>),</span><br><span class=\"line\"> (<span class=\"string\">"1"</span>, <span class=\"number\">5</span>),</span><br><span class=\"line\"> (<span class=\"string\">"2"</span>, <span class=\"number\">4</span>),</span><br><span class=\"line\"> (<span class=\"string\">"1"</span>, <span class=\"number\">10</span>),</span><br><span class=\"line\"> (<span class=\"string\">"0"</span>, <span class=\"number\">25</span>),</span><br><span class=\"line\"> ];</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">var</span> aggregatedData =</span><br><span class=\"line\"> data.AggregateBy(</span><br><span class=\"line\"> keySelector: entry => entry.id,</span><br><span class=\"line\"> seed: <span class=\"number\">0</span>,</span><br><span class=\"line\"> (totalScore, curr) => totalScore + curr.score</span><br><span class=\"line\"> );</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">foreach</span> (<span class=\"keyword\">var</span> item <span class=\"keyword\">in</span> aggregatedData)</span><br><span class=\"line\">{</span><br><span class=\"line\"> Console.WriteLine(item);</span><br><span class=\"line\">}</span><br><span class=\"line\"><span class=\"comment\">//(0, 67)</span></span><br><span class=\"line\"><span class=\"comment\">//(1, 15)</span></span><br><span class=\"line\"><span class=\"comment\">//(2, 4)</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"><span class=\"doctag\">///</span>Index<span class=\"doctag\"><TSource></span>(IEnumerable<span class=\"doctag\"><TSource></span>)可以快速提取可枚举的隐式索引。现在,您可以编写如下代码片段,以自动为集合中的项编制索引。</span></span><br><span class=\"line\"></span><br><span class=\"line\">```c<span class=\"meta\">#</span></span><br><span class=\"line\">IEnumerable<<span class=\"built_in\">string</span>> lines2 = File.ReadAllLines(<span class=\"string\">"output.txt"</span>);</span><br><span class=\"line\"><span class=\"keyword\">foreach</span> ((<span class=\"built_in\">int</span> index, <span class=\"built_in\">string</span> line) <span class=\"keyword\">in</span> lines2.Index())</span><br><span class=\"line\">{</span><br><span class=\"line\"> Console.WriteLine(<span class=\"string\">$"Line number: <span class=\"subst\">{index + <span class=\"number\">1</span>}</span>, Line: <span class=\"subst\">{line}</span>"</span>);</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"密码学\"><a href=\"#密码学\" class=\"headerlink\" title=\"密码学\"></a>密码学</h2><p>对于加密,.NET 9 在 CryptographicOperations类型上添加了新的一次性哈希方法。它还添加了使用 KMAC 算法的新类。</p>\n<h3 id=\"CryptographicOperations-HashData()-方法\"><a href=\"#CryptographicOperations-HashData()-方法\" class=\"headerlink\" title=\"CryptographicOperations.HashData() 方法\"></a>CryptographicOperations.HashData() 方法</h3><p>.NET 包括哈希函数和相关函数的多个静态“一次性”实现。这些 API 包括 SHA256。HashData 和 HMACSHA256。哈希数据。最好使用一次性 API,因为它们可以提供最佳性能并减少或消除分配。</p>\n<p>如果开发人员想要提供支持哈希的 API,其中调用方定义要使用的哈希算法,则通常通过接受 HashAlgorithmName 参数来完成。但是,将该模式与一次性 API 一起使用需要切换每个可能的 HashAlgorithmName,然后使用适当的方法。为了解决此问题,.NET 9 引入了 CryptographicOperations.HashData API。此 API 允许您一次性生成输入的哈希或 HMAC,其中使用的算法由 HashAlgorithmName 确定。</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"function\"><span class=\"keyword\">static</span> <span class=\"keyword\">void</span> <span class=\"title\">HashAndProcessData</span>(<span class=\"params\">HashAlgorithmName hashAlgorithmName, <span class=\"built_in\">byte</span>[] data</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] hash = CryptographicOperations.HashData(hashAlgorithmName, data);</span><br><span class=\"line\"> ProcessHash(hash);</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure>\n\n\n<h3 id=\"KMAC算法\"><a href=\"#KMAC算法\" class=\"headerlink\" title=\"KMAC算法\"></a>KMAC算法</h3><p>.NET 9 提供 NIST SP-800-185指定的 KMAC 算法。KECCAK 消息验证码 (KMAC) 是一个基于 KECCAK 的伪随机函数和键控哈希函数。</p>\n<p>以下新类使用 KMAC 算法。使用实例累积数据以生成 MAC,或使用静态方法对单个输入进行一次性处理。<code>HashData</code></p>\n<ul>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac128\" >KMAC128型 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmac256\" >KMAC256型 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof128\" >KmacXof128 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n<li><a class=\"link\" href=\"https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.kmacxof256\" >KmacXof256 <i class=\"fa-regular fa-arrow-up-right-from-square fa-sm\"></i></a></li>\n</ul>\n<p>KMAC 在具有 OpenSSL 3.0 或更高版本的 Linux 以及 Windows 11 Build 26016 或更高版本上可用。可以使用 static 属性来确定平台是否支持所需的算法。<code>IsSupported</code></p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">if</span> (Kmac128.IsSupported)</span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] key = GetKmacKey();</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] input = GetInputToMac();</span><br><span class=\"line\"> <span class=\"built_in\">byte</span>[] mac = Kmac128.HashData(key, input, outputLength: <span class=\"number\">32</span>);</span><br><span class=\"line\">}</span><br><span class=\"line\"><span class=\"keyword\">else</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> <span class=\"comment\">// Handle scenario where KMAC isn't available.</span></span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"反射\"><a href=\"#反射\" class=\"headerlink\" title=\"反射\"></a>反射</h2><p>在 .NET Core 版本和 .NET 5-8 中,对生成程序集和为动态创建的类型发出反射元数据的支持仅限于可运行的 AssemblyBuilder。缺乏对_保存_程序集的支持通常是客户从 .NET Framework 迁移到 .NET 的障碍。.NET 9 将公共 API 添加到 AssemblyBuilder以保存发出的程序集。</p>\n<p>新的持久化 AssemblyBuilder</p>\n<figure class=\"highlight c#\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"function\"><span class=\"keyword\">public</span> <span class=\"keyword\">void</span> <span class=\"title\">CreateAndSaveAssembly</span>(<span class=\"params\"><span class=\"built_in\">string</span> assemblyPath</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> AssemblyBuilder ab = AssemblyBuilder.DefinePersistedAssembly(</span><br><span class=\"line\"> <span class=\"keyword\">new</span> AssemblyName(<span class=\"string\">"MyAssembly"</span>),</span><br><span class=\"line\"> <span class=\"keyword\">typeof</span>(<span class=\"built_in\">object</span>).Assembly</span><br><span class=\"line\"> );</span><br><span class=\"line\"> TypeBuilder tb = ab.DefineDynamicModule(<span class=\"string\">"MyModule"</span>)</span><br><span class=\"line\"> .DefineType(<span class=\"string\">"MyType"</span>, TypeAttributes.Public | TypeAttributes.Class);</span><br><span class=\"line\"></span><br><span class=\"line\"> MethodBuilder mb = tb.DefineMethod(</span><br><span class=\"line\"> <span class=\"string\">"SumMethod"</span>,</span><br><span class=\"line\"> MethodAttributes.Public | MethodAttributes.Static,</span><br><span class=\"line\"> <span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>), [<span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>), <span class=\"keyword\">typeof</span>(<span class=\"built_in\">int</span>)]</span><br><span class=\"line\"> );</span><br><span class=\"line\"> ILGenerator il = mb.GetILGenerator();</span><br><span class=\"line\"> il.Emit(OpCodes.Ldarg_0);</span><br><span class=\"line\"> il.Emit(OpCodes.Ldarg_1);</span><br><span class=\"line\"> il.Emit(OpCodes.Add);</span><br><span class=\"line\"> il.Emit(OpCodes.Ret);</span><br><span class=\"line\"></span><br><span class=\"line\"> tb.CreateType();</span><br><span class=\"line\"> ab.Save(assemblyPath); <span class=\"comment\">// or could save to a Stream</span></span><br><span class=\"line\">}</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"function\"><span class=\"keyword\">public</span> <span class=\"keyword\">void</span> <span class=\"title\">UseAssembly</span>(<span class=\"params\"><span class=\"built_in\">string</span> assemblyPath</span>)</span></span><br><span class=\"line\">{</span><br><span class=\"line\"> Assembly assembly = Assembly.LoadFrom(assemblyPath);</span><br><span class=\"line\"> Type type = assembly.GetType(<span class=\"string\">"MyType"</span>);</span><br><span class=\"line\"> MethodInfo method = type.GetMethod(<span class=\"string\">"SumMethod"</span>);</span><br><span class=\"line\"> Console.WriteLine(method.Invoke(<span class=\"literal\">null</span>, [<span class=\"number\">5</span>, <span class=\"number\">10</span>]));</span><br><span class=\"line\">}</span><br></pre></td></tr></table></figure>"}],"PostAsset":[],"PostCategory":[{"post_id":"clsh6eim300000gczbehcd345","category_id":"clsilewm0000f40czhfre1ms3","_id":"clsilewm0000g40czciqqhgpl"},{"post_id":"clsjmshs50000locz6we83dkm","category_id":"clsjmshs80001locz31ad87ie","_id":"clsjmshsa0004loczgrxo8t01"},{"post_id":"clsjmub7a0005loczgrp91e1u","category_id":"clsjmshs80001locz31ad87ie","_id":"clsjmvbgy0007locz6rroacgp"},{"post_id":"clsjmyqrl0000e8czah6h6xt8","category_id":"clsjmshs80001locz31ad87ie","_id":"clsjmze6m0002e8czcqwm0gkj"},{"post_id":"clsvap2ab00000ocz50dk0r3m","category_id":"clsvap2ad00010oczd1avajad","_id":"clsvap2ad00040oczftjk6eqf"}],"PostTag":[{"post_id":"clsh6eim300000gczbehcd345","tag_id":"clsilfk7t000i40cz9qla6x91","_id":"clsilfk7u000l40cz945l6efy"},{"post_id":"clsjmshs50000locz6we83dkm","tag_id":"clsjmshs90002loczahnegw1s","_id":"clsjmshsa0003loczechn29zy"},{"post_id":"clsjmub7a0005loczgrp91e1u","tag_id":"clsjmvnxr0008loczb87w3l60","_id":"clsjmvnxs000alocz93tqh94n"},{"post_id":"clsjmub7a0005loczgrp91e1u","tag_id":"clsjmvnxs0009loczdxvl1tug","_id":"clsjmvnxs000bloczhmx27nlb"},{"post_id":"clsjmyqrl0000e8czah6h6xt8","tag_id":"clsjmze6l0001e8cz7fbk1i9d","_id":"clsjmze6m0004e8cz6pp48mit"},{"post_id":"clsjmyqrl0000e8czah6h6xt8","tag_id":"clsjmze6m0003e8czc4w2f3qz","_id":"clsjmze6m0005e8czg9oa8vjr"},{"post_id":"clsh6eim300000gczbehcd345","tag_id":"clsn0m69r0000x8czajlh5kqy","_id":"clsn0m69t0003x8cz6j4jc8f0"},{"post_id":"clsh6eim300000gczbehcd345","tag_id":"clsn0m69t0001x8cz2dti0u6q","_id":"clsn0m69t0004x8czgt4q4gt6"},{"post_id":"clsh6eim300000gczbehcd345","tag_id":"clsn0m69t0002x8cz34fe2925","_id":"clsn0m69t0005x8cz4l2y8rdu"},{"post_id":"clsvap2ab00000ocz50dk0r3m","tag_id":"clsvap2ad00020ocz1qjl15jc","_id":"clsvap2ae00050ocz24f11ysg"},{"post_id":"clsvap2ab00000ocz50dk0r3m","tag_id":"clsvap2ad00030ocz36eb1j83","_id":"clsvap2ae00060ocz50obgz1l"}],"Tag":[{"name":"Design Insights","_id":"clsiledq1000440cz1bslf1s4"},{"name":"Creative Tools","_id":"clsiledq1000540cz6j4688m7"},{"name":"Web Development","_id":"clsiledq2000740czhnas7cqa"},{"name":"Graphic Design","_id":"clsiledq2000840cz6m5d1ja2"},{"name":"Markdown","_id":"clsiledq2000940cz9bvc55bz"},{"name":"Hexo教程","_id":"clsilfk7t000h40cz7kf60sit"},{"name":"github","_id":"clsilfk7t000i40cz9qla6x91"},{"name":"网站部署","_id":"clsilfk7t000j40cz8o9q4mlz"},{"name":"docker","_id":"clsjmshs90002loczahnegw1s"},{"name":"Linux","_id":"clsjmvnxr0008loczb87w3l60"},{"name":"Ubuntu","_id":"clsjmvnxs0009loczdxvl1tug"},{"name":"windows","_id":"clsjmze6l0001e8cz7fbk1i9d"},{"name":"windows11","_id":"clsjmze6m0003e8czc4w2f3qz"},{"name":"网站搭建","_id":"clsn0m69r0000x8czajlh5kqy"},{"name":"Hexo","_id":"clsn0m69t0001x8cz2dti0u6q"},{"name":"CDN","_id":"clsn0m69t0002x8cz34fe2925"},{"name":"C#","_id":"clsvap2ad00020ocz1qjl15jc"},{"name":".NET9","_id":"clsvap2ad00030ocz36eb1j83"}]}}