-
Notifications
You must be signed in to change notification settings - Fork 5
/
centos_rhel_docker_install.sh
38 lines (31 loc) · 1.7 KB
/
centos_rhel_docker_install.sh
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
#!/bin/bash
echo "updating and installing packages"
sudo yum update -y
sudo yum install curl libaio ncurses numactl tar tzdata unzip -y
echo "updating firewall ports"
sudo firewall-cmd --zone=public --add-port=9191/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8090/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8181/tcp --permanent
sudo firewall-cmd --zone=public --add-port=7001/tcp --permanent
sudo firewall-cmd --zone=public --add-port=7002/tcp --permanent
sudo firewall-cmd --zone=public --add-port=9080/tcp --permanent
sudo firewall-cmd --zone=public --add-port=9081/tcp --permanent
sudo firewall-cmd --zone=public --add-port=9300-9400/tcp --permanent
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload
echo "completed firewall ports update"
SELINUX_FILE=/etc/selinux/config
if [ -f $SELINUX_FILE ]; then
sudo setenforce 0
sed -i s/SELINUX=.*/SELINUX=disabled/ $SELINUX_FILE
fi
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
for ID in $(grep /home /etc/passwd | cut -d ':' -f1); do usermod -aG docker "$ID" ; done
echo "--- host os preparation complete, you can now perform docker-compose (if you aren't root, you will need to logout and back in for group settings to take effect)---"