forked from greenplum-db/gpdb-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.macOS.arm.bash
executable file
·147 lines (128 loc) · 4.58 KB
/
README.macOS.arm.bash
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
set -x
sudo -K
sudo true;
if [ ! -d ~/workspace ] ; then
mkdir ~/workspace && cd ~/workspace
fi
sudo xcode-select -s /Library/Developer/CommandLineTools
if hash brew 2>/dev/null; then
echo "Homebrew is already installed!"
else
echo "Installing Homebrew..."
echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ $? == 1 ]]; then
echo "ERROR : Homebrew Installation Failed, fix the failure and re-run the script."
exit 1
fi
fi
#Install xerces-c library
if [ ! -d ~/workspace/gp-xerces ] ; then
echo "INFO: xerces is not installed, Installing...."
git clone https://github.com/greenplum-db/gp-xerces.git -v ~/workspace/gp-xerces
mkdir ~/workspace/gp-xerces/build
cd ~/workspace/gp-xerces/build
~/workspace/gp-xerces/configure --prefix=/usr/local
make
sudo make install
cd -
fi
#brew install xerces-c #gporca
brew install bash-completion
brew install conan
brew install cmake # gporca
brew install libyaml # enables `--enable-mapreduce`
brew install libevent # gpfdist
brew install apr # gpperfmon
brew install apr-util # gpperfmon
brew install libxml2
brew install pkg-config
brew link --force apr
brew link --force apr-util
brew link libxml2 --force
# Installing Golang
mkdir -p ~/go/src
brew install go # Or get the latest from https://golang.org/dl/
# Installing python2 libraries
brew install python2
brew install pyenv
pyenv install 2.7.18
ln -s ~/.pyenv/versions/2.7.18/bin/python2 /usr/local/bin/python2
ln -s ~/.pyenv/versions/2.7.18/bin/pip2 /usr/local/bin/pip2
ln -s /usr/local/bin/python2 /usr/local/bin/python
ln -s /usr/local/bin/pip2 /usr/local/bin/pip
pip install -r python-dependencies.txt
pip install -r python-developer-dependencies.txt
python -m pip install psutil
# Installing python3 libraries
rm -rf /opt/homebrew/bin/python3
rm -rf /opt/homebrew/bin/pip3
brew install [email protected]
python_version=$(echo `ls /opt/homebrew/Cellar/[email protected]/`)
ln -s /opt/homebrew/Cellar/[email protected]/$python_version/bin/python3.9 /opt/homebrew/bin/python3
ln -s /opt/homebrew/Cellar/[email protected]/$python_version/bin/pip3.9 /opt/homebrew/bin/pip3
pip3 install -r python-dependencies.txt
pyenv install $python_version
echo 127.0.0.1$'\t'$(hostname) | sudo tee -a /etc/hosts
# OS settings
sudo sysctl -w kern.sysv.shmmax=2147483648
sudo sysctl -w kern.sysv.shmmin=1
sudo sysctl -w kern.sysv.shmmni=64
sudo sysctl -w kern.sysv.shmseg=16
sudo sysctl -w kern.sysv.shmall=524288
sudo sysctl -w net.inet.tcp.msl=60
sudo sysctl -w net.local.dgram.recvspace=262144
sudo sysctl -w net.local.dgram.maxdgram=16384
sudo sysctl -w kern.maxfiles=131072
sudo sysctl -w kern.maxfilesperproc=131072
sudo sysctl -w net.inet.tcp.sendspace=262144
sudo sysctl -w net.inet.tcp.recvspace=262144
sudo sysctl -w kern.ipc.maxsockbuf=8388608
sudo tee -a /etc/sysctl.conf << EOF
kern.sysv.shmmax=2147483648
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=524288
net.inet.tcp.msl=60
net.local.dgram.recvspace=262144
net.local.dgram.maxdgram=16384
kern.maxfiles=131072
kern.maxfilesperproc=131072
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
kern.ipc.maxsockbuf=8388608
EOF
# Step: Create GPDB destination directory
sudo mkdir /usr/local/gpdb
sudo chown $USER:admin /usr/local/gpdb
# Step: Configure
cat >> ~/.bashrc << EOF
ulimit -n 65536 65536 # Increases the number of open files
export PGHOST="$(hostname)"
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:\$PATH";
alias python="/usr/local/bin/python"
export LDFLAGS="-L/opt/homebrew/opt/libxml2/lib -L/opt/homebrew/opt/openssl\@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libxml2/include -I/opt/homebrew/opt/openssl\@3/include"
export LD_LIBRARY_PATH="/Users/`whoami`/.pyenv/versions/${python_version}/lib/"
export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include"
export OPENSSL_LIB_DIR="$(brew --prefix openssl)/lib"
EOF
source ~/.bashrc
# Step: GOPATH for Golang
cat >> ~/.bash_profile << EOF
export GOPATH=\$HOME/go
export PATH=\$HOME/go/bin:\$PATH
EOF
source ~/.bash_profile
#Softlinks for openssl
ln -s /opt/homebrew/opt/[email protected]/include/openssl /usr/local/include/openssl
ln -s /opt/homebrew/opt/[email protected]//lib/* /usr/local/lib/
cat << EOF
===============================================================================
INFO :
Please source /usr/local/gpdb/greenplum_path.sh after compiling database, then
pip install --user -r python-dependencies.txt
===============================================================================
EOF