-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall_prereqs
executable file
·132 lines (110 loc) · 4.59 KB
/
install_prereqs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
# BSD 3-Clause License
#
# Copyright (c) 2019, Massachusetts Institute of Technology.
# Copyright (c) 2019, Toyota Research Institute.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -euxo pipefail
if [[ -z "${WORKSPACE-}" ]]; then
echo 'ERROR: This script must be run on a Jenkins node' >&2
exit 1
fi
if [[ "${EUID}" -ne 0 ]]; then
echo 'ERROR: This script must be run as root' >&2
exit 2
fi
systemctl --quiet disable apt-daily-upgrade.timer apt-daily.timer
echo 'APT::Acquire::Retries "4";' > /etc/apt/apt.conf.d/80-acquire-retries
export DEBIAN_FRONTEND=noninteractive
export PYTHONWARNINGS=ignore::SyntaxWarning
apt-get update -qq || (sleep 15; apt-get update -qq)
trap 'set +x; rm -rf /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin /var/lib/apt/lists/* /var/log/apt/*; set -x' EXIT
apt-get purge --autoremove -o Dpkg::Use-Pty=0 -qy cron unattended-upgrades
rm -rf /etc/cron.daily/apt-compat /var/log/unattended-upgrades
apt-get upgrade -o Dpkg::Options::=--force-confdef \
-o Dpkg::Options::=--force-confnew -o Dpkg::Use-Pty=0 -qy
# TODO(betsymcphail): If/when awscli is available via apt for Noble,
# remove the installation from the AMI and this special case.
if [[ "$(lsb_release -cs)" == "jammy" ]]; then
apt-get install --no-install-recommends -o Dpkg::Use-Pty=0 -qy \
awscli
fi
apt-get install --no-install-recommends -o Dpkg::Use-Pty=0 -qy \
ca-certificates \
cmake \
git \
gnupg \
lsb-release \
openjdk-17-jre-headless \
python3-venv \
wget \
xvfb
echo 'verbose = off' > /root/.wgetrc
cp /root/.wgetrc /home/ubuntu/.wgetrc
chown ubuntu:ubuntu /home/ubuntu/.wgetrc
# Downgrade mesa per https://github.com/RobotLocomotion/drake/issues/18726.
if [[ "$(lsb_release -cs)" == "jammy" ]]; then
# 1. Install the pinned versions we know work.
apt-get install -o Dpkg::Use-Pty=0 -y --allow-downgrades \
xvfb \
libegl1 \
libegl-mesa0=22.0.1-1ubuntu2 \
libgbm1=22.0.1-1ubuntu2 \
libgl1-mesa-dri=22.0.1-1ubuntu2 \
libglapi-mesa=22.0.1-1ubuntu2 \
libglx-mesa0=22.0.1-1ubuntu2
# 2. Prevent any subsequent `apt-get update && apt-get upgrade` from
# installing the newer versions.
apt-mark hold \
libegl-mesa0 \
libgbm1 \
libgl1-mesa-dri \
libglapi-mesa \
libglx-mesa0
fi
cat << EOF > /lib/systemd/system/xvfb.service
[Unit]
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1280x1024x24 -ac +extension GLX +extension RANDR +render -noreset
[Install]
WantedBy=multi-user.target
EOF
systemctl --now --quiet enable /lib/systemd/system/xvfb.service
apt-get install --no-install-recommends -o Dpkg::Use-Pty=0 -qy \
chrony
systemctl enable chrony
systemctl start chrony
wget -nv -t 4 -O /tmp/gurobi10.0.2_linux64.tar.gz --retry-connrefused \
https://packages.gurobi.com/10.0/gurobi10.0.2_linux64.tar.gz
echo '03da2c61494f5f80098270ba459d7567db8b0bf05884ddbd8a78e5b28b008dc9 /tmp/gurobi10.0.2_linux64.tar.gz' \
| sha256sum -c -
tar -C /opt -xf /tmp/gurobi10.0.2_linux64.tar.gz
echo '99f71fb7075f21ac50c8f11d66ecf69a82bbe95617d3a8eb401a30e52e719bd8 /opt/gurobi1002/linux64/include/gurobi_c.h' \
| sha256sum -c -
chown -R root:root /opt/gurobi1002