Unix运维_Tcsh脚本_编译安装OpenSSL-1.1.1g

Unix运维_Tcsh脚本_编译安装OpenSSL-1.1.1g

csh 文件是一种 Unix Shell 脚本文件,其扩展名为 .csh 或 .tcsh。和其他 Unix Shell 脚本文件一样,它可用于执行一系列的命令,包括调用其他脚本或程序等。

通常,csh 文件中包含的命令会按照脚本文件的顺序依次执行。和其他 Shell 脚本文件相比,csh 文件具有更多的功能和优势,其中一个显著的特点是支持 C-Shell 语法。

Tcsh 是 csh 的增强版,并且完全兼容 csh。它不但具有 csh 的全部功能,还具有命令行编辑、拼写校正、可编程字符集、历史纪录、作业控制等功能,以及 C 语言风格的语法结构。

使用方法

  • 下载源码包:

rsync-3.2.7.tar.gz

perl-5.26.1.tar.gz

openssl-1.1.1g.tar.gz

  • 放于指定路径:

这里 Tcsh Shell 脚本的全局变量 STORAGE 指定的存放源码包的路径 /home/goufeng 可进行修改。

  • 执行 Tcsh Shell 脚本:

输入 /[路径名]/[脚本名].sh 即可进行自动编译部署,过程中提示输入 (y/n) 输入 y 则进行下一步,这样分阶段确认的原因是为了确保能够看到上一个源码编译结果中可能的错误和提示。

完整脚本

#! /bin/tcsh
# Create By GF 2023-05-27 23:16

# --------------------------------------------------
# Install First: 
# * None

# --------------------------------------------------
# FreeBSD Prepare First: 
# * Create User (Command: adduser / username: rsync / Login group: rsync / Shell: nologin / Home directory: /nonexistent)

# ------------------ rsync-3.2.7 -------------------
# Need File: rsync-3.2.7.tar.gz
# ------------------- Dependency -------------------
# Need File: perl-5.26.1.tar.gz 
# ------------------ GNU-Make-4.3 ------------------
# Need File: openssl-1.1.1g.tar.gz

# ==================================================
set STORAGE = /home/goufeng

# ########################################################################################################################################################################################################
# ############################################################################################# rsync-3.2.7 ##############################################################################################

# ====================================================================================================
# =================================== Compile Install rsync-3.2.7 ====================================

# --------------------------------------------------
# For security reasons, running the rsync server as an unprivileged user and group is encouraged.
# 出于安全考虑, 建议以无特权用户和组的身份运行 rsync 服务器。

# --------------------------------------------------
# Configuring rsync
# ..................................................
# Config Files: /etc/rsyncd.conf
# ..................................................
# Configuration Information:
#
# For client access to remote files, you may need to install the OpenSSH-9.4p1 package to connect to the remote server.
# 对于客户端访问远程文件, 您可能需要安装 OpenSSH-9.4p1 软件包才能连接到远程服务器。
#
# This is a simple download-only configuration to set up running rsync as a server. See the rsyncd.conf(5) man-page for additional options (i.e., user authentication).
# 这是一个简单的仅下载配置, 用于设置作为服务器运行的 rsync。有关其他选项 (即用户身份验证), 请参阅 rsyncd.conf(5) 手册页。
#
#    cat > /etc/rsyncd.conf << "EOF"
#    # This is a basic rsync configuration file
#    # It exports a single module without user authentication.
#    
#    motd file = /home/rsync/welcome.msg
#    use chroot = yes
#    
#    [localhost]
#        path = /home/rsync
#        comment = Default rsync module
#        read only = yes
#        list = yes
#        uid = rsyncd
#        gid = rsyncd
#    
#    EOF
# You can find additional configuration information and general documentation about rsync at https://rsync.samba.org/documentation.html.
# 您可以在以下位置找到有关 rsync 的其他配置信息和常规文档: https://rsync.samba.org/documentation.html。

if ( ! -d "/opt/rsync-3.2.7" ) then

    set VERIFY = "NULL"
    set STEP_UNZIPPED = 0
    set STEP_CONFIGURED = 0
    set STEP_MADE = 0
    set STEP_INSTALLED = 0

    # ----------------------------------------------
    echo "[Confirm] Compile and Install ( rsync-3.2.7 )? (y/n)"
    # ..............................................
    set VERIFY = $<
    # ..............................................
    if ( $VERIFY != "y" ) exit 1

    # ----------------------------------------------
    tar -zxvf $STORAGE/rsync-3.2.7.tar.gz && set STEP_UNZIPPED = 1
    
    # ----------------------------------------------
    # Default Configure Options:
    #     ./configure --prefix=/usr \
    #                 --disable-lz4 \
    #                 --disable-xxhash \
    #                 --without-included-zlib
    # ..............................................
    # *  Option: --disable-lz4: This switch disables LZ4 compression support. Note that it uses the superior 'zstd' algorithm when this switch is in use, and zstd is provided in LFS.
    #                           此选项禁用 lz4 压缩支持。请注意, 当使用此开关时, 它使用了高级的 "zstd" 算法, 并且 zstd 是在 LFS 中提供的。
    # ..............................................
    # *  Option: --disable-xxhash: This switch disables advanced xxhash checksum support. Remove this switch if you have installed xxhash.
    #                              此选项禁用高级 xxhash 校验和支持。如果已安装 xxhash, 请移除此选项。
    # ..............................................
    # *  Option: --without-included-zlib: This switch enables compilation with the system-installed zlib library.
    #                                     此选项允许使用系统安装的 zlib 库进行编译。
    # ..............................................
    cd $STORAGE/rsync-3.2.7 && ./configure --prefix=/opt/rsync-3.2.7 \
                                           --disable-lz4 \
                                           --disable-xxhash \
                                           --without-included-zlib && \
                                           set STEP_CONFIGURED = 1
    
    # ----------------------------------------------
    make && STEP_MADE = 1
    
    # ----------------------------------------------
    # If you have Doxygen-1.9.7 installed and wish to build HTML API documentation, issue:
    # 如果您安装了 Doxygen-1.9.7 并希望构建 HTML API 文档, 请使用指令:
    #     doxygen
    
    # ----------------------------------------------
    make install && set STEP_INSTALLED = 1
    
    # ----------------------------------------------
    # If you built the documentation, install it using the following commands as the root user:
    # 如果您构建了文档, 请以 root 用户身份使用以下命令进行安装:
    #     install -v -m755 -d          /usr/share/doc/rsync-3.2.7/api &&
    #     install -v -m644 dox/html/*  /usr/share/doc/rsync-3.2.7/api
     
    # ----------------------------------------------
    if ( $STEP_INSTALLED == 1 && ! -f "/bin/rsync" && ! -f "/usr/bin/rsync" ) then
        ln -sf /opt/rsync-3.2.7/bin/rsync /usr/local/bin/
    endif

    # ----------------------------------------------
    cd $STORAGE && rm -rf $STORAGE/rsync-3.2.7
else

    echo "[Caution] Path: ( /opt/rsync-3.2.7 ) Already Exists."
endif

# ########################################################################################################################################################################################################
# ############################################################################################## Dependency ##############################################################################################

# ====================================================================================================
# =================================== Compile Install perl-5.26.1 ====================================

if ( ! -d "/opt/perl-5.26.1" ) then

    set VERIFY = "NULL"
    set STEP_UNZIPPED = 0
    set STEP_CONFIGURED = 0
    set STEP_INSTALLED = 0

    # ----------------------------------------------
    echo "[Confirm] Compile and Install ( perl-5.26.1 )? (y/n)"
    # ..............................................
    set VERIFY = $<
    # ..............................................
    if ( $VERIFY != "y" ) exit 1

    # ----------------------------------------------
    tar -zxvf $STORAGE/perl-5.26.1.tar.gz && set STEP_UNZIPPED = 1
    
    # ----------------------------------------------
    cd $STORAGE/perl-5.26.1 && ./Configure -des \
                                           -Dprefix=/opt/perl-5.26.1 \
                                           -Duseshrplib && \
                                           set STEP_CONFIGURED = 1
    
    # ----------------------------------------------
    make && make install && set STEP_INSTALLED = 1
     
    # ----------------------------------------------
    if ( $STEP_INSTALLED == 1 ) then
        ln -sf /opt/perl-5.26.1/bin/* /usr/local/bin/
        # ..........................................
        # Skip # rsync -av /opt/perl-5.26.1/lib/ /usr/local/lib/
    endif

    # ----------------------------------------------
    cd $STORAGE && rm -rf $STORAGE/perl-5.26.1
else

    echo "[Caution] Path: ( /opt/perl-5.26.1 ) Already Exists."
endif

# ########################################################################################################################################################################################################
# ############################################################################################ OpenSSL-1.1.1g ############################################################################################

# ====================================================================================================
# ================================== Compile Install OpenSSL-1.1.1g ==================================

if ( ! -d "/opt/openssl-1.1.1g" ) then

    set VERIFY = "NULL"
    set STEP_UNZIPPED = 0
    set STEP_CONFIGURED = 0
    set STEP_INSTALLED = 0

    # ----------------------------------------------
    echo "[Confirm] Compile and Install ( openssl-1.1.1g )? (y/n)"
    # ..............................................
    set VERIFY = $<
    # ..............................................
    if ( $VERIFY != "y" ) exit 1

    # ----------------------------------------------
    tar -zxvf $STORAGE/openssl-1.1.1g.tar.gz && set STEP_UNZIPPED = 1
    
    # ----------------------------------------------
    cd $STORAGE/openssl-1.1.1g && ./config --prefix=/opt/openssl-1.1.1g \
                                           --openssldir=/opt/openssl-1.1.1g/ssl \
                                           --shared \
                                           zlib && \
                                           STEP_CONFIGURED = 1
    
    # ----------------------------------------------
    make && make install && set STEP_INSTALLED = 1
     
    # ----------------------------------------------
    if ( $STEP_INSTALLED == 1 ) then
        if ( ! -d "/usr/local/lib" ) mkdir /usr/local/lib
        if ( ! -d "/usr/local/lib/pkgconfig" ) mkdir /usr/local/lib/pkgconfig
        # ..........................................
        ln -sf /opt/openssl-1.1.1g/bin/openssl /usr/local/bin/
        # ..........................................
        rsync -av /opt/openssl-1.1.1g/include/ /usr/local/include/
        # ..........................................
        rsync -av /opt/openssl-1.1.1g/lib/ /usr/local/lib/
        # ..........................................
        cp -f /opt/openssl-1.1.1g/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
        cp -f /opt/openssl-1.1.1g/lib/pkgconfig/libssl.pc    /usr/local/lib/pkgconfig/
        cp -f /opt/openssl-1.1.1g/lib/pkgconfig/openssl.pc   /usr/local/lib/pkgconfig/
    endif

    # ----------------------------------------------
    cd $STORAGE && rm -rf $STORAGE/openssl-1.1.1g
else

    echo "[Caution] Path: ( /opt/openssl-1.1.1g ) Already Exists."
endif

# ########################################################################################################################################################################################################
# ################################################################################################## Ends ################################################################################################

总结

以上就是关于 Unix运维 Tcsh脚本 编译安装OpenSSL-1.1.1g 的全部内容。

更多内容可以访问我的代码仓库:

https://gitee.com/goufeng928/public

https://github.com/goufeng928/public

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
### 回答1: tcsh是一种强大的Unix shell,它具有许多实用和高级命令,在Linux系统中被广泛使用。要通过包下载安装tcsh,可以按照以下步骤进行操作: 1. 打开终端:在Linux系统中,使用Ctrl + Alt + T快捷键打开终端。 2. 更新软件包列表:输入以下命令,以确保您的软件包列表是最新的: ``` sudo apt update ``` 3. 安装tcsh包:输入以下命令来安装tcsh包: ``` sudo apt install tcsh ``` 4. 输入密码:当提示时,请输入您的用户密码,并按Enter键继续。请注意,输入密码时,屏幕上不会显示任何字符。 5. 确认安装:在安装过程中,系统会显示要安装的软件包的名称和占用的磁盘空间。如果您同意安装,请输入"Y"并按Enter键。 6. 等待安装完成:系统将自动下载并安装tcsh软件包。安装过程需要一段时间,具体时间取决于您的网络速度和系统性能。 7. 安装完成:当系统显示安装成功时,表示tcsh已成功地通过包下载并安装在您的系统中。 现在,您已经成功地通过包下载并安装tcsh。您可以在终端中使用tcsh来执行各种命令和脚本,享受它提供的强大功能和便利性。 ### 回答2: tcsh是一种基于C语言的Unix shell,它可以通过包管理器进行下载和安装。 首先,我们需要选择一个适用于我们操作系统的包管理器。比如在Debian/Ubuntu上,我们可以使用APT(Advanced Package Tool)作为包管理器;在Fedora/CentOS上,我们可以使用DNF(Dandified Yum)或者Yum作为包管理器。 下面以在Debian/Ubuntu上使用APT为例,来说明如何通过包下载安装tcsh: 1. 打开终端,使用root权限或者sudo命令运行以下命令更新软件包列表: ```bash sudo apt update ``` 2. 通过以下命令搜索tcsh包: ```bash apt search tcsh ``` 3. 在搜索结果中找到tcsh包,并记录下包名和版本号。例如,假设我们找到了tcsh的包名为tcsh和版本号为6.22.02-1ubuntu1。 4. 运行以下命令安装tcsh包: ```bash sudo apt install tcsh ``` 5. 系统会提示确认安装,输入“y”并按Enter键开始安装安装过程中,系统会自动下载tcsh包及其依赖项,并进行安装安装完成后,tcsh安装在系统中了。 通过以上步骤,我们可以使用包管理器(如APT)来下载和安装tcsh。请注意,不同操作系统和包管理器可能有略微不同的命令和操作步骤,但整体原理是相似的。预安装的包管理器可以方便地维护软件包,并处理它们之间的依赖关系,从而使安装和更新过程变得简单和高效。 ### 回答3: tcsh是一种UnixUnix-like系统上常用的shell程序。要通过包来下载和安装tcsh,我们需要先确定操作系统的包管理系统。 对于Debian或Ubuntu系统,我们可以使用apt包管理器来安装tcsh。我简要介绍以下在终端中运行的命令来完成安装: 1. 打开终端。 2. 使用sudo命令以管理员权限运行以下命令:sudo apt-get update 这将更新系统的软件包列表。 3. 运行以下命令来安装tcsh:sudo apt-get install tcsh 输入密码,然后按下回车继续安装。 4. 系统会下载并安装tcsh包。安装完成后,您现在可以使用tcsh作为您的默认shell。 对于Fedora或CentOS系统,我们可以使用dnf或yum包管理器来安装tcsh。以下是安装的步骤: 1. 打开终端。 2. 使用sudo命令以管理员权限运行以下命令: sudo dnf update (对于Fedora 22及更高版本) 或 sudo yum update (对于Fedora 21或更低版本,以及CentOS) 这将更新系统的软件包列表。 3. 运行以下命令来安装tcsh:sudo dnf install tcsh (对于Fedora 22及更高版本)或 sudo yum install tcsh (对于Fedora 21或更低版本,以及CentOS) 输入密码,然后按下回车继续安装。 4. 系统会下载并安装tcsh包。安装完成后,您现在可以使用tcsh作为您的默认shell。 总结来说,要通过包下载和安装tcsh,我们需要使用系统对应的包管理器(如apt、dnf或yum),并按照相应的命令进行操作。这样,tcsh就会被下载并安装在我们的系统上,以供使用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mostcow

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值