-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalpine-setup.sh
57 lines (48 loc) · 1.33 KB
/
alpine-setup.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# Update Repos
mkdir -p "/etc/orig_config"
cp "/etc/apk/repositories" "/etc/orig_config/repositories"
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> "/etc/apk/repositories"
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> "/etc/apk/repositories"
# Install Default apps
apk update
apk add sudo
apk add udev
apk add qemu-guest-agent
apk add mandoc
apk add man-pages
apk add docker
apk add docker-compose
apk add crond
apk add iptables
apk add vim
apk add git
apk add bash
apk add zip
apk add logrotate
apk add bash
# setup udev
rc-update add udev sysinit
rc-update add udev-trigger
rc-update add udev-settle
rc-update add udev-postmount
rc-update add qemu-guest-agent
rc-update add docker
rc-update add crond
rc-update add iptables
# Open SSH port
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
# Update Iptables rules
/etc/init.d/iptables save
# Service Starts
rc-service crond start
rc-service docker start
rc-service iptables start
rc-service qemu-guest-agent start
# add wheel to sudoers
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
# Create auto update job/script
echo -e "#!/bin/sh\napk upgrade --update | sed \"s/^/[\`date\`] /\" >> /var/log/apk-autoupgrade.log" > /etc/periodic/daily/apk-autoupgrade
chmod 700 /etc/periodic/daily/apk-autoupgrade
rm /etc/ssh/ssh_host_*
ssh-keygen -A