-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-basic-package.sh
More file actions
executable file
·160 lines (137 loc) · 3.66 KB
/
install-basic-package.sh
File metadata and controls
executable file
·160 lines (137 loc) · 3.66 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
# A script to prepare my development system
#
# history:
# v0.2: adds Ubuntu 18 support
#
# @version: 0.2
# @version: 0.1
# @maintainted-by: jae
set -x
set -e
# if missing, returns 1 (false). if installed, returns 0 (true)
# missing() { dpkg-query -W -f='${Status}' $1 2>/dev/null && return 1; return 0; }
missing() {
dpkg -s $1
if [ $? == 1 ]; then
# if pkg not installed, dpkg returns 1, meaning it's missing.
return 0
fi
return 1
}
apt_install() {
for pkg in "$@"; do
if missing $pkg; then
echo "Installing $pkg"
apt install -y $pkg
fi
done
}
die() { echo "$*" 1>&2; exit 1; }
[ $USER == 'root' ] || die 'root only'
os_name=$(lsb_release -d | awk -F"\t" '{print $2}')
if [[ $os_name == 'Ubuntu 18.'* ]]; then
os_name='Ubuntu'
os_ver=18
os='Ubuntu:18'
elif [[ $os_name == 'Ubuntu 16.'* ]]; then
os_name='Ubuntu'
os_ver=16
os='Ubuntu:16'
elif [[ $os_name == 'Ubuntu 14.'* ]]; then
os_name='Ubuntu'
os_ver=14
os='Ubuntu:14'
else
die 'Not supported yet.'
fi
# snapd seems to fail on Ubuntu 14
if [ $os != 'Ubuntu:14' ]; then
apt_install snapd
if ! grep -q "/snap/bin" /etc/environment; then
echo 'add /snap/bin to etc/environment'
exit 1
fi
fi
echo "
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 12
}
" >/etc/logrotate.d/wtmp
# lf: alias for ls -f
if [ ! -f /usr/bin/lf ]; then
echo "#!/bin/bash
ls -f $@
" > /usr/bin/lf
chmod +x /usr/bin/lf
fi
# llf: alias for ls -f1
if [ ! -f /usr/bin/llf ]; then
echo "#!/bin/bash
ls -f1 $@ | sort | tail -n+3
" > /usr/bin/llf
chmod +x /usr/bin/llf
fi
# ntp
# apt_install ntp
# if [ $os != 'Ubuntu:14' ]; then
# timedatectl set-ntp no
# fi
# useful git alias
apt_install git
git config --system alias.lg 'log --all --decorate --graph --oneline'
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
# 28800 is 8 hours, 3880000 is ~1 month
git config --system credential.helper 'cache --timeout 2880000'
apt_install gcc
# install Go v1.11
# wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz -O /tmp/go1.11.4.tgz
# sudo tar -C /usr/local -xzf /tmp/go1.11.4.tgz
# go get github.com/github/hub
# cp ~/go/bin/hub /usr/local/bin
# general. For remote-server, install watchdog
apt_install inotify-tools trash-cli
# replace rm with 'del' (trash)
if ! grep -q 'alias rm' /etc/bash.bashrc; then
echo "alias rm='echo rm is not available. use \"del\" command to delete'" >>/etc/bash.bashrc
echo "alias del='trash'" >>/etc/bash.bashrc
fi
apt_install apt-transport-https curl pwgen cpulimit gcc
apt_install vim emacs tmux screen sshfs htop moreutils colordiff
apt_install p7zip-full rar unrar pbzip2
apt_install mosh autojump hdfview dcmtk ncdu
apt_install automake libtool cmake jq uuid libgtk2.0-dev pkg-config
apt_install libzip-dev monit pv iperf iftop
apt_install parallel meld
apt_install fail2ban
# nodejs v8 (Ubuntu 16 ships with nodejs v4)
if [ os == 'Ubuntu:14' || os == 'Ubuntu:16' ]; then
curl --fail -ssL -o /tmp/setup-nodejs https://deb.nodesource.com/setup_8.x
# curl -sL https://deb.nodesource.com/setup_8.x | -E bash -
bash /tmp/setup-nodejs
apt_install nodejs
else
# Ubuntu 18+ ships node v8
apt_install nodejs
fi
apt_install npm
# javascript code formatter
npm install --global prettier
# python beautifier - should be installed per user
# pip install yapf
# csvkit
# conda install csvkit
#if [ os == 'Ubuntu:14' || os == 'Ubuntu:16' ]; then
# apt_install python3-csvkit
#else
# apt_install csvkit
#fi
apt_install -y pv lzop mbuffer libconfig-inifiles-perl
# for centos/rhel
# yum install perl-Config-IniFiles
apt_install build-essential cmake