宝塔618特惠活动,企业版999元/年,宝塔SSL证书买1送1!限时抢购!查看活动
当前位置:论坛首页 > Linux面板 > 讨论

Debian 安装的一些技巧

发表在 Linux面板2021-11-28 21:50 [复制链接] 3 2036

本帖最后由 oper1000 于 2021-11-28 21:50 编辑

第一个:分区

Linux的分区当然和Windows稍微有点不太一样。

分为主分区和逻辑分区,逻辑分区可以挂载为LVM逻辑卷,然后LVM逻辑卷下面可以分几个分区,分别挂载到不同的点。

Debian 10.x 64 位-2021-11-24-19-40-10.png

比如图上的图,虚拟机里面总共20多个G的硬盘,我分为了500多M的主分区,并挂载到 /boot ,剩下的分给了逻辑分区。

然后逻辑分区被挂载为LVM逻辑卷,再把这个逻辑卷分几个分区分别挂载到 /root ,/home ,swap ,  /tmp ,/var

这里面,swap 分区一般是内存大小的两倍。然后先分配 /root , /tmp , /var 和 swap ,分完之后剩下的全部分给 /home

具体操作大家可以仔细琢磨一下。


第二个:允许root用户SSH登录
全新安装系统后,默认情况下将禁用Debian Linux上的root登录。当您尝试以root用户身份登录Debian Jessie Linux服务器时,访问将被拒绝。

要在Debian Linux系统上为root用户启用SSH登录,您需要首先配置SSH服务器。打开/etc/ssh/sshd_config并更改以下行:

从:

  1. PermitRootLogin without-password
复制代码


改成:

  1. PermitRootLogin yes
复制代码


完成上述更改后,请重新启动SSH服务器:

  1. <div># /etc/init.d/ssh restart</div><div>[ ok ] Restarting ssh (via systemctl): ssh.service.</div>
复制代码




从现在开始,您将能够以root用户身份使用ssh登录:


使用道具 举报 只看该作者 回复
发表于 2021-11-28 21:57:14 | 显示全部楼层
本帖最后由 oper1000 于 2021-11-28 22:03 编辑

第三个:Debian下配置网络

1、查看网卡编号

运行
  1. ifconfig -a
复制代码
或者
  1. ip addr show
复制代码

下载.png
               运行 ip addr show 显示的

下载 (1).png
                    运行 ipconfig -a 显示的

上面两个图中,红框的部分就是网卡编号,具体是哪一个,需要综合判断,图里面的一般 ens33 最为可能
2、网络配置--配置网卡

运行
  1. vi /etc/network/interfaces
复制代码


修改 /etc/network/interfaces ,添加如下

# #号后面是备注,不要添加哦!
auto ens33 #开机自动激活
iface ens33 inte static #静态IP

address 192.168.0.56 #本机IP
netmask 255.255.255.0 #子网掩码
gateway 192.168.0.254 #路由网关

#因为我是通过路由上网的,所以配置为静态IP和网关


如果是用DHCP自动获取,请在配置文件里添加如下:

iface ens33 inet dhcp

提示:1、这里的 ens33 就是上面图中红框中的部分,大家根据实际情况进行代替。
           2、vi 的具体操作请自行百度。

3、设置DNS
  1. echo "nameserver 202.96.128.86" >> /etc/resolv.conf   #请设置为你当地的DNS
复制代码


4、到这里配置好以后,重启一下网卡。
  1. service network restart
复制代码



使用道具 举报 回复 支持 反对
发表于 2021-11-28 22:04:28 | 显示全部楼层
本帖最后由 oper1000 于 2021-11-28 22:05 编辑

第四:Debian apt-get 国内常用 镜像源

1.使用说明

一般情况下,修改/etc/apt/sources.list文件,将Debian的默认源地址改成新的地址即可,比如将http://deb.debian.org改成https://mirrors.163.com,可使用以下命令:

sed -i "s@http://deb.debian.org@https://mirrors.163.com@g" /etc/apt/sources.list
若要使用https源,则需要执行 apt-get install apt-transport-https,再执行 apt-get update 更新索引。

2.常用站点列表

163镜像站  

deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

中科大镜像站

deb https://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free

deb https://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free

deb https://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free

deb https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free


阿里云镜像站

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib


华为镜像站

deb https://mirrors.huaweicloud.com/debian/ stretch main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ stretch main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ stretch-updates main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ stretch-updates main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ stretch-backports main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ stretch-backports main contrib non-free

  
清华大学镜像站

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main contrib non-free


兰州大学镜像站

deb http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb http://mirror.lzu.edu.cn/debian/ stretch-backports main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian/ stretch-backports main contrib non-free
deb http://mirror.lzu.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian-security/ stretch/updates main contrib non-free


上海交大镜像站

deb https://mirror.sjtu.edu.cn/debian/ stretch main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian/ stretch main contrib non-free
deb https://mirror.sjtu.edu.cn/debian/ stretch-updates main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-updates main contrib non-free
deb https://mirror.sjtu.edu.cn/debian/ stretch-backports main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-backports main contrib non-free
deb https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main contrib non-free


最后附上官方全球镜像站列表地址https://www.debian.org/mirror/list
使用道具 举报 回复 支持 反对
发表于 2021-11-29 09:19:37 | 显示全部楼层
感谢大佬分享
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表