forked from RitikSky-lab/the_data_echo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_command.sh
More file actions
119 lines (69 loc) · 2.78 KB
/
setup_command.sh
File metadata and controls
119 lines (69 loc) · 2.78 KB
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
#!/bin/bash
##############################################################################
########################## DATA ENGINEERING SETUP ############################
##############################################################################
# Exit immediately if any command fails
set -e
##############################################################################
# 1. DOCKER DATABASE SETUP
##############################################################################
# Pull required Docker images (PostgreSQL and MariaDB)
docker pull postgres:alpine
docker pull mariadb:10.6
# Run PostgreSQL container with user, password, DB, port and volume
docker run -d
--name postgres_db
-e POSTGRES_USER=Ritik
-e POSTGRES_PASSWORD=Ritik@843313
-e POSTGRES_DB=testdb
-p 5432:5432
-v postgres_data:/var/lib/postgresql/data
postgres:alpine || true # Ignore error if container already exists
# Run MariaDB container with credentials, DB, port and volume
docker run -d
--name maria_db
-e MYSQL_ROOT_PASSWORD=secret
-e MYSQL_DATABASE=testdb
-e MYSQL_USER=Ritik
-e MYSQL_PASSWORD=Ritik@843313
-p 3306:3306
-v mariadb_data:/var/lib/mysql
mariadb:10.6 || true # Ignore error if container already exists
# List running containers to verify setup
docker ps
##############################################################################
# 2. PYTHON VIRTUAL ENVIRONMENT
##############################################################################
# Create a Python virtual environment named 'python'
python3 -m venv python
# Activate the virtual environment
source python/bin/activate
# Upgrade pip to latest version
python -m pip install --upgrade pip
# Check Python version inside virtual environment
python --version
##############################################################################
# 3. JAVA SETUP
##############################################################################
# Update system package list
sudo apt update
# Install OpenJDK 17 (required for PySpark)
sudo apt install -y openjdk-17-jdk
# Verify installed Java version
java -version
# Get the actual path of Java binary
readlink -f $(which java)
##############################################################################
# 4. PYTHON DEPENDENCIES
##############################################################################
# Remove existing PySpark installation if present
pip uninstall pyspark -y || true
# Install required Python libraries
# - pyspark: for distributed data processing
# - jupyterlab: for notebooks
# - pandas: for data analysis
# - numpy: for numerical operations
pip install pyspark jupyterlab pandas numpy
##############################################################################
# END OF SETUP
##############################################################################