1
1
#! /bin/bash
2
+ # Copyright (c) 2024 Intel Corporation
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
2
16
set -e
3
17
4
18
_BASE_NAME=${1:- " ubuntu22.04" }
5
19
_SSL_LIB=" "
6
20
7
21
# preinstall dependencies and define variables
8
22
case " ${_BASE_NAME} " in
9
- * ubuntu22.04* )
10
- echo " Skip install Python3.10 from source on Ubuntu22.04"
11
- exit 0;
12
- ;;
13
- * debian* | * ubuntu* )
14
- apt update
15
- apt install -y libsqlite3-dev libreadline-dev
16
- ;;
17
- * rhel* )
18
- yum install -y sqlite-devel readline-devel xz-devel
19
- ;;
20
- * tencentos3.1* )
21
- dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel
22
- wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \
23
- cd /opt/ && \
24
- tar xzf openssl-1.1.1w.tar.gz && \
25
- rm -rf openssl-1.1.1w.tar.gz && \
26
- cd openssl-1.1.1w && \
27
- ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \
28
- make && make install
29
- ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
23
+ * ubuntu22.04* )
24
+ echo " Skip install Python3.10 from source on Ubuntu22.04"
25
+ exit 0
26
+ ;;
27
+ * debian* | * ubuntu* )
28
+ apt update
29
+ apt install -y libsqlite3-dev libreadline-dev
30
+ ;;
31
+ * rhel* )
32
+ yum install -y sqlite-devel readline-devel xz-devel
33
+ ;;
34
+ * tencentos3.1* )
35
+ dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel
36
+ wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz &&
37
+ cd /opt/ &&
38
+ tar xzf openssl-1.1.1w.tar.gz &&
39
+ rm -rf openssl-1.1.1w.tar.gz &&
40
+ cd openssl-1.1.1w &&
41
+ ./config --prefix=/usr/local/openssl-1.1.1w shared zlib &&
42
+ make && make install
43
+ ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
30
44
31
- PATH=$PATH :/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
32
- LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
33
- _SSL_LIB=" --with-openssl=/usr/local/openssl-1.1.1w"
34
- ;;
35
- * amzn2* )
36
- yum install -y sqlite-devel readline-devel
37
- wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \
38
- cd /opt/ && \
39
- tar xzf openssl-1.1.1w.tar.gz && \
40
- rm -rf openssl-1.1.1w.tar.gz && \
41
- cd openssl-1.1.1w && \
42
- ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \
43
- make && make install
44
- ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
45
+ PATH=$PATH :/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
46
+ LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
47
+ _SSL_LIB=" --with-openssl=/usr/local/openssl-1.1.1w"
48
+ ;;
49
+ * amzn2* )
50
+ yum install -y sqlite-devel readline-devel
51
+ wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz &&
52
+ cd /opt/ &&
53
+ tar xzf openssl-1.1.1w.tar.gz &&
54
+ rm -rf openssl-1.1.1w.tar.gz &&
55
+ cd openssl-1.1.1w &&
56
+ ./config --prefix=/usr/local/openssl-1.1.1w shared zlib &&
57
+ make && make install
58
+ ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
45
59
46
- PATH=$PATH :/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
47
- LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
48
- _SSL_LIB=" --with-openssl=/usr/local/openssl-1.1.1w"
49
- ;;
60
+ PATH=$PATH :/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
61
+ LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
62
+ _SSL_LIB=" --with-openssl=/usr/local/openssl-1.1.1w"
63
+ ;;
50
64
esac
51
65
52
66
# install Python
@@ -60,31 +74,30 @@ make -j && make altinstall
60
74
61
75
# post install
62
76
case " ${_BASE_NAME} " in
63
- * rhel9* )
64
- alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 && \
65
- alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
66
- alternatives --set python3 /usr/local/bin/python3.10
67
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
68
- ;;
69
- * tencentos3.1* )
70
- alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 && \
71
- alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 && \
72
- alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \
73
- alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \
74
- alternatives --set python3 /usr/local/bin/python3.10
75
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
76
- ;;
77
- * amzn2* )
78
- update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && \
79
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \
80
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
81
- ;;
82
- * debian* )
83
- update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3
84
- update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
85
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
86
- ;;
77
+ * rhel9* )
78
+ alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 &&
79
+ alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 &&
80
+ alternatives --set python3 /usr/local/bin/python3.10
81
+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
82
+ ;;
83
+ * tencentos3.1* )
84
+ alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 &&
85
+ alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 &&
86
+ alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 &&
87
+ alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 &&
88
+ alternatives --set python3 /usr/local/bin/python3.10
89
+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
90
+ ;;
91
+ * amzn2* )
92
+ update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 &&
93
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 &&
94
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
95
+ ;;
96
+ * debian* )
97
+ update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3
98
+ update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
99
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
100
+ ;;
87
101
esac
88
102
89
103
python3 -m pip install --upgrade pip setuptools
90
-
0 commit comments