• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Linux Shell 实现一键部署Rust1.69

武飞扬头像
CIAS
帮助1

 学新通

rust 前言

一门赋予每个人,构建可靠且高效软件能力的语言。

全世界已有数百家公司在生产环境中使用 Rust,以达到快速、跨平台、低资源占用的目的。很多著名且受欢迎的软件,例如 Firefox、 Dropbox 和 Cloudflare 都在使用 Rust。从初创公司到大型企业,从嵌入式设备到可扩展的 Web 服务,Rust 都完全合适。

download rust

rust all rust文档
download 参考

Linux 各系统下载使用参考

Red Hat Rocky Linux  Oracle Linux

AlmaLinux 

ubuntu suselinux esxi RHEL标准安装 系统安装参考 YUM参考

MobaXterm 远程连接工具

Red Hat Enterprise 9.0 文档 Kickstart 生成器
download download download download download download download 参考 参考 配置参考 download 参考 Kickstart 
版本兼容性

创建一键部署rust自动化脚本

  • 实现在线下载rust,安装rust指定目录,环境变量,删除安装包。
  • /opt/rust #安装位置
vi /rust_1.69_install.sh
  1.  
    #!/bin/bash
  2.  
    # -*- coding: utf-8 -*-
  3.  
    # Author: CIASM
  4.  
    # update 2023/05/30
  5.  
    # install source rust 1.69
  6.  
     
  7.  
    <<!
  8.  
    # rust all download
  9.  
    https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
  10.  
     
  11.  
    https://www.rust-lang.org/zh-CN/
  12.  
     
  13.  
    #Installation rust parameter
  14.  
    sh /rust-1.69.0-x86_64-unknown-linux-gnu/install.sh --help
  15.  
    Options:
  16.  
    --uninstall only uninstall from the installation prefix
  17.  
    --destdir=[<none>] set installation root
  18.  
    --prefix=[/usr/local] set installation prefix
  19.  
    --without=[<none>] comma-separated list of components to not install
  20.  
    --components=[<none>] comma-separated list of components to install
  21.  
    --list-components list available components
  22.  
    --sysconfdir=[/etc] install system configuration files
  23.  
    --bindir=[/bin] install binaries
  24.  
    --libdir=[/lib] install libraries
  25.  
    --datadir=[/share] install data
  26.  
    --mandir=[/share/man] install man pages in PATH
  27.  
    --docdir=[\<default\>] install documentation in PATH
  28.  
    --disable-ldconfig don't run ldconfig after installation (Linux only)
  29.  
    --disable-verify don't obsolete
  30.  
    --verbose run with verbose output
  31.  
    !
  32.  
     
  33.  
    install_rust (){
  34.  
     
  35.  
    if ! command -v rustc &> /dev/null
  36.  
    then
  37.  
     
  38.  
    if [ $? -eq 0 ];then
  39.  
     
  40.  
    #rust variable
  41.  
    rust_prefix=/opt/rust
  42.  
    rust_url=https://static.rust-lang.org/dist/
  43.  
    rust_gz=rust-1.69.0-x86_64-unknown-linux-gnu.tar.gz
  44.  
    rust_directory=rust-1.69.0-x86_64-unknown-linux-gnu
  45.  
    root_directory=/root
  46.  
     
  47.  
    echo "Dependent installation"
  48.  
    yum install -y wget net-tools
  49.  
     
  50.  
    echo "download rust"
  51.  
    wget -N -P $root_directory $rust_url$rust_gz
  52.  
     
  53.  
    echo "make instll rust"
  54.  
    tar -xf $root_directory/$rust_gz -C $root_directory
  55.  
    cd $root_directory/$rust_directory && sh install.sh --prefix=$rust_prefix
  56.  
     
  57.  
    echo "rust environment variable"
  58.  
    echo 'umask 022' >> ~/.bash_profile
  59.  
    echo 'export PATH=$PATH:/opt/rust/bin' >> ~/.bash_profile
  60.  
    source ~/.bash_profile
  61.  
     
  62.  
    echo "rust version chek"
  63.  
    rustc --version | awk '{print $2}'
  64.  
     
  65.  
    echo "rm rust"
  66.  
    rm -rf $root_directory/$rust_directory $root_directory/$rust_gz
  67.  
     
  68.  
    echo -e "\033[32mThe rust Install Success...\033[0m"
  69.  
    else
  70.  
    echo -e "\033[31mThe rust Install Failed...\033[0m"
  71.  
    exit 1
  72.  
    fi
  73.  
    else
  74.  
    echo -e "\033[33mThe rust Install already...\033[0m"
  75.  
    fi
  76.  
    }
  77.  
     
  78.  
    main (){
  79.  
    install_rust
  80.  
    }
  81.  
     
  82.  
    main
学新通

执行安装rust

sh /rust_1.69_install.sh

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgkjgkf