1debian11基本配置

【1debian11基本配置】逆水行舟用力撑,一篙松劲退千寻。这篇文章主要讲述1debian11基本配置相关的知识,希望能为你提供帮助。
1、Debian完整镜像下载 1、 准备工作:最小化debian系统,添加一个100g的sata硬盘,网络适配器类型选择NAT,本机可以上网

1debian11基本配置

文章图片

2、 配置好apt源,挂载光盘,修改网卡ip地址的模式为dhcp即可,查看是否获取到了ip地址
root@vss:~# ping www.baidu.com PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data. 64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=1 ttl=53 time=17.9 ms 64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=2 ttl=53 time=17.8 ms --- www.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1004ms rtt min/avg/max/mdev = 17.818/17.871/17.924/0.053 ms

3、 安装所需的组件
root@vss:~# apt install vim bash-completion net-tools -y root@vss:~# apt install aptitude -y

4、 挂载之前添加的100G硬盘
#创建文件夹 root@vss:~# mkdir /iso #查看分区挂载 root@vss:~# lsblk NAMEMAJ:MIN RMSIZE RO TYPE MOUNTPOINT sda8:0040G0 disk ├─sda18:107.8G0 part / ├─sda28:201K0 part ├─sda58:502.9G0 part /var ├─sda68:60976M0 part [SWAP] ├─sda78:70580M0 part /tmp └─sda88:80 27.8G0 part /home sdb8:160100G0 disk sr011:01 1024M0 rom #格式化分区 root@vss:~# mkfs.ext4 /dev/sdb #挂在磁盘 root@vss:~# vim /etc/fstab #在最后一行添加 /dev/sdb/isoext4defaults00 #使挂在生效 root@vss:~# mount -a #查看挂在 root@vss:~# lsblk NAMEMAJ:MIN RMSIZE RO TYPE MOUNTPOINT sda8:0040G0 disk ├─sda18:107.8G0 part / ├─sda28:201K0 part ├─sda58:502.9G0 part /var ├─sda68:60976M0 part [SWAP] ├─sda78:70580M0 part /tmp └─sda88:80 27.8G0 part /home sdb8:160100G0 disk /iso sr011:01 1024M0 rom root@vss:~#

5、 安装下载工具
#安装下载工具 root@vss:/iso# aptitude install jigdo-file -y root@vss:/iso# jigdo-litehttps://mirrors.tuna.tsinghua.edu.cn/debian-cd/11.2.0/amd64/jigdo-dlbd/debian-11.2.0-amd64-DLBD-1.jigdoJigsaw Download "lite" Copyright (C) 2001-2009|jigdo@ Richard Atterer|atterer.org Copyright (C) 2016-2019 Steve McIntyre < 93sam@debian.org> Loading settings from `/root/.jigdo-liteDownloading .jigdo file --2022-01-16 16:17:08--https://mirrors.tuna.tsinghua.edu.cn/debian-cd/11.2.0/amd64/jigdo-dlbd/debian-11.2.0-amd64-DLBD-1.jigdo Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2 Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 869555 (849K) [application/octet-stream] Saving to: ‘debian-11.2.0-amd64-DLBD-1.jigdo’debian-11.2.0-amd64-DLBD-1.jigdo100%[==================================================================> ] 849.17K815KB/sin 1.0s2022-01-16 16:17:09 (815 KB/s) - ‘debian-11.2.0-amd64-DLBD-1.jigdo’ saved [869555/869555]----------------------------------------------------------------- Images offered by `https://mirrors.tuna.tsinghua.edu.cn/debian-cd/11.2.0/amd64/jigdo-dlbd/debian-11.2.0-amd64-DLBD-1.jigdo: 1: Debian GNU/Linux 11.2.0 "Bullseye" - Official amd64 DLBD Binary-1 20211218-11:13 (20211218) (debian-11.2.0-amd64-DLBD-1.iso)Further information about `debian-11.2.0-amd64-DLBD-1.iso: Generated on Sat, 18 Dec 2021 12:55:10 +0000----------------------------------------------------------------- If you already have a previous version of the CD you are downloading, jigdo can re-use files on the old CD that are also present in the new image, and you do not need to download them again. Mount the old CD ROM and enter the path it is mounted under (e.g. `/mnt/cdrom). Alternatively, just press enter if you want to start downloading the remaining files. Files to scan:#回车 ----------------------------------------------------------------- The jigdo file refers to files stored on Debian mirrors. Please choose a Debian mirror as follows: Either enter a complete URL pointing to a mirror (in the form `ftp://ftp.debian.org/debian/), or enter any regular expression for searching through the list of mirrors: Try a two-letter country code such as `de, or a country name like `United States, or a server name like `sunsite. Debian mirror [https://mirrors.tuna.tsinghua.edu.cn/debian/]: #回车#也可以手动指定源https://mirrors.tuna.tsinghua.edu.cn/debian/

6、注意
下载好镜像大约为45G
2、配置apt源
#源配置文件 root@vss:~# vim/etc/apt/sources.list# deb cdrom:[Debian GNU/Linux 11.2.0 _Bullseye_ - Official amd64 DLBD Binary-1 20211218-11:13]/ bullseye contrib main #本地镜像源 deb cdrom:[Debian GNU/Linux 11.2.0 _Bullseye_ - Official amd64 DLBD Binary-1 20211218-11:13]/ bullseye contrib main #默认网络源 deb http://security.debian.org/debian-security bullseye-security main contrib deb-src http://security.debian.org/debian-security bullseye-security main contrib# bullseye-updates, to get updates before a point release is made; # see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports # A network mirror was not selected during install.The following entries # are provided as examples, but you should amend them as appropriate # for your mirror of choice. # # deb http://deb.debian.org/debian/ bullseye-updates main contrib # deb-src http://deb.debian.org/debian/ bullseye-updates main contrib

3、root用户,开启ssh登录
#修改34行为允许root登录 root@vss:~# vim /etc/ssh/sshd_config 34 PermitRootLogin yes #重启SSH服务生效 root@vss:~# systemctl restart ssh

4、网卡
#安装DNS包使DNS永久生效 root@vss:~# apt install resolvconf -y #网卡配置静态地址 root@vss:~# vim/etc/network/interface < ==================================================================> # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo auto ens3 iface lo inet loopbackallow-hotplug ens3 iface ens3 inet static address 10.10.70.119 netmask 255.255.255.0 gateway 10.10.70.254 dns-nameserver 192.168.1.25 < ==================================================================> #重启网卡服务 root@vss:~# systemctl restartnetworking.service #查看DNS配置 root@vss:~# cat /etc/resolv.conf nameserver 192.168.1.25 #查看IP地址 root@vss:~# ip add 1: lo: < LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: < BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:2d:de:ae brd ff:ff:ff:ff:ff:ff altname enp2s1 inet 192.168.1.25/24 brd 192.168.1.255 scope global ens33 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe2d:deae/64 scope link valid_lft forever preferred_lft forever

5、vim
#解决vim 右键进入visual模式 #右键自动粘贴 root@vss:~# vim /usr/share/vim/vim81/defaults.vim #修改79行 79set mouse=r #解决文件高亮 #修改第24行 root@vss:~# vim /etc/vim/vimrc 24 syntax on

6、开启别名
#别名配置文件 root@vss:~# vim /root/.bashrc #取消注释以下行 # You may uncomment the following lines if you want `ls to be colorized: export LS_OPTIONS=--color=auto eval "$(dircolors)" alias ls=ls $LS_OPTIONS alias ll=ls $LS_OPTIONS -l alias l=ls $LS_OPTIONS -lA# Some more alias to avoid making mistakes: alias rm=rm -i alias cp=cp -i alias mv=mv -i

7、设置时区为 亚洲/上海
#设置时区为亚洲/上海 root@vss:~# timedatectl set-timezone Asia/Shanghai #查看当前时间时区 root@vss:~# timedatectl Local time: Thu 2022-02-17 17:43:18 CST Universal time: Thu 2022-02-17 09:43:18 UTC RTC time: Thu 2022-02-17 09:43:18 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: no NTP service: active RTC in local TZ: no


    推荐阅读