首页
斐讯设备
疯言疯语
系统运维
编程语言
网站建设
友情连接
推荐
autojs
Search
1
charles破解注册码(含windows和mac)最新安装教程「亲测有效」
39 阅读
2
【omv5安装教程二】N1盒子Armbian系统下,一条命令搞定Openmediavault(OMV5)安装
18 阅读
3
【N1安装飞牛优化四】关闭不必要服务优化记录
12 阅读
4
博客简介
11 阅读
5
SSH如何访问fe80开头的ipv6????
11 阅读
登录
Search
标签搜索
JAVA
JAVA学习系列
docker
Linux
js
N1
git
模块二
端口
模块一
模块五
模块九
数据库
模块四
镜像
模块三
模块六
MySQL
百度网盘
nginx
DaiMaFengZi
累计撰写
588
篇文章
累计收到
9
条评论
首页
栏目
斐讯设备
疯言疯语
系统运维
编程语言
网站建设
页面
友情连接
推荐
autojs
搜索到
85
篇与
的结果
2023-08-23
systemd服务
前言systemd 是一个系统和服务管理器,用于在 Linux 操作系统中启动、停止和管理系统进程和服务。它被广泛用于现代的 Linux 发行版中。以下是一些常用的 systemd 命令和示例:1.启动、停止或重启某个服务:启动服务:systemctl start 服务名 停止服务:systemctl stop 服务名 重启服务:systemctl restart 服务名例如,启动 Apache 服务:systemctl start apache22.查看服务状态:查看某个服务的状态:systemctl status 服务名 查看所有服务的状态:systemctl status例如,查看网络管理服务(NetworkManager)的状态:systemctl status NetworkManager3.设置服务开机自启动:开启服务自启动:systemctl enable 服务名 关闭服务自启动:systemctl disable 服务名例如,设置 Nginx 服务开机自启动:systemctl enable nginx4.查看服务的详细信息和配置:查看某个服务的所有信息:systemctl show 服务名 查看某个服务的具体配置文件路径:systemctl show -p FragmentPath 服务名例如,查看 MySQL 服务的详细信息:systemctl show mysql5.显示服务日志:显示某个服务的日志:journalctl -u 服务名 显示所有服务的日志:journalctl例如,显示 Syslog 服务的日志:journalctl -u syslog此外,systemd 的配置文件一般位于 /etc/systemd/ 目录下,可以根据需要修改相关配置。
2023年08月23日
0 阅读
0 评论
0 点赞
2023-08-02
qbittorrent搜索在线插件
https://raw.githubusercontent.com/khensolomon/leyts/master/yts.py https://raw.githubusercontent.com/solenskiner/search-plugins/master/nova3/engines/academictorrents.py https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/ali213.py https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/threedm.py https://raw.githubusercontent.com/lima66/Torrents_Plugin/master/btetree.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/cinecalidad.py https://raw.githubusercontent.com/davy39/qbfrench/master/cpasbien.py https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/demonoid.py https://github.com/xyauhideto/DMHY_qBittorrent_search_plugin/raw/master/dmhyorg.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/ettv.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/extratorrent.py https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/idope.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/corsaroblu.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/corsaronero.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/kickass_torrent.py https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/6074a7cccb90dfd5c81b7eaddd3138adec7f3377/engines/linuxtracker.py https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/magnetdl.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/mejor.py https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/mkvcage.py https://raw.githubusercontent.com/4chenz/pantsu-plugin/master/pantsu.py https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/master/engines/nyaapantsu.py https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/master/engines/nyaasi.py https://raw.githubusercontent.com/Pireo/hello-world/master/rockbox.py https://raw.githubusercontent.com/Pireo/hello-world/master/rutor.py https://gist.githubusercontent.com/kernc/67c939c57edb7dd057b3abf9f159598a/raw/09c0099fc8cd8bd2326e5881a8f77c2dffb8e16b/skytorrents.py https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/smallgames.py https://raw.githubusercontent.com/gitDew/qbittorrent-snowfl-search-plugin/master/snowfl.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/solotorrent.py https://raw.githubusercontent.com/phuongtailtranminh/qBittorrent-Nyaa-Search-Plugin/master/nyaa.py https://raw.githubusercontent.com/4chenz/pantsu-plugin/master/sukebei.py https://raw.githubusercontent.com/ngosang/qBittorrent-plugins/master/sumotorrent/sumotorrent.py https://raw.githubusercontent.com/ngosang/qBittorrent-plugins/master/tntvillage/tntvillage.py https://raw.githubusercontent.com/BrunoReX/qBittorrent-Search-Plugin-TokyoToshokan/master/tokyotoshokan.py https://raw.githubusercontent.com/CravateRouge/qBittorrentSearchPlugins/master/torrent9.py https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engine/master/torrentfunk.py https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/uniondht.py https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/yourbittorrent.py https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/master/engines/bakabt.py https://raw.githubusercontent.com/adrianmocan/qbittorrent_plugin_filelist.ro/master/filelist_ro/filelist.py https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/jackett.py https://raw.githubusercontent.com/Skymirrh/qBittorrent-rutracker-plugin/master/rutracker.py https://raw.githubusercontent.com/alvin1979/qbrutracker/master/qbrutracker.py https://raw.githubusercontent.com/CravateRouge/qBittorrentSearchPlugins/master/yggtorrent.py
2023年08月02日
1 阅读
0 评论
0 点赞
2023-07-19
【N1和Armbian】八、Docker安装aria2+ariang
1、拉取aria2镜像docker pull p3terx/aria2-pro:latest2、启动镜像docker run -d \ --name aria2-pro \ --restart unless-stopped \ --log-opt max-size=1m \ -e PUID=$UID \ -e PGID=$GID \ -e UMASK_SET=022 \ -e RPC_SECRET=daimafengzi \ -e RPC_PORT=6800 \ -p 6800:6800 \ -e LISTEN_PORT=6888 \ -p 6888:6888 \ -p 6888:6888/udp \ -v /mnt/H1/aria2-config:/config \ -v /mnt/H1/media:/Download \ --restart=always \ p3terx/aria2-pro3、拉取AriaNg镜像docker pull p3terx/ariang:latest4、启动镜像docker run -d \ --name AiraNg \ --log-opt max-size=1m \ --restart=always \ -p 16880:6880 \ p3terx/ariang:latest5、配置RPC(登录http://IP:16880)修改成相应数据,密钥为自己设置的 prc_password
2023年07月19日
1 阅读
0 评论
0 点赞
2023-07-18
Linux软件未完全安装带来的问题及解决方案
Linux软件未完全安装带来的问题及解决方案–E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution). _最近使用Debian搭建CS服务器,安装各种命令包遇见一些问题,一般是依赖错误、安装目录已存在其他文件(可能是同类的命令包存放相同位置导致的)环境:root@armbian:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Armbian 23.08.0-trunk lunar Release: 23.04 Codename: lunar个人遐想我遇到的问题是为python3环境安装pip3产生的报错,当时我想了一个暴力的解决方法,直接下载pip安装包本地解压安装,当时解决了这个问题 ,但是我再装别的命令包就会有以下报错:The following packages have unmet dependencies: bsdmainutils : Depends: bsdextrautils (>= 2.35.2-7) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).dpkg: error processing archive /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb (--unpack): trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3结合这篇文章大体明白了自己的问题可能就是之前装bsdmainutils命令包没装完,存在目录上的一些问题:然后使用文章中的方法步骤,找到出错的命令包位置,使用以下指令:root@fish2:~# dpkg -i --force-overwrite /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb (Reading database ... 117779 files and directories currently installed.) Preparing to unpack .../bsdextrautils_2.36-3+b1_amd64.deb ... Unpacking bsdextrautils (2.36-3+b1) ... dpkg: warning: overriding problem because --force enabled: //警告无报错 dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3 dpkg: warning: overriding problem because --force enabled: dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/look', which is also in package bash-completion 1:2.1-4.3 Setting up bsdextrautils (2.36-3+b1) ... update-alternatives: warning: alternative /usr/bin/bsd-write (part of link group write) doesn't exist; removing from list of alternatives update-alternatives: warning: /etc/alternatives/write is dangling; it will be updated with best choice update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode接着这样:root@fish2:~# apt-get install -f Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libisl22 libllvm3.9 libpciaccess0 libruby2.3 libtxc-dxtn-s2tc libzstd1 ruby-did-you-mean ruby2.3 Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 588 not upgraded. 8 not fully installed or removed. After this operation, 0 B of additional disk space will be used. apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "zh_CN.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory Processing triggers for cracklib-runtime (2.9.2-5) ... Setting up libmpfr6:amd64 (4.1.0-3) ... Setting up libzstd1:amd64 (1.4.5+dfsg-4) ... Setting up ncal (12.1.7) ... Setting up libbsd0:amd64 (0.10.0-1) ... Setting up calendar (12.1.7) ... Processing triggers for libc-bin (2.31-3) ... Setting up libmpc3:amd64 (1.2.0-1) ... Setting up libisl22:amd64 (0.22.1-1) ... Setting up bsdmainutils (12.1.7) ... Processing triggers for man-db (2.7.6.1-2) ... Processing triggers for libc-bin (2.31-3) ...然后再用apt-get install python-pip命令包 就可以了
2023年07月18日
6 阅读
0 评论
0 点赞
2023-07-18
tmpfs满了?linux中tmp空间不够怎么办
tmpfs满了?linux中tmp空间不够怎么办出现原因安装数据库时,会使用到临时目录/tmp,但是/tmp太小时会报错解决办法:需要重新分配/tmp目录大小vim /etc/fstab加入一行tmpfs /tmp tmpfs nodev,nosuid,size=2G 0 0将/tmp文件更改为2G的空间,此操作需要重启才能生效。开机后使用df -h查看/tmp目录大小为2G //若有其他大小需求可自由更改异常情况?出现问题?解决办法:在命令行中输入按步骤执行以下三步:mkdir /home/usrname/tmp export TMPDIR=/home/usrname/tmp source ~/.bashrc问题就会解决了。
2023年07月18日
1 阅读
0 评论
0 点赞
2023-07-12
Docker系列 深度使用nextcloud(一)环境部署
什么是NextCloud开源云盘经测试NextCloud、ownCloud、Seafile、Cloudreve、dzzoffice、kiftd、Onionshare,NextCloud功能性、安全性、社区活跃度条件均具备优势。服务端支持Linux,客户端支持Windows、MacOS、Linux、Android、IOS、browser;用户体验友好,用户界面美观,文档支持包括管理手册、用户手册、开发者手册;安全性维护CVE database、注重数据安全和隐私保护、支持数据存储完整性校验、数据传输保密性、数据存储保密性、用户标识和身份鉴别、双因素鉴别、单点认证、第三方认证、用户共享、群组共享、公开共享口令、访问控制、恢复已删除的文件、找回文件历史版本、安全策略配置、文件监控和日志、安全日志审计、病毒扫描等功能。正式部署NextCloud安装MySQL/MariaDB搜索mariadb数据库容器镜像docker search mariadb拉取mariadb数据库容器镜像至本地docker pull mariadb创建并启动mariadb数据库容器,正式环境需要注意自定义用户名不能够使用常见的默认用户名、口令8位以上数字、字母、特殊字符组合,使用–name参数命名为mariadb,使用–env配置数据库用户名MARIADB_USER、数据库口令MARIADB_PASSWORD、数据库root用户口令MARIADB_ROOT_PASSWORD、数据库MARIADB_DATABASE,使用–restart=always配置Docker启动服务时mariadb容器随之启动docker run -it -d --name mariadb --env MARIADB_USER=nextcloud --env MARIADB_PASSWORD=N2yg_A9SQ --env MARIADB_ROOT_PASSWORD=D57g_5QZd --env MARIADB_DATABASE=nextcloud --restart=always mariadb 安装NextCloud搜索nextcloud容器镜像docker search nextcloud拉取nextcloud容器镜像至本地docker pull nextcloud创建并启动nextcloud容器,使用–name参数命名为nextcloud,使用-p参数将nextcloud容器80端口映射至宿主机80端口,使用-p参数将nextcloud容器443端口映射至宿主机443端口,使用–link参数使正在创建的nextcloud容器网络连接至mariadb数据库容器,onlyoffice因配置时不支持使用该方式直接访问,故仍然使用端口访问的方式配置,使用–restart=always配置Docker启动服务时nextcloud容器随之启动docker run -it -d -p8800:80 -v /mnt/ydyp/nextcloud:/var/www/html --name nextcloud --link mariadb --restart=always nextcloud 初始化NextCloud默认使用HTTP的方式访问NextCloud,IP地址为宿主机IP地址,端口为宿主机8088端口http://localhost:8088正常访问nextcloud管理界面后,在该位置创建管理员账号,自定义用户名、口令,选择存储与数据库使用MySQL/MariaDB后点击安装并遵循安装指引完成安装初始化时创建管理员用户,该位置用户名、口令为手动配置http://localhost:8088 username:management password:NAyQ_29Sg配置NextCloud连接的数据库,配置数据库连接用户名、口令,该位置host因使用nextcloud容器已使用–link参数连接mariadb,可填写mariadb或填写IP地址MySQL/MariaDB username:nextcloud password:N2yg_A9SQ database:nextcloud host:mariadb点击安装-安装推荐的应用,或者点击取消可以取消安装应用,安装完成后亦可以自定义增删应用安装完成后默认进入仪表盘,使用说明参见https://docs.nextcloud.com/server/latest/user_manual/
2023年07月12日
3 阅读
0 评论
0 点赞
2023-07-12
Docker系列 搭建跨平台自动备份服务duplicati
什么是 Duplicati ?Duplicati 是一个免费的开源备份客户端,可将加密的、增量的、压缩的备份安全地存储在云存储服务和远程文件服务器上。支持 Amazon S3、IDrive e2、Backblaze (B2)、Box、Dropbox、FTP、Google Cloud 和 Drive、HubiC、MEGA、Microsoft Azure 和 OneDrive、Rackspace 云文件、OpenStack Storage (Swift)、Sia、Storj DCS、SSH (SFTP) 、WebDAV、腾讯云对象存储(COS)等!安装在群晖上以 Docker 方式安装。【注意】:强烈不建议用群晖内置的图像方式安装,因为可以选择的源目录比较有限。命令行安装用 docker cli 不仅更快捷,更能方便的指定要备份的源目录# 新建文件夹 duplicati 和 子目录 mkdir -p /volume2/docker/duplicati/{backups,config} # 进入 duplicati 目录 cd /volume2/docker/duplicati # 运行容器 docker run -d \ --restart unless-stopped \ --name=duplicati \ -p 8200:8200 \ -v $(pwd)/config:/config \ -v $(pwd)/backups:/backups \ -v </path/to/source>:/source \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Asia/Shanghai \ linuxserver/duplicati:latest # 示例(疯子是以 root 身份运行的,并且挂载目录为:root) docker run -d \ --restart unless-stopped \ --name=duplicati \ -p 8200:8200 \ -v $(pwd)/config:/config \ -v $(pwd)/backups:/backups \ -v /root:/source \ -e PUID=0 \ -e PGID=0 \ -e TZ=Asia/Shanghai \ linuxserver/duplicati:latest 关于卷的说明:文件夹装载路径说明docker/duplicati/backups/backups存储本地备份的路径docker/duplicati/config /config 存放设置文件</path/to/source> /source 要备份的文件的源路径因为 Duplicati 采用了 docker 方式部署,所以要把源目录映射到容器中,疯子中老苏把 root’ 作为了源;关于环境变量的说明可变值TZ设为 Asia/ShanghaiPUID设为 0PGID设为 0CLI_ARGSCLI 变量CLI 变量请参考官方文档:https://duplicati.readthedocs.io/en/latest/07-other-command-line-utilities/运行在浏览器中输入 http://群晖IP:8220 就能看到主界面如果你是自己一个人用,选 No ,否则就选 Yes,然后设置一个密码新建一个备份项目如果备份位置疯子的是选择 本地文件夹或磁盘当然也可以选择保存到远端,支持的协议很多疯子选了 Google Drive,备份位置指向了Google Drive测试连接 正常的话,可以进行下一步找到我们之前映射的 source设置备份计划一些常规选项,如果默认的话,文件将按 50M 分割从安全性考虑,建议采用加密到这里任务就建好了!image-1689147720061
2023年07月12日
3 阅读
0 评论
0 点赞
2023-06-26
【k8s教程二】CentOS7部署K8s集群
[blockquote2 name='洛维花']声明:本教程并不是我原创,因脑子问题,好记性不如笔记以及中途使用中出现其他问题,有个具体化的解决办法,于是便进行了搬运,并稍作更改。文章尾部带有原作者的链接。[/tip]附上原作者的录像环境准备本文服务器的公网IP:192.168.56.101OS version: CentOS 7CPU Architecture: x86_64/amd64K8s version: v1.23.17Docker version: 20.10.23安装依赖yum install -y \ curl \ wget \ systemd \ bash-completion \ lrzsz 安装前准备同步服务器时间timedatectl set-timezone Asia/Shanghai && timedatectl set-local-rtc 0 systemctl restart rsyslog systemctl restart crond修改主机名方便通过主机名访问对于的服务器# 主节点 hostnamectl set-hostname k8s-master # 从节点 hostnamectl set-hostname k8s-node1 hostnamectl set-hostname k8s-node2修改hostscat >/etc/hosts <<EOF 192. 168.56.101 k8s-master 192. 168.56.102 k8s-node1 192. 168.56.103 k8s-node2 EOF开启必要的端口必要端口文档:https://kubernetes.io/zh-cn/docs/reference/networking/ports-and-protocols/因是测试环境,直接关闭防火墙systemctl disable firewalld.service && systemctl stop firewalld.service 容器运行时转发IPv4并让iptables看到桥接流量cat >/etc/modules-load.d/k8s.conf <<EOF overlay br_netfilter EOF modprobe overlay modprobe br_netfilter cat >/etc/sysctl.d/k8s.conf <<EOF net.bridge.bridge-nf-call-iptables=1 net.bridge.bridge-nf-call-ip6tables=1 net.ipv4.ip_forward=1 EOF sysctl --system # 通过运行以下指令确认 br_netfilter 和 overlay 模块被加载 lsmod | egrep 'overlay|br_netfilter' # 通过运行以下指令确认 net.bridge.bridge-nf-call-iptables、net.bridge.bridge-nf-call-ip6tables 系统变量在你的 sysctl 配置中被设置为 1 sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward安装容器运行时[blockquote2 name='洛维花']注意:k8s v1.24及以后不在支持Docker Engine[/tip]安装Docker[blockquote2 name='洛维花']官方文档:https://docs.docker.com/engine/install/centos/[/tip]yum install -y yum-utils # 设置yum阿里云镜像 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo mkdir -p /etc/docker # 设置阿里云镜像/日志/cgroup驱动 cat >/etc/docker/daemon.json <<EOF { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ], "registry-mirrors":["https://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com"] } EOF yum makecache fast yum install -y docker-ce-20.10.23 docker-ce-cli-20.10.23 containerd.io systemctl daemon-reload systemctl enable docker && systemctl restart docker安装containerd(这个其实是另一种的容器工具,我们已经安装了docker,并不需要再安装这个了。)yum install -y yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum makecache fast yum install -y containerd.io mkdir -p /etc/containerd 生成默认文件 containerd config default > /etc/containerd/config.toml 编辑配置文件 设置驱动方式为systemd 设置pause镜像 镜像仓库的加速器 sed -i "s#SystemdCgroup = false#SystemdCgroup = true#g" /etc/containerd/config.toml sed -i "s#registry.k8s.io#registry.cn-hangzhou.aliyuncs.com/google_containers#g" /etc/containerd/config.toml sed -i "/\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]/a\ [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"]" /etc/containerd/config.toml sed -i "/\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"\]/a\ endpoint = [\"https://hub-mirror.c.163.com\",\"https://docker.mirrors.ustc.edu.cn\",\"https://registry.docker-cn.com\"]" /etc/containerd/config.toml sed -i "/endpoint = \[\"https:\/\/hub-mirror.c.163.com\",\"https:\/\/docker.mirrors.ustc.edu.cn\",\"https:\/\/registry.docker-cn.com\"]/a\ [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"registry.k8s.io\"]" /etc/containerd/config.toml sed -i "/\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"registry.k8s.io\"\]/a\ endpoint = [\"registry.cn-hangzhou.aliyuncs.com/google_containers\"]" /etc/containerd/config.toml sed -i "/endpoint = \[\"registry.cn-hangzhou.aliyuncs.com\/google_containers\"]/a\ [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"k8s.gcr.io\"]" /etc/containerd/config.toml sed -i "/\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"k8s.gcr.io\"\]/a\ endpoint = [\"registry.cn-hangzhou.aliyuncs.com/google_containers\"]" /etc/containerd/config.toml systemctl daemon-reload systemctl enable containerd && systemctl restart containerd安装k8s[blockquote2 name='洛维花']官方文档:https://kubernetes.io/zh/docs/reference/setup-tools/kubeadm/kubeadm-init/https://kubernetes.io/zh-cn/docs/reference/command-line-tools-reference/kubelet/[/tip]关闭swap分区或者禁用swap文件swapoff -a && sed -ri 's/.*swap.*/#&/' /etc/fstab关闭selinuxsetenforce 0 && sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config 安装k8s# 使用阿里云k8s源 cat >/etc/yum.repos.d/kubernetes.repo <<EOF [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=0 repo_gpgcheck=0 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF # 安装工具kubelet、kubeadm、kubectl yum install -y kubelet-1.23.17 kubeadm-1.23.17 kubectl-1.23.17 --disableexcludes=kubernetes # 设置驱动方式为systemd cat >/etc/sysconfig/kubelet <<EOF KUBELET_EXTRA_ARGS="--cgroup-driver=systemd" EOF # 设置容器运行时(仅容器运行时为containerd才需要进行以下设置,容器运行时为Docker则不需要) crictl config runtime-endpoint unix:///var/run/containerd/containerd.sock crictl config image-endpoint unix:///var/run/containerd/containerd.sock sed -i '/KUBELET_KUBEADM_ARGS/s/"$/ --container-runtime=remote --container-runtime-endpoint=unix:\/\/\/run\/containerd\/containerd.sock"/' /var/lib/kubelet/kubeadm-flags.env # kubelet开机自启 systemctl enable --now kubelet # 查看kubelet状态 systemctl status kubelet # 如果报错,查询错误信息 journalctl -xe运行k8smkdir -p /k8sdata/log/ kubeadm init \ --apiserver-advertise-address=192.168.56.101 \ --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers \ --kubernetes-version=v1.23.17 \ --service-cidr=10.96.0.0/12 \ --pod-network-cidr=10.244.0.0/16 | tee /k8sdata/log/kubeadm-init.log mkdir -p "$HOME"/.kube cp -i /etc/kubernetes/admin.conf "$HOME"/.kube/config chown "$(id -u)":"$(id -g)" "$HOME"/.kube/config提示:[blockquote2 name='洛维花']如果是搭建的服务器是主节点,则服务器至少2核2G,如果没有达到该配置但是仍想安装,则可以在kubeadm init命令行中使用–ignore-preflight-errors=CpuNum即可忽略报错。如果初始化失败,通过kubeadm reset进行重设[/tip]安装网络系统flannelmkdir -p /k8sdata/network/ wget --no-check-certificate -O /k8sdata/network/flannelkube-flannel.yml https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml kubectl create -f /k8sdata/network/flannelkube-flannel.ymlcalicomkdir -p /k8sdata/network/ wget --no-check-certificate -O /k8sdata/network/calico.yml https://docs.projectcalico.org/manifests/calico.yaml kubectl create -f /k8sdata/network/calico.ymlk8s命令行补全! grep -q kubectl "$HOME/.bashrc" && echo "source /usr/share/bash-completion/bash_completion" >>"$HOME/.bashrc" ! grep -q kubectl "$HOME/.bashrc" && echo "source >"$HOME/.bashrc" ! grep -q kubeadm "$HOME/.bashrc" && echo "source >"$HOME/.bashrc" ! grep -q crictl "$HOME/.bashrc" && echo "source >"$HOME/.bashrc" source "$HOME/.bashrc"k8s常用命令# 获取节点 kubectl get nodes -o wide # 实时查询nodes状态 watch kubectl get nodes -o wide # 获取pod kubectl get pods --all-namespaces -o wide # 查看镜像列表 kubeadm config images list # 节点加入集群 kubeadm token create --print-join-command # 描述node kubectl describe node k8s-master # 描述pod kubectl describe pod kube-flannel-ds-hs8bq --namespace=kube-flannel总结按照本教程可以部署一个可以正常运行的k8s,但本文仍存在一些待优化的地方,如在部署或者使用过程中遇到问题会在本文进行补充。视频备份{cloud title="百度网盘" type="bd" url="https://pan.baidu.com/s/1CiVD7Vn1IVxEHcqQ3iflfA?pwd=vb79" password=""/}[blockquote2 name='洛维花']原文链接:https://jonssonyan.com/2022/07/18/CentOS7%E9%83%A8%E7%BD%B2K8s%E9%9B%86%E7%BE%A4/[/tip]
2023年06月26日
1 阅读
0 评论
0 点赞
1
...
8
9
10
11