[{"data":1,"prerenderedAt":194},["ShallowReactive",2],{"content:\u002Fposts\u002Fserver-init":3,"surround:\u002Fposts\u002Fserver-init":183},{"id":4,"title":5,"body":6,"categories":158,"date":160,"description":161,"draft":162,"extension":163,"image":164,"meta":165,"navigation":167,"path":168,"permalink":164,"pinned":162,"published":164,"readingTime":169,"recommend":164,"references":164,"seo":174,"sitemap":175,"stem":176,"tags":177,"type":181,"updated":160,"__hash__":182},"content\u002Fposts\u002Fposts\u002Fserver-init.md","服务器初始化完整配置流程",{"type":7,"value":8,"toc":147},"minimark",[9,19,22,27,38,42,45,49,55,59,69,75,79,85,92,96,105,113,117,126,132,141],[10,11,15],"alert",{"type":12,"icon":13,"title":14},"info","tabler:robot","AI 迁移提示",[16,17,18],"p",{},"本文由 AI 协助从旧站迁移，尚未完成逐篇人工审校；内容如有疏漏，将在复核后修订。",[16,20,21],{},"本文记录生产环境服务器的完整初始化配置流程，适用于新机器的快速上线。",[23,24,26],"h2",{"id":25},"_1-基础配置","1. 基础配置",[28,29,35],"pre",{"className":30,"code":32,"language":33,"meta":34},[31],"language-shell","hostnamectl set-hostname your-hostname\nvim \u002Fetc\u002Fhosts\n","shell","",[36,37,32],"code",{"__ignoreMap":34},[23,39,41],{"id":40},"_2-换源","2. 换源",[16,43,44],{},"根据发行版替换为国内镜像源（阿里云 \u002F 腾讯云 \u002F 清华 TUNA）。",[23,46,48],{"id":47},"_3-时区配置","3. 时区配置",[28,50,53],{"className":51,"code":52,"language":33,"meta":34},[31],"timedatectl set-timezone Asia\u002FShanghai\ntimedatectl status\n",[36,54,52],{"__ignoreMap":34},[23,56,58],{"id":57},"_4-安装-k8s-集群kubesphere-离线","4. 安装 K8s 集群（KubeSphere 离线）",[10,60,61],{"type":12},[16,62,63,64],{},"K8s 集群使用 Harbor 作为私有镜像仓库，安装参见：",[65,66,68],"a",{"href":67},"\u002Fposts\u002Fharbor-install","Harbor 私有镜像仓库安装指南",[28,70,73],{"className":71,"code":72,"language":33,"meta":34},[31],"apt install -y socat conntrack\n\nmkdir -p \u002Fetc\u002Fdocker\ncat > \u002Fetc\u002Fdocker\u002Fdaemon.json \u003C\u003C'EOF'\n{\n  \"log-opts\": { \"max-size\": \"5m\", \"max-file\": \"3\" },\n  \"exec-opts\": [\"native.cgroupdriver=systemd\"],\n  \"data-root\": \"\u002Fopt\u002Fdocker\"\n}\nEOF\n\n.\u002Fkk init registry -f config.yaml -a kubesphere-4.1.tar.gz\nsh create_project_harbor.sh\n.\u002Fkk artifact image push -f config.yaml -a kubesphere-4.1.tar.gz\n.\u002Fkk create cluster -f config.yaml -a kubesphere-4.1.tar.gz --with-local-storage\n\nhelm upgrade --install -n kubesphere-system --create-namespace ks-core ks-core-1.1.3.tgz \\\n  --set global.imageRegistry=harbor.local\u002Fks \\\n  --set extension.imageRegistry=harbor.local\u002Fks \\\n  --debug --wait\n",[36,74,72],{"__ignoreMap":34},[23,76,78],{"id":77},"_5-安装-minio","5. 安装 MinIO",[28,80,83],{"className":81,"code":82,"language":33,"meta":34},[31],"wget https:\u002F\u002Fdl.min.io\u002Fserver\u002Fminio\u002Frelease\u002Flinux-amd64\u002Farchive\u002Fminio.RELEASE.2025-04-22T22-12-26Z\nmkdir -p \u002Fopt\u002Fminio\nmv minio.RELEASE.2025-04-22T22-12-26Z \u002Fopt\u002Fminio\u002Fminio\nchmod +x \u002Fopt\u002Fminio\u002Fminio\nsystemctl daemon-reload\nsystemctl enable --now minio\nsystemctl status minio\n",[36,84,82],{"__ignoreMap":34},[16,86,87,88],{},"详细安装步骤参见：",[65,89,91],{"href":90},"\u002Fposts\u002Fminio-install","MinIO 安装指南",[23,93,95],{"id":94},"_6-搭建-redis-集群3-主-3-从","6. 搭建 Redis 集群（3 主 3 从）",[10,97,98],{"type":12},[16,99,100,101],{},"单机 Redis 编译安装参见：",[65,102,104],{"href":103},"\u002Fposts\u002Fcentos-redis-install","CentOS 编译安装 Redis 6.2",[28,106,111],{"className":107,"code":109,"language":110,"meta":34},[108],"language-bash","wget https:\u002F\u002Fdownload.redis.io\u002Freleases\u002Fredis-7.4.6.tar.gz\ntar -zxvf redis-7.4.6.tar.gz\napt install gcc make -y\ncd redis-7.4.6 && make && sudo make install\n\nmkdir -p \u002Fopt\u002Fredis\u002Fcluster\u002F{7001,7002}\n\n# 启动所有实例后建集群\nredis-cli --cluster create \\\n  node1:7001 node2:7001 node3:7001 \\\n  node1:7002 node2:7002 node3:7002 \\\n  --cluster-replicas 1 -a your-password\n\nredis-cli -c -h node1 -p 7001 -a your-password cluster nodes\n","bash",[36,112,109],{"__ignoreMap":34},[23,114,116],{"id":115},"_7-安装-mysql-81ubuntu","7. 安装 MySQL 8.1（Ubuntu）",[10,118,119],{"type":12},[16,120,121,122],{},"更详细的 MySQL 8.1 安装配置（含外部访问、数据目录迁移）参见：",[65,123,125],{"href":124},"\u002Fposts\u002Fubuntu-mysql-81","Ubuntu MySQL 8.1 安装指南",[28,127,130],{"className":128,"code":129,"language":33,"meta":34},[31],"wget https:\u002F\u002Fdownloads.mysql.com\u002Farchives\u002Fget\u002Fp\u002F23\u002Ffile\u002Fmysql-server_8.1.0-1ubuntu22.04_amd64.deb-bundle.tar\ntar -xf mysql-server_8.1.0-1ubuntu22.04_amd64.deb-bundle.tar\n\napt install .\u002Fmysql-common_8.1.0-*.deb \\\n  .\u002Fmysql-community-client-plugins_8.1.0-*.deb \\\n  .\u002Flibmysqlclient22_8.1.0-*.deb \\\n  .\u002Fmysql-community-client-core_8.1.0-*.deb \\\n  .\u002Fmysql-community-client_8.1.0-*.deb \\\n  .\u002Fmysql-community-server-core_8.1.0-*.deb \\\n  .\u002Fmysql-community-server_8.1.0-*.deb\n\n# 修改数据目录\nvim \u002Fetc\u002Fmysql\u002Fmysql.conf.d\u002Fmysqld.cnf\n# datadir = \u002Fopt\u002Fmysql\u002Fdata\n\nvim \u002Fetc\u002Fapparmor.d\u002Fusr.sbin.mysqld\n# 添加：\u002Fopt\u002Fmysql\u002F r,  \u002Fopt\u002Fmysql\u002F** rwk,\n\nsystemctl reload apparmor\nmkdir -p \u002Fopt\u002Fmysql && chown -R mysql:mysql \u002Fopt\u002Fmysql\n",[36,131,129],{"__ignoreMap":34},[10,133,135],{"type":134},"warning",[16,136,137,140],{},[36,138,139],{"code":139},"--initialize-insecure"," 会创建无密码的 root 账户，初始化完成后必须立即设置 root 密码。",[28,142,145],{"className":143,"code":144,"language":33,"meta":34},[31],"sudo -u mysql mysqld --initialize-insecure --user=mysql --datadir=\u002Fopt\u002Fmysql\u002Fdata\nsystemctl start mysql && systemctl enable mysql\n",[36,146,144],{"__ignoreMap":34},{"title":34,"searchDepth":148,"depth":148,"links":149},4,[150,152,153,154,155,156,157],{"id":25,"depth":151,"text":26},2,{"id":40,"depth":151,"text":41},{"id":47,"depth":151,"text":48},{"id":57,"depth":151,"text":58},{"id":77,"depth":151,"text":78},{"id":94,"depth":151,"text":95},{"id":115,"depth":151,"text":116},[159],"系统","2026-02-13","记录生产环境服务器从零开始的完整初始化流程，包括换源、时区配置、K8s 集群搭建、MinIO、Redis 集群、MySQL 单节点安装。",false,"md",null,{"slots":166},{},true,"\u002Fposts\u002Fserver-init",{"text":170,"minutes":171,"time":172,"words":173},"3 min read",2.29,137400,458,{"title":5,"description":161},{"loc":168},"posts\u002Fposts\u002Fserver-init",[178,179,180],"运维","Linux","Homelab","tech","iKiVDwB6Oo27Jr1j-ihiRpQ7hujsavhrK29QCAVwCkM",[184,189],{"title":185,"path":186,"stem":187,"date":188,"type":181,"children":-1},"数据无价：ZFS 存储池高可靠迁移与重建实战","\u002Fposts\u002Fzfs-pool-migration-reconstruction-guide","posts\u002Fposts\u002Fzfs-pool-migration-reconstruction-guide","2026-02-12",{"title":190,"path":191,"stem":192,"date":193,"type":181,"children":-1},"PVE 疑难解答与系统优化","\u002Fposts\u002Fpve-troubleshoot-optimize","posts\u002Fposts\u002Fpve-troubleshoot-optimize","2026-02-14",1788712223946]