debian12学习笔记

前置条件

基于debian12官网的qcow2格式文件进行操作

安装ssh

登录虚拟机后安装ssh服务端

apt install openssh-server

配置国内源

新增/etc/apt/sources.list.d/tsinghua.list
使用清华大学的源
https://www.cnblogs.com/shanhubei/p/18104430

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

扩容

系统盘只有2G,需要扩下

虚拟机虚拟介质扩容量

先在virtualbox中对系统盘扩容到10G
在这里插入图片描述
在这里插入图片描述

linux系统内部扩容

1、下载parted命令
2、扩容
参考https://blog.youkuaiyun.com/qq_45664055/article/details/137920769
parted输入后使用resizepart 命令进行扩
在这里插入图片描述

3、调整文件系统
ext4的使用resize2fs

resize2fs /dev/sda1

4、使用df -h命令查看发现已经扩容OK了

设置时区

root用户下执行

timedatectl set-timezone 'Asia/Shanghai'

编辑颜色

编辑~/.bashrc
放开以下几行的注释后重新登录即可。

 export LS_OPTIONS='--color=auto'
 eval "$(dircolors)"
 alias ls='ls $LS_OPTIONS'
 alias ll='ls $LS_OPTIONS -l'

粘贴

在ssh下vi右击鼠标会进入 insert visual模式,可以通过以下命令操作后正常右击粘贴
命令模式下输入

set mouse-=a

scp指定端口

scp -P 232 nexus-3.76.0-03-unix.tar.gz xx@127.0.0.1:~/

防火墙配置

推荐方案
‌1. 安装工具

sudo apt update
sudo apt install iptables-persistent

‌2. 保存当前规则
‌IPv4 规则‌:

sudo iptables-save > /etc/iptables/rules.v4

IPv6 规则‌(可选):

sudo ip6tables-save > /etc/iptables/rules.v6

启用持久化服务

 sudo systemctl enable netfilter-persistent

验证服务状态
sudo systemctl status netfilter-persistent
确保服务处于 active (exited) 状态。

# 此命令将当前活动的 iptables 规则保存到 /etc/iptables/rules.v4(IPv4)和 /etc/iptables/rules.v6(IPv6)‌
netfilter-persistent save

‌5. 更新规则‌
修改防火墙规则后重新保存:

sudo iptables-save > /etc/iptables/rules.v4
# 可选:sudo ip6tables-save > /etc/iptables/rules.v6
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值