【CentOS基础篇】之编译安装dropbear

dropbear是一个基于SSH服务的软件,是ssh服务的另一种实现,是一个开源软件,系统占用比较小。因为yum仓库里没有dropbear,我们可以用编译安装的方式安装dropbear。
安装dropbear之前,先确认开发包组Development Tools已经安装!

第一步:下载dropbear,推荐网址https://matt.ucc.asn.au/dropbear/
【CentOS基础篇】之编译安装dropbear_第1张图片

由此可以看出最新版的dropbear为dropbear-2017.75.tar,点击下载,保存

第二步:利用rz命令上传至linux服务器并解压
[root@c6 app]#rz
[root@c6 app]#ll
total 1608
-rw-r--r--  1 root root 1623392 Sep 12 14:21 dropbear-2017.75.tar.bz2
drwx------. 2 root root   16384 Sep  9 20:21 lost+found
-rw-------  1 root root    3879 Sep 12 09:59 sshd_config
[root@c6 app]#tar xvf dropbear-2017.75.tar.bz2 
dropbear-2017.75/
dropbear-2017.75/.hg_archival.txt
dropbear-2017.75/.hgsigs
dropbear-2017.75/.travis.yml
......
[root@c6 app]#ll
total 1612
drwx------  5  501 games    4096 May 18 22:47 dropbear-2017.75
-rw-r--r--  1 root root  1623392 Sep 12 14:21 dropbear-2017.75.tar.bz2
drwx------. 2 root root    16384 Sep  9 20:21 lost+found
第三步:进入解压后的文件夹,查看软件说明和安装信息
[root@c6 app]#cd dropbear-2017.75

[root@c6 dropbear-2017.75]#cat README 
This is Dropbear, a smallish SSH server and client.
https://matt.ucc.asn.au/dropbear/dropbear.html
INSTALL has compilation instructions.
MULTI has instructions on making a multi-purpose binary (ie a single binary
which performs multiple tasks, to save disk space)
SMALL has some tips on creating small binaries.
See TODO for a few of the things I know need looking at, and please contact
me if you have any questions/bugs found/features/ideas/comments etc :)
Matt Johnston
[email protected]
......
[root@c6 dropbear-2017.75]#cat INSTALL 
Basic Dropbear build instructions:
- Edit options.h to set which features you want.
- Edit debug.h if you want any debug options (not usually required).
(If using a non-tarball copy, "autoconf; autoheader")
./configure      (optionally with --disable-zlib or --disable-syslog,
                  or --help for other options)
Now compile:
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
And install (/usr/local/bin is usual default):
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install
......
[root@c6 dropbear-2017.75]#./configure --help
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']
......
第四步:根据安装信息进行Make并安装
[root@c6 dropbear-2017.75]#./configure 

[root@c6 dropbear-2017.75]#make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" 
.......过程略过

[root@c6 dropbear-2017.75]#make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install
install -d /app/dropbear/sbin
install dropbear /app/dropbear/sbin
install -d /app/dropbear/share/man/man8
install -m 644 ./dropbear.8 /app/dropbear/share/man/man8/dropbear.8
install -d /app/dropbear/bin
install dbclient /app/dropbear/bin
install -d /app/dropbear/share/man/man1
if test -e dbclient.1; then install -m 644 dbclient.1 /app/dropbear/share/man/man1/dbclient.1; fi
install -d /app/dropbear/bin
install dropbearkey /app/dropbear/bin
install -d /app/dropbear/share/man/man1
if test -e dropbearkey.1; then install -m 644 dropbearkey.1 /app/dropbear/share/man/man1/dropbearkey.1; fi
install -d /app/dropbear/bin
install dropbearconvert /app/dropbear/bin
install -d /app/dropbear/share/man/man1
if test -e dropbearconvert.1; then install -m 644 dropbearconvert.1 /app/dropbear/share/man/man1/dropbearconvert.1; fi
install -d /app/dropbear/bin
install scp /app/dropbear/bin
install -d /app/dropbear/share/man/man1
if test -e scp.1; then install -m 644 scp.1 /app/dropbear/share/man/man1/scp.1; fi
创建文件夹并生成dropbear密钥
[root@c6 bin]#mkdir /etc/dropbear/
[root@c6 bin]#dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhBbozSE7+5idJGL3EXoeiA4nY3ND5BdJ6uklzMJmpqAMknCwLCV3RdC0hE8Sh+cdzYw+FAUKEFETaF+oFNAsXtRowUv7/UafRzsZDgRR+Qbw31NYLifFHoHZ5UAKKfnEjXyYN+JX/mi0t1d0wF8Qser4Lc6iaVTZYn7wOQIzjLOCKmTa1Tdd41naeiu14PQUJWLprSTGJ61axCf5otehzXmpfVXZBynOu0LqArxpDBuQUzpyAQsCtNDK/+O2bHy9FVT+M17SRsb+etrA3ogj+JF5+qgi7GPk3qhqk6WOqfDyJJ7YKyhYcfZFarep7wYhAWg+TEMZgOdpIbhyObA4n root@c6
Fingerprint: md5 11:d2:c2:18:8a:98:ae:9f:71:ca:d2:c9:62:8b:84:c5
指定端口,关闭防火墙,并用其他机器远程登录
[root@c6 sbin]#dropbear -E -p 2222
[9532] Sep 12 13:07:54 Failed loading /etc/dropbear/dropbear_dss_host_key
[9532] Sep 12 13:07:54 Failed loading /etc/dropbear/dropbear_ecdsa_host_key
[9533] Sep 12 13:07:54 Running in background

[root@c7 ~]#ssh 192.168.10.133 -p 2222
The authenticity of host '[192.168.10.133]:2222 ([192.168.10.133]:2222)' can't be established.
RSA key fingerprint is 11:d2:c2:18:8a:98:ae:9f:71:ca:d2:c9:62:8b:84:c5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.10.133]:2222' (RSA) to the list of known hosts.
[email protected]'s password: 
[root@c6 ~]#
删除dropbear
[root@c6 sbin]#rm -rf /usr/local/sbin/
[root@c6 sbin]#rm -rf /usr/local/bin/
[root@c6 sbin]#rm -rf /etc/dropbear/

你可能感兴趣的:(【CentOS基础篇】之编译安装dropbear)