1 简介

初始安装完debian 7.7.0时,需要首先配置网络及apt-get源,才能正常使用。

2 debian配置

2.1 debian 7.7.0配置网络及apt-get源
    2.1.1 配置网络-静态IP
    修改文件/etc/network/interfaces

vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

配置完成后文件信息为

# The loopback network interface
$ auto lo
$ iface lo inet loopback
#    增加如下选项
$ iface eth0 inet static
$ address 192.168.1.18
$ netmask 255.255.255.0
$ gatway 192.168.1.1

使网络配置生效

root@debian:~# ifdown eth0
root@debian:~# ifup eth0

2.1.2 配置网络-DHCP方式(访问外网)

# 修改文件/etc/network/interfaces
$ vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

配置完成后文件信息为

# The loopback network interface
$ auto lo
$ iface lo inet loopback
# 增加如下选项
$ allow-hotplug eth0
$ iface eth0 inet dhcp

使网络配置生效

root@debian:~# ifdown eth0
root@debian:~# ifup eth0

2.2 配置apt-get源

2.2.1 默认从cd介质安装

2.2.2 更改为网络源

root@debian:~# vi /etc/apt/sources.list

首先屏蔽掉本地源

# 注释掉原来的apt-get源,这个是加载光盘的源,如果需要加载光盘中的源,而不用网络上的源,请不要注释
# deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 DVD Binary-1 2014101
8-13:06]/ wheezy contrib main

然后添加列表到sources.list文件里

# 设置apt-get源为163镜像站的源
$ deb http://mirrors.163.com/debian wheezy main non-free contrib
$ deb-src http://mirrors.163.com/debian wheezy main non-free contrib
#在配置文件中增加163软件更新源。
$ deb http://mirrors.163.com/debian wheezy-updates main non-free contrib
$ deb-src http://mirrors.163.com/debian wheezy-updates main non-free contrib

#在配置文件中增加163安全软件更新源。
$ deb http://security.debian.org/ wheezy/updates main
$ deb-src http://security.debian.org/ wheezy/updates main

  PS: Debian-9.6的配置源方法 Debian-7的版本代号为 wheezy Debain-8的代号为Jessie Debian-9的版本代号为stretch,不同版本,下面的代号改为对应的英文单词即可,此处使用Debian-9的英文代号 stretch

修改配置文件/etc/apt/sources.list修改成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.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib修改成科大源:
deb http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib

2.3 更新配置

# 更新配置
root@debian:~# apt-get update
# 测试安装一个htop组件
root@debian:~# apt-get install htopReading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages: strace ltrace
The following NEW packages will be installed: htop
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 63.7 kB of archives.
After this operation, 209 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/debian/ squeeze/main htop amd64 0.8.3-1 [63.7 kB]
Fetched 63.7 kB in 0s (99.9 kB/s)
Selecting previously unselected package htop.
(Reading database ... 25847 files and directories currently installed.)
Unpacking htop (from .../htop_0.8.3-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up htop (0.8.3-1) ...# 修改网络源成功!

2.4 更新源后,第一时间安装vim

# 安装vim
$ sudo apt-get install vim

2.5 开启Debian root账户远程ssh登录(默认安装后无法正常登录)

安装完成DebianLinux后,默认无法ssh远程登录的,当你尝试登录时,会出现下面情况(目录Debian9/Debian8都是这样的)

$ ssh root@10.1.1.12
root@10.1.1.12's password:
Permission denied, please try again.
root@10.1.1.12's password:
Permission denied, please try again.
root@10.1.1.12's password:
Permission denied (publickey,password).

开启SSH远程登录,您应当配置ssh server , 使用vim打开 /etc/ssh/sshd_config ,把PermitRootLogin改为 yes

$ sudo vim /etc/ssh/sshd_config
...
# 进入sshd_config配置文件,修改PermitRootLogin参数
FROM:
PermitRootLogin without-password
TO:
PermitRootLogin yes

改完后重启ssh server

# /etc/init.d/ssh restart
[ ok ] Restarting ssh (via systemctl): ssh.service.

然后在其他机器上,使用ssh命令远程登录

$ ssh root@10.1.1.12
root@10.1.1.12's password: 
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux system 下的软件是免费自由的,各个发行版的版权声明在/usr/share/doc/*/copyrightDebian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law. 受相应法律许可,Debian GNU/Linux 是没有授权费用的

另外注意:如果您是在mac电脑上登录,记得ssh前最好加上sudo,不然可能会被本地的权限给禁止

命令演示:sudo ssh -p 22 miazzy@192.168.1.91

MacdeMacBook-Pro:~ mac$ sudo ssh -p 22 miazzy@192.168.1.91
Password:
The authenticity of host '192.168.1.91 (192.168.1.91)' can't be established.
ECDSA key fingerprint is SHA256:lSl0n+ChmDz7Ajm+20NU5ZnWFKJfHTl2vwghpenvFu0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.91' (ECDSA) to the list of known hosts.
miazzy@192.168.1.91's password:
Linux debian-stable 4.9.0-8-686-pae #1 SMP Debian 4.9.130-2 (2018-10-27) i686The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Dec  3 08:08:57 2018
miazzy@debian-stable:~$
miazzy@debian-stable:~$
miazzy@debian-stable:~$
miazzy@debian-stable:~$ 

另外附:RedHat系Linux的启用ssh方法

# 在虚拟机(Vmware Workstation)下,安装了CentOS7,现在想通过SSH工具连接虚拟机中的CentOS71、首先,要确保CentOS7安装了 openssh-server
在终端中输入
yum list installed | grep openssh-server此处显示已经安装了  openssh-server
如果又没任何输出显示表示没有安装  openssh-server 通过输入
yum install openssh-server来进行安装openssh-server2、找到了/etc/ssh/  目录下的sshd服务配置文件 sshd_config,用Vim编辑器打开将文件中,关于监听端口、监听地址前的 # 号去除
然后开启允许远程登录
最后,开启使用用户名密码来作为连接验证保存文件,退出3、开启  sshd  服务,输入
sudo service sshd start检查  sshd  服务是否已经开启,输入ps -e | grep sshd
或者输入netstat -an | grep 22  检查  22 号端口是否开启监听4、在Vmware Workstation中,查看CentOS7的属性,发现网络连接方式是采用的  NAT  方式连接的5、在Vmware Workstation中,点击编辑=》虚拟网络编辑器,进入虚拟网络编辑器,查看发现 NAT 模式的连接采用的网络适配器名称为VMnet86、在 windows 主机中,在命令行中输入ipconfig 查看主机IP,找到 VMnet8 的连接信息,此处 ip 为192.168.30.17、在CentOS中,输入ifconfig查看网络连接地址,发现CentOS的网络地址为192.168.112.1288、在CentOS中,输入ping 192.168.30.1 测试是否能连通主机,发现可以连通9、在主机中,输入 ping 192.168.112.128,测试主机是否能连通CentOS,发现连不通如果可以连得通,可以直接跳至第12 步10、在主机,打开网络配置,选择网络适配器 VMnet8 的  TCP/IPv4   的属性,进行一下网络配置要求子网掩码、默认网关均和CentOS一致,并将IP地址修改为 192.168.112.1,即保证主机的  IP  和  CentOS  的  IP  在同一网络区段中11、再在主机中,输入 ping 192.168.112.128,已经可以连接得通了12、在SSH工具(此处使用的XShell)中,新建连接,输入  CentOS   的  IP  地址、用户名、密码即可连接成功13、为了免去每次开启 CentOS 时,都要手动开启  sshd 服务,可以将 sshd 服务添加至自启动列表中,输入systemctl enable sshd.service可以通过输入systemctl list-unit-files | grep sshd,查看是否开启了sshd 服务自启动

另附:启用公钥免密登录


1.通过yum删除现有的openssh-server,然后重新安装openssh-server#yum -y remove openssh-server
#yum -y install openssh-server2.设置密钥
#
#sshd-keygen3.修改sshd_config配置文件中的PubkeyAuthentication选项,设置该选项值为yesPubkeyAuthentication yes4.启动sshd#/usr/sbin/sshdpwd5.通过其他服务器连接该container
[root@centos-cloudera-1 ~]# ssh 10.10.200.4
root@10.10.200.4's password: git@github.com:Miazzy/Demo.git模型分析
假设 A (192.168.20.59)为客户机器,B(192.168.20.60)为目标机;要达到的目的:
A机器ssh登录B机器无需输入密码;
加密方式选 rsa|dsa均可以,默认dsassh-keygen -t rsa #使用rsa加密tho二、具体操作流程单向登陆的操作过程(能满足上边的目的):
1、登录A机器
2、ssh-keygen -t [rsa|dsa],将会生成密钥文件和私钥文件 id_rsa,id_rsa.pub或id_dsa,id_dsa.pub
3、将 .pub 文件复制到B机器的 .ssh 目录, 并 cat id_dsa.pub >> ~/.ssh/authorized_keys
4、大功告成,从A机器登录B机器的目标账户,不再需要密码了;(直接运行 #ssh 192.168.20.60 )
vim
双向登陆的操作过程:1、ssh-keygen做密码验证可以使在向对方机器上ssh ,scp不用使用密码.具体方法如下:
2、两个节点都执行操作:#ssh-keygen -t rsa然后全部回车,采用默认值.3、这样生成了一对密钥,存放在用户目录的~/.ssh下。
将公钥考到对方机器的用户目录下 ,并将其复制到~/.ssh/authorized_keys中(操作命令:#cat id_dsa.pub >> ~/.ssh/authorized_keys )。4、设置文件和目录权限:设置authorized_keys权限
$ chmod 600 authorized_keys
设置.ssh目录权限
$ chmod 700 -R .ssh5、要保证.ssh和authorized_keys都只有用户自己有写权限。否则验证无效。

中文转载来源:http://blog.csdn.net/jesseyoung/article/details/41387393

配置转载来源:https://blog.csdn.net/krupzone/article/details/78957013

免密登录转载来源:https://blog.csdn.net/wh_19910525/article/details/7433164

【转载翻译】Debian配置Networking 和 apt-get 源信息 开启root远程登录权限相关推荐

  1. debian 10安装ssh依赖openssh-client版本错误的解决办法及开启ssh远程登录设置

    安装 apt-get install openssh-server出现以下情况: 下列软件包有未满足的依赖关系: openssh-server : 依赖: openssh-client 依赖: ope ...

  2. sudoers 用户权限配置_使用sudo让普通用户获取root用户的权限

    sudo 是 Linux 系统管理指令,是允许系统管理员让普通用户执行一些或者全部的 root 命令的一个工具,如 halt,reboot,su 等等.这样不仅减少了 root 用户的登录 和管理时间 ...

  3. debian基本设置以及配置XManager远程登录桌面、命令行设置、Xftp上传下载文件

    XManager是一款不错的windows连接linux的图形界面软件,以下为其配置方法: 刚刚安装好的debian的几点配置 1.打开root,(debian默认是不允许用root登录可视化界面的) ...

  4. Ubuntu 20.04 root ssh登录配置

    测试版本使用的Ubuntu 20.04,Ubuntu 16.4以上版本都可以这样配置. 最简单的方法:直接安装openssh-server,然后测试时候可以ssh登录,如果不可以,请使用下面的方法进行 ...

  5. h3c交换机配置远程管理_H3C 交换机设置本地用户和telnet远程登录配置 v7 版本...

    H3C 交换机设置本地用户和telnet远程登录配置   v7版本 一.配置远程用户密码与本地用户一致 [H3C]telnet server en //开启Telnet 服务 [H3C]local-u ...

  6. 华为交换机ssh思科交换机_如何在思科交换机上配置SSH远程登录

    1 1.本地PC连到交换机配置口 第一次配置交换机时,只能通过交换机的Console口进行本地配置,默认Console口登录到命令行界面时没有密码且拥有全部权限.要连接到交换机,你只需要在PC上装好需 ...

  7. 【转载】Debian 6安装小记

    转载自:http://unix-cd.com/vc/www/22/2011-06/18022.html 今天终于装上了 debian6,代号叫squeeze是吧?前几天的时候在Microhu's Bl ...

  8. Debian 配置RTL8723BU连接wifi网络

    0x01) 如果没有驱动,内核menuconfig 选中RTL8723BU相关的选项(在这里不赘述) 0x02) debian 安装firmware-realtek包(内核驱动会从文件系统加载并写入网 ...

  9. [转载]Ubuntu安装配置Mysql

    http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html 三种安装方式: 1. 从网上安装 sudo apt-get install m ...

最新文章

  1. ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章ce测试数据文章
  2. Redis持久化的几种方式——深入解析RDB
  3. input 标签在做动画时的bug
  4. 一文带你剖析LiteOS互斥锁Mutex源代码
  5. 程序编译过程与软件启动过程
  6. asp mysql 留言本_手把手教你设计ASP+ACCESS留言本
  7. 局域网限制网速软件_五款大学生小众有用软件,学长亲荐
  8. 关于推广个人博客的经验_博客推广
  9. HTTP Security Header Not Detected
  10. 测序深度和覆盖度(Sequencing depth and coverage)
  11. 说说如果meta标签没有写charset属性,将会如何?
  12. oracle 操作树大全,在Oracle中的树形操作
  13. Android耳机耳机,Android 耳机插拔流程源码跟踪浅析
  14. oracle xla相关,【EBS】XLA_GLT表的清理
  15. “傲慢”的飞书渴望被“白嫖”
  16. 计算机系统软件和应用软件图,样例_计算机软件及应用_IT计算机_专业资料
  17. VS 使用自带的.NET Reflector单步调试编译好的程序集(反编译),以及相关其他反编译程序介绍
  18. LZS-12升流变压器操作程序卡
  19. k8s环境搭建-集群模式
  20. C语言刷题(6)(猜名次)——“C”

热门文章

  1. Leetcode算法题(C语言)15--字符串中的第一个唯一字符
  2. 虚拟机安装Vmware-tools
  3. 【英文写作日知录 第2期】句式汇总 Sun, 04 July 2021
  4. Docker-构建/启停容器镜像及常用命令介绍
  5. OPENWRT串口收发测试详解
  6. log4j的使用 20220228
  7. 打开文件对话框控件的演示 c# 1614993940
  8. 9206-1117-课堂笔记
  9. linux-目录命令-mk dir- cd- pwd- rm dir- cp- mv- rm
  10. 安卓页面布局中android:gravity与android:layout_gravity的区别