|
1 | 1 | # Install Certifier (Ubuntu 20.04) |
2 | 2 |
|
3 | | - |
4 | 3 | ### Setup Environment variables |
5 | 4 |
|
| 5 | +```bash |
6 | 6 | cd ~/Projects |
7 | 7 | git clone https://github.com/ccc-certifier-framework/certifier-framework-for-confidential-computing.git |
8 | 8 |
|
9 | 9 | export CERTIFIER=~/Projects/certifier-framework-for-confidential-computing |
10 | 10 | export EXAMPLE_DIR=$CERTIFIER/sample_app |
| 11 | +``` |
11 | 12 |
|
12 | 13 | ### Install Dependencies |
13 | | -``` |
14 | | -sudo apt install libgtest-dev libgflags-dev |
| 14 | + |
| 15 | +**Note**: The UUID library is required for compilation but was missing from the original documentation. |
| 16 | + |
| 17 | +```bash |
| 18 | +sudo apt update |
| 19 | +sudo apt install libgtest-dev libgflags-dev uuid-dev |
15 | 20 | ``` |
16 | 21 |
|
17 | 22 | We note that the versioning of `protobuf` and `golang` matters. One shall not use the distribution directly `apt`-ed from Ubuntu. |
18 | 23 |
|
19 | 24 | Install the latest protobuf from source by |
20 | | -``` |
| 25 | +```bash |
21 | 26 | sudo apt install autoconf automake libtool curl make g++ unzip |
22 | 27 | git clone https://github.com/protocolbuffers/protobuf.git |
23 | 28 | cd protobuf |
24 | 29 | git submodule update --init --recursive |
25 | 30 | ./autogen.sh && ./configure |
26 | | - make -j$(nproc) && sudo make install |
27 | | - sudo ldconfig # refresh shared library cache. |
| 31 | +make -j$(nproc) && sudo make install |
| 32 | +sudo ldconfig # refresh shared library cache. |
28 | 33 | ``` |
29 | | -the detailed installation procedure can be found https://github.com/protocolbuffers/protobuf/blob/main/src/README.md. |
| 34 | +The detailed installation procedure can be found https://github.com/protocolbuffers/protobuf/blob/main/src/README.md. |
30 | 35 |
|
31 | 36 | Install the latest `golang` by |
32 | | -``` |
| 37 | +```bash |
33 | 38 | sudo apt install wget |
34 | 39 | wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz |
35 | 40 | sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz |
36 | 41 | export PATH=$PATH:/usr/local/go/bin && export PATH=$PATH:$(go env GOPATH)/bin |
37 | 42 | rm go1.18.4.linux-amd64.tar.gz |
38 | 43 | ``` |
39 | 44 |
|
40 | | -The protobuf compiler(protoc) for golang is installed by |
| 45 | +**Updated Go Protobuf Installation**: The `go get` commands are deprecated. Use `go install` instead: |
| 46 | +```bash |
| 47 | +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest |
| 48 | +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest |
41 | 49 | ``` |
42 | | -go get github.com/golang/protobuf/proto |
43 | | -go get google.golang.org/protobuf/cmd/protoc-gen-go |
| 50 | + |
| 51 | +**Alternative method** (if the above doesn't work, as referenced in the grpc.io quickstart): |
| 52 | +```bash |
| 53 | +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 |
| 54 | +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 |
44 | 55 | ``` |
45 | 56 |
|
46 | 57 | Ensure OpenSSL library and OpenSSL headers are installed or install by |
47 | | -``` |
48 | | -sudo apt install openssl |
49 | | -sudo apt install libssl-dev |
| 58 | +```bash |
| 59 | +sudo apt install openssl libssl-dev |
50 | 60 | ``` |
51 | 61 | Current tests on Ubuntu are with OpenSSL 1.1.1f. |
52 | 62 |
|
53 | 63 | ### Compile Certifier Library |
| 64 | + |
54 | 65 | The certifier library can be compiled by |
55 | | -``` |
56 | | - cd $CERTIFIER/src |
57 | | - make -f certifier.mak |
| 66 | +```bash |
| 67 | +cd $CERTIFIER/src |
| 68 | +make -f certifier.mak |
58 | 69 |
|
59 | 70 | cd $CERTIFIER/utilities |
60 | 71 | make -f cert_utility.mak |
61 | 72 | make -f policy_utilities.mak |
62 | 73 | ``` |
63 | 74 |
|
64 | | - |
65 | 75 | ### Build the Certifier Service |
66 | 76 |
|
67 | 77 | 1. Compile the protobuf required by certifier service by |
68 | | -``` |
69 | | - cd $CERTIFIER/certifier_service/certprotos |
70 | | - protoc --go_opt=paths=source_relative --go_out=. --go_opt=Mcertifier.proto= ./certifier.proto |
| 78 | +```bash |
| 79 | +cd $CERTIFIER/certifier_service/certprotos |
| 80 | +protoc --go_opt=paths=source_relative --go_out=. --go_opt=Mcertifier.proto= ./certifier.proto |
71 | 81 | ``` |
72 | 82 |
|
73 | 83 | 2. Install the certifier as go library by |
74 | | -``` |
75 | | -go install github.com/jlmucb/crypto@latest |
| 84 | +```bash |
| 85 | +go install github.com/jlmucb/crypto@latest |
76 | 86 | # TODO: this is a workaround to an existing path issue |
77 | 87 | mkdir -p $(go env GOPATH)/src/github.com/jlmucb/crypto/v2 |
78 | 88 | sudo cp -r $CERTIFIER $(go env GOPATH)/src/github.com/jlmucb/crypto/v2 |
79 | 89 | ``` |
80 | 90 |
|
81 | 91 | 3. Build the simple server |
82 | | -``` |
83 | | - cd $CERTIFIER/certifier_service |
84 | | - go build simpleserver.go |
| 92 | +```bash |
| 93 | +cd $CERTIFIER/certifier_service |
| 94 | +go build simpleserver.go |
85 | 95 | ``` |
86 | 96 | If showing error of `go.mod not found`, run `go env -w GO111MODULE=off` before building. |
87 | 97 |
|
88 | | - |
89 | 98 | ### Run `sample_app` |
90 | 99 |
|
91 | 100 | To run sample application, follow the README in sample_app or directly run |
92 | | -``` |
| 101 | +```bash |
93 | 102 | cd $EXAMPLE_DIR |
94 | 103 | chmod +x ./script |
95 | 104 | ./script |
96 | 105 | ``` |
97 | 106 |
|
| 107 | +## Troubleshooting |
| 108 | + |
| 109 | +### Common Issues: |
| 110 | + |
| 111 | +1. **UUID library missing**: If you get `fatal error: uuid/uuid.h: No such file or directory`, ensure you've installed `uuid-dev`: |
| 112 | + ```bash |
| 113 | + sudo apt install uuid-dev |
| 114 | + ``` |
| 115 | + |
| 116 | +2. **Go protobuf installation issues**: The original `go get` commands are deprecated. Use the updated `go install` commands provided above, or refer to the official gRPC Go quickstart guide at https://grpc.io/docs/languages/go/quickstart/ |
| 117 | + |
| 118 | +3. **Protobuf version conflicts**: Make sure to install protobuf from source rather than using the Ubuntu package to avoid version mismatches. |
0 commit comments