forked from mobilecoinfoundation/mobilecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_sgx.sh
executable file
·77 lines (63 loc) · 2.12 KB
/
install_sgx.sh
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
#!/bin/sh
# Copyright (c) 2018-2022 The MobileCoin Foundation
set -e -x
# ############################################### #
# builder-install-sgx - Add SGX SDK and reinstall protobuf
# (Note(chris): I don't understand the protobuf part right now)
#
# Inspired by:
# https://github.com/sebva/docker-sgx
# Note: The example is FROM ubuntu:bionic, which is 18.04
# Note: Not just 'FROM'ing it because they make no maintenance promises
# ############################################### #
set -e
set -u
cd /tmp
# Install SGX Ubuntu/Debian Repo
# NB: When updating dependencies, please remember to update the instructions in BUILD.md as well
(
. /etc/os-release
wget "https://download.01.org/intel-sgx/sgx-linux/2.17/distro/ubuntu${VERSION_ID}-server/sgx_linux_x64_sdk_2.17.100.3.bin"
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/intel-sgx-archive-keyring.gpg] https://download.01.org/intel-sgx/sgx_repo/ubuntu/ ${UBUNTU_CODENAME} main" > /etc/apt/sources.list.d/intel-sgx.list
)
wget -O- https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | \
gpg --dearmor > /etc/apt/trusted.gpg.d/intel-sgx-archive-keyring.gpg
# Actually install stuff
apt-get update
apt-get install -yq --no-install-recommends \
ca-certificates \
build-essential \
ocaml \
ocamlbuild \
automake \
autoconf \
libtool \
wget \
python \
libssl-dev \
libcurl4-openssl-dev \
protobuf-compiler \
git \
libprotobuf-dev \
alien \
cmake \
debhelper \
uuid-dev \
libxml2-dev \
libsgx-uae-service \
sgx-aesm-service
# Install *after* pkg-config so that they get registered correctly.
# pkg-config gets pulled in transitively via build-essential
chmod +x ./sgx_linux_x64_sdk_2.17.100.3.bin
./sgx_linux_x64_sdk_2.17.100.3.bin --prefix=/opt/intel
# Update .bashrc to source sgxsdk
echo 'source /opt/intel/sgxsdk/environment' >> /root/.bashrc
# Protobuf
#
# When you absolutely, positively, can't depend on this getting installed properly...
#
mkdir -p /tmp/protoc
cd /tmp/protoc
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
unzip protoc-3.6.1-linux-x86_64.zip
cp bin/protoc /usr/bin/protoc