-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_env_deb_linux.sh
More file actions
131 lines (109 loc) · 4.75 KB
/
Copy pathdev_env_deb_linux.sh
File metadata and controls
131 lines (109 loc) · 4.75 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
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
# Check if the script is running as root
if [[ $EUID -eq 0 ]]; then
echo "This script must not be run as root."
exit 87
fi
# Prompt the user to update sources.list
read -p "Would you like to update sources.list with recommended contents? (y/n): " update_sources
if [[ $update_sources == "y" ]]; then
# Determine the Debian version codename
debian_version=$(lsb_release -cs)
sources_content="deb https://ftp.debian.org/debian/ $debian_version contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ $debian_version contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ $debian_version-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ $debian_version-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ $debian_version-proposed-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ $debian_version-proposed-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ $debian_version-backports contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ $debian_version-backports contrib main non-free non-free-firmware
deb https://security.debian.org/debian-security/ $debian_version-security contrib main non-free non-free-firmware
# deb-src https://security.debian.org/debian-security/ $debian_version-security contrib main non-free non-free-firmware"
echo "$sources_content" | sudo tee /etc/apt/sources.list > /dev/null
echo "Updated sources.list with recommended contents."
fi
# Update and upgrade
read -p "Would you like to update the package list? (y/n): " update_packages
if [[ $update_packages == "y" ]]; then
sudo apt update
fi
sudo apt full-upgrade -y
# Check if Google Chrome is installed
if ! command -v google-chrome &>/dev/null; then
read -p "Google Chrome is not installed. Would you like to install it? (y/n): " install_chrome
if [[ $install_chrome == "y" ]]; then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb -y
else
echo "Skipping Google Chrome installation."
fi
else
echo "Google Chrome is already installed."
fi
# Check if Docker is installed
if ! command -v docker &>/dev/null; then
read -p "Docker is not installed. Would you like to install it? (y/n): " install_docker
if [[ $install_docker == "y" ]]; then
# Install Docker
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER
else
echo "Skipping Docker installation."
fi
else
echo "Docker is already installed."
fi
# Install NVM and Node.js
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
nvm use --lts
# Define APT packages
APT_PACKAGES=("build-essential" "python-is-python3" "python3" "python3-pip" "mongodb" "mysql" "postgresql" "git" "npm" "snapd")
# Prompt user to install build-essential
read -p "Would you like to install build-essential? (y/n): " install_build_essential
if [[ $install_build_essential == "y" ]]; then
APT_PACKAGES+=("build-essential")
fi
# Install APT packages
for PACKAGE in "${APT_PACKAGES[@]}"; do
if ! command -v "$PACKAGE" &>/dev/null; then
echo "Installing $PACKAGE..."
sudo apt install "$PACKAGE" -y
else
echo "$PACKAGE is already installed."
fi
done
# Prompt the user to install Angular
read -p "Would you like to install Angular CLI? (y/n): " install_angular
if [[ $install_angular == "y" ]]; then
npm i -g @angular/cli
fi
# Prompt the user to install Express app generator
read -p "Would you like to install Express app generator? (y/n): " install_express_generator
if [[ $install_express_generator == "y" ]]; then
npm i -g express-generator
fi
# Prompt the user to set up Git
read -p "Would you like to set up Git (name and email)? (y/n): " setup_git
if [[ $setup_git == "y" ]]; then
read -p "Enter name for git config: " Name
git config --global user.name "${Name}"
read -p "Enter email for ssh key: " Email
git config --global user.email "${Email}"
# Setup Git using SSH
ssh-keygen -t ed25519 -C "${Email}"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
sudo apt install xclip
xclip -selection clipboard < ~/.ssh/id_ed25519.pub
cat ~/.ssh/id_ed25519.pub
echo "Now go to github.com and add the SSH key to your account."
fi
# Create a log file
log_file="installation_log.txt"
echo "Script execution completed. You can find log details in $log_file."
# Redirect stdout and stderr to the log file
exec &> "$log_file"
# Notify user of log location
echo "Script execution completed. Log details are available in $log_file."