-
Notifications
You must be signed in to change notification settings - Fork 1
/
installArchOnLinode.sh
executable file
·106 lines (90 loc) · 2.43 KB
/
installArchOnLinode.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
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
#
# lang
#
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
#
# set hostname
#
hostnamectl set-hostname tx-arch
echo -n `curl ifconfig.cc` >> /etc/hosts
echo "tx-arch" >> /etc/hosts
#
# set timezone
#
timedatectl set-timezone Asia/Hong_Kong
#
# pacman key
#
haveged -w 1024
pacman-key --init
pkill haveged
pacman-key --populate archlinux
#
# update system
#
pacman --noconfirm -Syu
#
# soft
#
pacman --noconfirm -S base base-devel
pacman --noconfirm -S sudo bash-completion dnsutils nmap tcpdump dnsmasq openssh ctags p7zip unzip git subversion mercurial strace gdb w3m whois ix curl wget rsync gnu-netcat cmake ntp netctl iproute2
#
# add user tx
#
useradd -m -g users -s /bin/bash tx
usermod -a -G wheel tx
#
# for dns
#
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "nohook resolv.conf" >> /etc/dhcpcd.conf
echo "nooption domain_name_servers" >> /etc/dhcpcd.conf
#
# ssh disable password login, only allow ssh key is best TODO
#
#echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
#
# ssh disable root login
#
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
#
# about fail2ban, but follow link. so ssh key is better
# https://wiki.archlinux.org/index.php/fail2ban
#
#
# set firewall TODO
#
#
# static ip
#
echo "Description='A basic static ethernet connection'" >> /etc/netctl/static
echo "Interface=eth0" >> /etc/netctl/static
echo "Connection=ethernet" >> /etc/netctl/static
echo "## IPv4 Static Configuration" >> /etc/netctl/static
echo "IP=static" >> /etc/netctl/static
echo "Address=('23.239.0.7/255.255.255.0')" >> /etc/netctl/static
echo "Gateway='23.239.0.1'" >> /etc/netctl/static
echo "## For IPv6 autoconfiguration" >> /etc/netctl/static
echo "#IP6=stateless" >> /etc/netctl/static
echo "## For IPv6 static addr" >> /etc/netctl/staticess configuration
echo "IP6=static" >> /etc/netctl/static
echo "Address6=('2600:3c01::f03c:91ff:fedb:a43b/64')" >> /etc/netctl/static
echo "Gateway6='fe80::1'" >> /etc/netctl/static
echo "## DNS resolvers" >> /etc/netctl/static
echo "DNS=('127.0.0.1' '8.8.8.8')" >> /etc/netctl/static
#
# end todo
#
echo "change tx's password"
echo "visudo allow wheel group"
echo "check interface, ip, dns in /etc/netctl/static"
echo "enable dnsmasq"
#systemctl start dnsmasq
#systemctl enable dnsmasq
#systemctl disable dhcpcd@eth0
#netctl enable static
#systemctl restart sshd