美文网首页
FreeBSD SSH

FreeBSD SSH

作者: chengchaos | 来源:发表于2020-05-30 13:43 被阅读0次
    How-To-Enable-SSH-On-FreeBSD.png

    允许SSH 访问

    编辑 /etc/rc.conf 文件

    sshd_enable = "YES"
    

    启动 sshd

    # /etc/cd.c/sshd start
    

    登录慢

    当 SSH client 连接到server后,server会向 /etc/resolv.conf 中的nameserver 请求 client 端 IP 的逆向解析,而 client 端 IP(或者是client端IP对应的域名?)在 nameserver 中不存在,所以会很慢。

    编辑 /etc/ssh/sshd_config 文件

    # vim /etc/ssh/sshd_config 
    #UseDNS yes
    UseDNS no
    :wq
    # /etc/rc.d/sshd restart
    

    JDK

    使用 pkg 安装

    # pkg search ^openjdk
    openjdk-7.251.02.1,1           Java Development Kit 7
    openjdk-jre-7.251.02.1,1       Java Development Kit 7
    openjdk11-11.0.6+10.1_1        Java Development Kit 11
    openjdk12-12.0.2+10.3_1        Java Development Kit 12
    openjdk13-13.0.2+8.1           Java Development Kit 13
    openjdk14-14+36.1              Java Development Kit 14
    openjdk8-8.242.07.1            Java Development Kit 8
    openjdk8-jre-8.242.07.1        Java Runtime Environment 8
    #  pkg install openjdk8-8.242.07.1
    Updating FreeBSD repository catalogue...
    FreeBSD repository is up to date.
    All repositories are up to date.
    The following 4 package(s) will be affected (of 0 checked):
    
    New packages to be INSTALLED:
            java-zoneinfo: 2019.b
            javavmwrapper: 2.7.5
            libinotify: 20180201_1
            openjdk8: 8.242.07.1
    
    Number of packages to be installed: 4
    
    The process will require 191 MiB more space.
    80 MiB to be downloaded.
    
    Proceed with this action? [y/N]: y
    
    # 忽略了中间的输出 ...
    
    Message from libinotify-20180201_1:
    
    --
    Libinotify functionality on FreeBSD is missing support for
    
      - detecting a file being moved into or out of a directory within the
        same filesystem
      - certain modifications to a symbolic link (rather than the
        file it points to.)
    
    in addition to the known limitations on all platforms using kqueue(2)
    where various open and close notifications are unimplemented.
    
    This means the following regression tests will fail:
    
    Directory notifications:
       IN_MOVED_FROM
       IN_MOVED_TO
    
    Open/close notifications:
       IN_OPEN
       IN_CLOSE_NOWRITE
       IN_CLOSE_WRITE
    
    Symbolic Link notifications:
       IN_DONT_FOLLOW
       IN_ATTRIB
       IN_MOVE_SELF
       IN_DELETE_SELF
    
    Kernel patches to address the missing directory and symbolic link
    notifications are available from:
    
    https://github.com/libinotify-kqueue/libinotify-kqueue/tree/master/patches
    
    You might want to consider increasing the kern.maxfiles tunable if you plan
    to use this library for applications that need to monitor activity of a lot
    of files.
    =====
    Message from openjdk8-8.242.07.1:
    
    --
    This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and
    procfs(5) mounted on /proc.
    
    If you have not done it yet, please do the following:
    
            mount -t fdescfs fdesc /dev/fd
            mount -t procfs proc /proc
    
    To make it permanent, you need the following lines in /etc/fstab:
    
            fdesc   /dev/fd         fdescfs         rw      0       0
            proc    /proc           procfs          rw      0       0
    

    OpenJDK实现需要安装几个文件系统以实现完整功能。 运行以下命令立即执行所需的安装:

    $ sudo mount -t fdescfs fdesc /dev/fd
    $ sudo mount -t procfs proc /proc
    

    为了使这种更改永久,我们必须添加这些挂载点, /etc/fstab的文件。 打开要立即编辑的文件:

    $ sudo vi /etc/fstab
    

    将以下安装信息插入到文件中:

    fdesc   /dev/fd     fdescfs     rw  0   0
    proc    /proc       procfs      rw  0   0
    

    保存并退出。

    最后,您将需要重新哈希,以确保您可以立即使用您的新Java二进制文件:

    $ rehash
    

    使用 ports 安装

    $ cd /usr/ports/java && ls -d openjdk*
    openjdk11       openjdk13       openjdk7-jre    openjdk8-jre
    openjdk12       openjdk7        openjdk8
    
    # cd  /usr/ports/java/openjdk8
    # make install clean
    

    您将看到一系列提示,要求您选择要构建Java端口及其依赖关系的选项和库。 您可以接受默认值或根据您的需要自定义。

    在您回答所有提示后,将构建并安装OpenJDK端口及其依赖项。

    这个OpenJDK实现需要安装几个文件系统以实现完整功能。 运行以下命令立即执行所需的安装:

    $ sudo mount -t fdescfs fdesc /dev/fd
    $ sudo mount -t procfs proc /proc
    

    为了使这种更改永久,我们必须添加这些挂载点, /etc/fstab的文件。 打开要立即编辑的文件:

    $ sudo vi /etc/fstab
    

    将以下安装信息插入到文件中:

    fdesc   /dev/fd     fdescfs     rw  0   0
    proc    /proc       procfs      rw  0   0
    

    保存并退出。

    最后,您将需要重新哈希,以确保您可以立即使用您的新Java二进制文件:

    $ rehash
    

    您选择的OpenJDK端口现在已安装并准备使用!

    参考:

    https://www.ostechnix.com/how-to-enable-ssh-on-freebsd/
    https://www.howtoing.com/how-to-install-java-on-freebsd-10-1/

    相关文章

      网友评论

          本文标题:FreeBSD SSH

          本文链接:https://www.haomeiwen.com/subject/vswczhtx.html