Setup DB Access in GCP Instance
Wed May 15 2024 05:33:48 GMT+0000 (Coordinated Universal Time)
Saved by
@hardikraja
#commandline
#linux
#COMPLETE
#!/bin/bash
if ! grep -q 'REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' ~/.bashrc; then \
wget http://pki.bonprix.de/aia/bpRootCA01.crt; \
openssl x509 -inform der -outform pem -in bpRootCA01.crt -out bpRootCA01-pem.crt; \
sudo cp bpRootCA01-pem.crt /usr/local/share/ca-certificates/bpRootCA01.crt; \
sudo update-ca-certificates --fresh; \
if [ -x "$(command -v python)" ]; then
python -m pip config set global.cert /etc/ssl/certs/ca-certificates.crt; \
fi;
echo 'export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' >> ~/.bashrc; \
source ~/.bashrc; \
export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt; \
fi;
if [ ! -L /opt/oracle/instantclient ]; then \
sudo rm -f /etc/profile.d/bp_envs.sh; \
echo 'export ORACLE_HOME="/opt/oracle/instantclient"' | sudo tee /etc/profile.d/bp_envs.sh; \
echo 'export TNS_ADMIN="/etc/oracle"' | sudo tee -a /etc/profile.d/bp_envs.sh; \
echo 'export DYLD_LIBRARY_PATH="/opt/oracle/instantclient"' | sudo tee -a /etc/profile.d/bp_envs.sh; \
echo 'export LD_LIBRARY_PATH="/opt/oracle/instantclient"' | sudo tee -a /etc/profile.d/bp_envs.sh; \
echo 'export SQLPATH="/opt/oracle/instantclient"' | sudo tee -a /etc/profile.d/bp_envs.sh; \
echo 'export PATH=$PATH:"/opt/oracle/instantclient"' | sudo tee -a /etc/profile.d/bp_envs.sh; \
sh /etc/profile.d/bp_envs.sh; \
sudo apt-get update && sudo apt-get install -q -y libaio1 gcc libc-dev; \
cd /opt; \
sudo curl -o oracle.tgz https://digistyle.bonprix.net/artifactory/docker-external/oracle/instantclient/19.3.0.0.0/instantclient-19.3.0.0.0.tar.gz; \
sudo tar -xf oracle.tgz; \
sudo rm -f oracle.tgz; \
cd; \
if [ ! -x "$(command -v git)" ]; then
sudo apt-get update && sudo apt-get install git -y -q; \
fi;
git clone https://ai-squad-fetch-token:glpat-H8y665Wgn9vhYuRE-eMG@gitlab-es.bonprix.work/em-ps-admin/tnsnames; \
sudo mkdir -p /etc/oracle; \
sudo mv tnsnames/tnsnames.ora /etc/oracle/; \
sudo rm -r tnsnames; \
sudo reboot; \
fi;
content_copyCOPY
Comments