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
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/05/30
# install source rust 1.69
<<!
# rust all download
https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
https://www.rust-lang.org/zh-CN/
#Installation rust parameter
sh /rust-1.69.0-x86_64-unknown-linux-gnu/install.sh --help
Options:
--uninstall only uninstall from the installation prefix
--destdir=[<none>] set installation root
--prefix=[/usr/local] set installation prefix
--without=[<none>] comma-separated list of components to not install
--components=[<none>] comma-separated list of components to install
--list-components list available components
--sysconfdir=[/etc] install system configuration files
--bindir=[/bin] install binaries
--libdir=[/lib] install libraries
--datadir=[/share] install data
--mandir=[/share/man] install man pages in PATH
--docdir=[\<default\>] install documentation in PATH
--disable-ldconfig don't run ldconfig after installation (Linux only)
--disable-verify don't obsolete
--verbose run with verbose output
!
install_rust (){
if ! command -v rustc &> /dev/null
then
if [ $? -eq 0 ];then
#rust variable
rust_prefix=/opt/rust
rust_url=https://static.rust-lang.org/dist/
rust_gz=rust-1.69.0-x86_64-unknown-linux-gnu.tar.gz
rust_directory=rust-1.69.0-x86_64-unknown-linux-gnu
root_directory=/root
echo "Dependent installation"
yum install -y wget net-tools
echo "download rust"
wget -N -P $root_directory $rust_url$rust_gz
echo "make instll ruby"
tar -xf $root_directory/$rust_gz -C $root_directory
cd $root_directory/$rust_directory && sh install.sh --prefix=$rust_prefix
echo "rust environment variable"
echo 'export PATH=$PATH:/opt/rust/bin' >> ~/.bash_profile
source ~/.bash_profile
echo "rust version chek"
rustc --version | awk '{print $2}'
echo "rm rust"
rm -rf $root_directory/$rust_directory $root_directory/$rust_gz
echo -e "\033[32mThe rust Install Success...\033[0m"
else
echo -e "\033[31mThe rust Install Failed...\033[0m"
exit 1
fi
else
echo -e "\033[33mThe rust Install already...\033[0m"
fi
}
main (){
install_rust
}
main
执行安装rust
sh /rust_1.69_install.sh