rust - A systems programming language ChangeLog

HOWTO


# Rust 1.29.2
# ===========
# Info about installing Rust via rustup:
#
# Assuming you trust that the devlopers are not evildoers and the process
# will not mess anything up on your system...  The easiest, simplest way of
# installing it is by using rustup.  It can also keep it updated for you.
# curl https://sh.rustup.rs -sSf | sh
#
# With rustup, programs go in ~/.cargo/bin
# It modifies ~/.profile to add that to PATH
#
# To uninstall a rustup-installed Rust: rustup self uninstall
#
# I installed it from source below to see how that goes, then removed
# that and used the rustup method instead (so I may not update this HOWTO
# again any time soon).  The process could be hours to compile it vs
# 1 minute to download and auto-install it.

# Below we cover installing it manually from source, but even then, you're
# running a Python script that downloads a tarball, then you maybe clone
# something with Git... so, far from manual

# Prerequisites:
# Python 2.7 (not 3.x)
# CMake >= 3.4.3
# curl
# Git

# See the Rust site for documentation, user forum, IRC, ...

# Here is some info about What x.py is (used to build and install below):
# https://forge.rust-lang.org/x-py.html

# Get it
cd
test -f installed/rustc-1.29.2-src.tar.gz &&
mv -f installed/rustc-1.29.2-src.tar.gz .
test ! -f rustc-1.29.2-src.tar.gz &&
wget https://static.rust-lang.org/dist/rustc-1.29.2-src.tar.gz

# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "5088e796aa2e47478cdf41e7243fc5443fafab0a7c70a11423e57c80c04167\
c9  rustc-1.29.2-src.tar.gz" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 7B3B09DC 2>&1 || gpg --recv-keys 7B3B09DC ) &&
wget -nc https://static.rust-lang.org/dist/rustc-1.29.2-src.tar.gz.asc &&
  gpg --verify rustc-1.29.2-src.tar.gz.asc &&
   rm -f rustc-1.29.2-src.tar.gz.asc

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "rustc-*-src" -exec rm -r {} \;
tar xzvf ~/rustc-1.29.2-src.tar.gz
cd rustc-1.29.2-src
test $UID = 0 && chown -R root:root .

# Build it
./x.py build

# To change installation paths, use config.toml (copy config.toml.example)
# If you are 64-bit and use /usr/local/lib64, edit the libdir line
# /usr/local/man, not /usr/local/share/man (may be a symlink...)
# /usr/local/info, not /usr/local/share/info (")
# Verify changes with 'diff -u config.toml.example config.toml'
test $(uname -m) = 'x86_64' &&
cat config.toml.example | sed \
  -e 's/^#libdir = .*/libdir = "lib64"/' \
  -e 's/^#mandir = .*/mandir = "man"/' \
  -e 's/^#infodir = .*/infodir = "info"/' > config.toml

# Become root to install it
su

# Install it
./x.py install

## Some installation paths
# /usr/local/lib*/rustlib/
# /usr/local/bin/rust-gdb
# /usr/local/bin/rust-lldb
# /usr/local/bin/rustc
# /usr/local/bin/rustdoc

# Add the libraries directory to /etc/ld.so.conf
egrep -q "^/usr/local/lib64/rustlib" /etc/ld.so.conf ||
echo "/usr/local/lib64/rustlib/x86_64-unknown-linux-gnu/lib" >> \
/etc/ld.so.conf
ldconfig

# Make sure you can at least run this successfully
rustc --version

# Become yourself again
exit

# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/rustc-*-src.tar.*
mv rustc-1.29.2-src.tar.gz installed/


# Cargo (the Rust package manager)
# =====
# Python
# curl
# CMake
# OpenSSL headers
# rustc (hopefully installed above)

su -c "pip install pytoml dulwich requests"

cd /tmp
git clone https://github.com/dhuseby/cargo-bootstrap.git
git clone https://github.com/rust-lang/crates.io-index
mkdir out

cd ~/src
test -d ./cargo && ( cd cargo ; git pull )
test ! -d ./cargo &&
git clone --recursive https://github.com/rust-lang/cargo
cd cargo
cp /tmp/cargo-bootstrap/bootstrap.py .
mkdir build
./bootstrap.py --crate-index /tmp/crates.io-index --target-dir ./build \
--no-clone --no-clean --target x86_64-unknown-linux
./configure --local-cargo=./build/cargo-0_5_0

test -d /tmp/cargo-bootstrap && rm -r /tmp/cargo-bootstrap
test -d /tmp/crates.io-index && rm -r /tmp/crates.io-index


# If you ever want to uninstall Rust, this should do it:
su
test -x /usr/local/lib64/rustlib/uninstall.sh &&
/usr/local/lib64/rustlib/uninstall.sh
for libdir in /usr/local/lib /usr/local/lib64;
do
  test -d $libdir && rm -r ${libdir}/rustlib
done
( cd /usr/local/bin ; rm -f rust-gdb rust-lldb rustc rustdoc )
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "rustc-*-src" -exec rm -r {} \;
rm -f ~/installed/rustc-*-src.tar.*

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EDT -0400)
HOWTO last updated: 2018-10-22 3:20pm
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]