目 录CONTENT

文章目录

debian12 安装后一些简单设置

华灯
2024-05-08 / 0 评论 / 0 点赞 / 51 阅读 / 13219 字

1.修改SSH远程登录

安装vim编辑器(非root账户登录 前面加上sudo,下同)

apt-get install vim       #安装vim编辑器  
apt-get install vim-gtk   #如果需要Vim复制粘贴到系统剪贴板
vi /etc/ssh/sshd_config  #编辑ssh文件

或者使用自带的nano编辑器

nano /etc/ssh/sshd_config

查找添加:

PermitRootLogin yes
PasswordAuthentication yes

_20231007180254.md.png

保存退出

重启SSH服务(非root用户前面添加sudo):
/etc/init.d/ssh restart
或
systemctl restart sshd

就可以使用SSH工具远程连接了

2.换源

2.1 备份当前镜像源

cp /etc/apt/sources.list /etc/apt/sources.list.bak

2.2 修改当前镜像源

编辑sources.list

vim /etc/apt/sources.list

或者使用自带的nano编辑器

nano /etc/apt/sources.list

按键盘 i键进入编辑模式 把自带源的前面都加上 # 注销掉
删除光盘来源
下面提供几个镜像站的源,选择一个喜欢的复制到sources.list ,个人选择中科大的源

阿里云镜像站
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
腾讯云镜像站
deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian-security/ bookworm-security main
deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main
deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
网易镜像站
deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian-security/ bookworm-security main
deb-src https://mirrors.163.com/debian-security/ bookworm-security main
deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib
华为镜像站
deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
清华大学镜像站
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
中科大镜像站
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware

按一下 ESC退出编辑模式,输入 :wq 保存退出。

如果用的nano编辑器 按下ctrl+O保存,ctrl+X退出。

微信截图_20231007173004

2.3 输入更新命令 完成

apt update              # 更新软件信息数据库
apt upgrade             # 更新当前系统已经安装了的软件到最新版本
apt-cache search        # 搜索软件包

2.4 安装删除软件包 softname

apt-get install  softname        #安装软件

apt-get remove softname          # 删除软件包,但是不删除软件的配置文件

apt-get remove --purge softname  #删除软件包,并删除相应的配置文件,删除依赖

可以用 softname -V来检查是否卸载完成

如果是下载的deb软件包, 则用下面命令安装

dpkg -i xxx.deb             #安装deb软件包

dpkg -r xxx.deb             #删除软件包

dpkg --purge xxx.deb        #连同配置文件一起删除

dpkg -info xxx.deb          #查看软件包信息

dpkg -L xxx.deb             #查看文件拷贝详情

dpkg -l xxx.deb             #查看系统中已安装软件包信息

dpkg -l                     #列出当前已安装的包

dpkg –unpack xxx.deb        #解开软件包

dpkg -c xxx.deb             #列出deb包的内容

dpkg –confiugre xxx.deb     #重新配置和释放软件包

此处以安装curl 和 vim举例

apt install curl -y

apt install vim -y

_20231007173148.md.png

234520231007175248.md.png

3 安装docker

3.1 在线安装

使用官方安装脚本自动安装

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh

微信截图_20231007173459

验证一下版本号

_20231007173528.md.png

跑个helloword测试一下

_20231007173840.md.png

3.2 离线安装docker

第一步:将所有用到的安装包上传到同一个目录,方便执行安装命令,一共有七个dep安装包

链接:https://pan.baidu.com/s/1iEAVy3gFTJcVpHOWQ4ms3g
提取码:test

第二步:安装顺序containerd.io --> docker-ce-cli --> libip6tc2 --> libnfnetlink0 --> libnetfilter-conntrack3 --> iptables --> docker-ce

第三步:执行安装命令 dpkg -i ***.dep(***为安装包名称)

第四步:执行docker info确认是否安装成功

第五步:执行systemctl status docker 查看docker是否启动,active为running,否则执行systemctl start docker 启动docker

第六步:查看docker是否开启自启。执行systemctl is-enabled docker 结果为enable ,否则执行systemctl enable docker设置开机自启

温馨提示:vmware安装debian12后 root用户无法ssh连接,编辑sshd_config文件/etc/ssh/sshd_config ,放开PermitRootLogin 和PermitRootLogin 注释并且将后置参数改为yes ,修改完成后执行service sshd restart重启即可

4 安装各种面板

4.1 安装1panel (轻量级宝塔面板,对docker更友好)

GitHub release 链接: https://github.com/1Panel-dev/1Panel/releases

RedHat / CentOS

curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sh quick_start.sh

Ubuntu

curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh

Debian

curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh

1Panel 默认内置了命令行运维工具 1pctl,通过执行 1pctl help,可以查看相关的命令说明。

比如卸载

1pctl uninstall

Usage:
  1pctl [COMMAND] [ARGS...]
  1pctl --help

Commands:
  status              查看 1Panel 服务运行状态
  start               启动 1Panel 服务
  stop                停止 1Panel 服务
  restart             重启 1Panel 服务
  uninstall           卸载 1Panel 服务
  user-info           获取 1Panel 用户信息
  version             查看 1Panel 版本信息
  reset               重置 1Panel 系统信息

重置 1Panel 系统信息,包括取消安全入口登录,取消两步验证等

Usage:
  1pctl reset [COMMAND] [ARGS...]
  1pctl reset --help

Commands:
  domain              取消 1Panel 访问域名绑定
  entrance            取消 1Panel 安全入口
  https               取消 1Panel https 方式登录
  ips                 取消 1Panel 授权 IP 限制
  mfa                 取消 1Panel 两步验证

应用商店相关命令,包括初始化应用等

Usage:
  1panel app [COMMAND] [ARGS...]
  1panel app --help

Commands:
  init                初始化应用

创建应用名为 app_name,版本为 v1.0.0 的应用,命令如下:

1panel app init -k app_name -v v1.0.0

4.2 安装宝塔面板

Centos安装脚本

yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec

Ubuntu/Deepin安装脚本

wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec

Debian安装脚本

wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh ed8484bec

万能安装脚本

if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ed8484bec

国产龙芯架构安装脚本(其他CPU请勿使用)

wget -O install_panel.sh https://download.bt.cn/install/0/loongarch64/loongarch64_install_panel.sh && bash install_panel.sh ed8484bec

安装后 ssh输入 bt 可以调出服务

卸载宝塔:

systemctl stop bt                       #先停止

wget http://download.bt.cn/install/bt-uninstall.sh
sh bt-uninstall.sh

4.3 安装 老子面板mdserver-web

大神复刻的一款操作界面与宝塔面板一模一样的面板,并且是开源、免费、支持作者自制的插件,这款代替品叫做“老子面板”(开源地址:https://github.com/midoks/mdserver-web)

安装命令

curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash

面板的版本手动更新命令

curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash

卸载面板的命令

wget --no-check-certificate -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh && bash uninstall.sh

4.4 安装CasaOS

CasaOS是一个基于Docker生态系统的开源家庭云系统

安装:

wget -qO- https://get.casaos.io | sudo bash  # 两条命令二选一
curl -fsSL https://get.casaos.io | sudo bash # 两条命令二选一

卸载

casaos-uninstall
0

评论区