介紹
- 物理機(jī):win10
- 虛擬機(jī):Oracle VirtualBox 7.0.10
- linux 鏡像:
debian-12.1.0-amd64-DVD-1.iso
官方只提供最新版的下載意鲸,歷史版本在這里找:Index of /cdimage/archive (debian.org)
比如Debian11.7.0版本下載:http://cdimage.debian.org/cdimage/archive/11.7.0/amd64/iso-cd/debian-11.7.0-amd64-netinst.iso
步驟
1. 下載鏡像 .iso
-
debian-12.1.0-amd64-DVD-1.iso:
https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-12.1.0-amd64-DVD-1.iso
dvd版束昵,包大讶泰,速度慢滩褥,可以在中科大國內(nèi)鏡像網(wǎng)站下載:USTC Open Source Software Mirror
其他版本見匿又,debian官方:https://www.debian.org/
2. 在vbox中新建安裝
下一步仅淑,
下一步可训,
下一步耀鸦,
下一步,
點(diǎn)擊完成后顷扩,等待vbox安裝Debian系統(tǒng)(全自動(dòng))...
常用命令:(34條消息) debian常用命令整理_sunnyhkj的博客-CSDN博客
3. 配置更改
- 進(jìn)入管理員模式:
# 進(jìn)入管理員模式
su root
- 修改鏡像源(更換apt源拐邪。使用apt-get xxx提示你插入CD或DVD安裝。隘截。扎阶。):
# 備份原始鏡像源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 編輯
nano /etc/apt/sources.list
# 鍵入以下內(nèi)容:
# 阿里鏡像源
deb https://mirrors.aliyun.com/debian bookworm main non-free contrib
deb https://mirrors.aliyun.com/debian bookworm-updates main non-free contrib
deb https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free contrib
deb https://mirrors.aliyun.com/debian bookworm-backports main non-free contrib
deb https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free contrib
deb-src https://mirrors.aliyun.com/debian bookworm main non-free contrib
deb-src https://mirrors.aliyun.com/debian bookworm-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free contrib
# 阿里安全更新鏡像源
deb https://mirrors.aliyun.com/debian-security bookworm-security main non-free contrib
deb-src https://mirrors.aliyun.com/debian-security bookworm-security main non-free contrib
# 保存文件,更新包并升級(jí)(如果不可以婶芭,先安裝https源 apt-get install apt-transport-https ca-certificates)
apt update
apt upgrade -y
- 修改時(shí)區(qū):
timedatectl # 查看當(dāng)前時(shí)區(qū)
timedatectl list-timezones # 列舉可選時(shí)區(qū)
timedatectl set-timezone Asia/Shanghai # 設(shè)置當(dāng)前時(shí)區(qū)為Asia/Shanghai
- 安裝 firewalld:
用centos習(xí)慣了东臀,還時(shí)選擇安裝firewalld,不使用ufw犀农。
# 安裝
sudo apt-get install firewalld -y
# 查看狀態(tài)
firewall-cmd --state
# 查看默認(rèn)zone
firewall-cmd --get-default-zone
# 查看當(dāng)前使用的zone惰赋,返回網(wǎng)絡(luò)適配器,如:enp0s3
firewall-cmd --get-active-zones
# 查看public zone下允許的端口:
firewall-cmd --zone=public --list-ports
# 允許端口(tcp或udp):
firewall-cmd --zone=public --add-port=80/tcp --permanent # 單個(gè)
firewall-cmd --zone=public --add-port={80,8080}/tcp --permanent # 多個(gè)
# 拒絕端口:
firewall-cmd --zone=public --remove-port={80,8080}/tcp --permanent
# 重啟防火墻生效配置:
firewall-cmd --reload
- 安裝常用包:
# curl, ifconfig, vim, ping
apt-get install -y curl net-tools vim inetutils-ping
# ifconfig 在Debian9之后棄用呵哨,用ip addr代替赁濒;想要繼續(xù)使用ifconfig可以使用以下方法:
whereis ifconfig
alias ifconfig=/usr/sbin/ifconfig
- 安裝 ssh(用于遠(yuǎn)程連接):
* 安裝ssh
apt-get install ssh
# 查看ssh運(yùn)行進(jìn)程
ps -aux | grep ssh # ssh-agent是客戶端贵扰,sshd是服務(wù)端
# 運(yùn)行root用戶ssh連接且需要密碼
nano /etc/ssh/sshd_config
找到 # PermitRootLogin prohibit-password,去掉注釋流部,修改為:
PermitRootLogin yes
# 保存戚绕,重啟ssh:
/etc/init.d/ssh restart
或者:sudo service ssh restart
- 允許root用戶登錄(可選):
默認(rèn)debian不允許root直接登錄,我們先用自己的賬戶登進(jìn)去枝冀,然后把這個(gè)改掉舞丛。
$ su root
$ nano /etc/gdm3/daemon.conf
找到 [security],下面一行追加 AllowRoot = true果漾,保存
$ nano /etc/pam.d/gdm-password
找到 auth required pam_succeed_if.so user != root quiet_success球切,注釋本行,保存
修改完成之后绒障,點(diǎn)擊右上角電源-Log Out登出當(dāng)前用戶吨凑,然后使用root用戶登錄系統(tǒng)即可!;琛鸵钝!
到這里,基本就差不多了庐镐,接下來可以把此系統(tǒng)當(dāng)作測(cè)試服務(wù)器用了恩商。