/
yuminstall.inc
342 lines (298 loc) · 15.7 KB
/
yuminstall.inc
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
yumcleanup() {
echo "*************************************************"
cecho "* Remove unneeded YUM packages" $boldgreen
echo "*************************************************"
echo "please wait till completion."
if [[ "$INITIALINSTALL" = [yY] ]]; then
yum -y remove httpd* php* samba* exim* bind*
fi
echo "*************************************************"
cecho "* yum clean all & update" $boldgreen
echo "*************************************************"
echo "please wait till completion."
yum${CACHESKIP} -q clean all
yum${CACHESKIP} -y update glibc\*
yum${CACHESKIP} -y update yum\* rpm\* python\*
yum${CACHESKIP} -q clean all
yum${CACHESKIP} -y update
}
yuminstall() {
echo "*************************************************"
cecho "* Installing Development Tools" $boldgreen
echo "*************************************************"
echo "please wait for yum download and installs to complete."
echo "yum installs in less verbose mode so final install status is only shown.."
echo "...."
echo "......"
echo "........."
if [[ "$CENTOS_SIX" = '6' || "$CENTOS_SEVEN" = '7' ]]; then
# do not install yum fastmirror plugin if not enough detected system memory available
# for yum fastmirror operation
if [[ "$(awk '/MemTotal/ {print $2}' /proc/meminfo)" -ge '1018000' && "$CENTOS_SEVEN" = '7' ]]; then
if [[ $(rpm -q yum-plugin-fastestmirror >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-fastestmirror${DISABLEREPO_DNF}
sar_call
fastmirror_tweaks
fi
if [[ $(rpm -q yum-plugin-downloadonly >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-downloadonly${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q yum-plugin-security >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-security${DISABLEREPO_DNF}
sar_call
fi
elif [[ "$(awk '/MemTotal/ {print $2}' /proc/meminfo)" -ge '263000' ]]; then
if [[ $(rpm -q yum-plugin-fastestmirror >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-fastestmirror${DISABLEREPO_DNF}
sar_call
fastmirror_tweaks
fi
if [[ $(rpm -q yum-plugin-downloadonly >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-downloadonly${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q yum-plugin-security >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y install yum-plugin-security${DISABLEREPO_DNF}
sar_call
fi
fi
if [[ $(rpm -q yum-plugin-priorities >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install yum-plugin-priorities${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q epel-release >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install epel-release${DISABLEREPO_DNF}
sar_call
fi
if [[ -f /etc/yum.repos.d/epel.repo && -z "$(grep 'varnish-libs' /etc/yum.repos.d/epel.repo)" ]]; then
sed -i 's|varnish|varnish varnish-libs|' /etc/yum.repos.d/epel.repo
fi
sed -i 's/metadata_expire=1h/metadata_expire=4h/g' /etc/yum.conf
# centos 6 unlike centos 7 doesn't install CR yum repo by default
# https://wiki.centos.org/AdditionalResources/Repositories/CR
if [[ "$CENTOS_SIX" = '6' ]]; then
yum -y -q install centos-release-cr${DISABLEREPO_DNF}
sar_call
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-CR.repo
# echo "priority=1" >> /etc/yum.repos.d/CentOS-CR.repo
fi
yumprior
else
if [[ $(rpm -q yum-priorities >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install yum-priorities${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q yum-fastestmirror >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install yum-fastestmirror${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q yum-downloadonly >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install yum-downloadonly${DISABLEREPO_DNF}
sar_call
fi
if [[ $(rpm -q epel-release >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install epel-release${DISABLEREPO_DNF}
sar_call
fi
sed -i 's/metadata_expire=1h/metadata_expire=4h/g' /etc/yum.conf
yumprior
fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ $(rpm -q nmap-ncat >/dev/null 2>&1; echo $?) != '0' ]]; then
time $YUMDNFBIN -y install nmap-ncat${DISABLEREPO_DNF}
sar_call
fi
else
if [[ $(rpm -q nc >/dev/null 2>&1; echo $?) != '0' ]]; then
time $YUMDNFBIN -y install nc libgcj${DISABLEREPO_DNF}
sar_call
fi
fi
yumcentosfivedownload
### smarter yum install update routine ###
if [[ ! -f /etc/yum.repos.d/remi.repo ]]; then
if [ -f /tmp/curlinstaller-yum ]; then
echo
echo "skip unneeded yum package check/installs for curl installer routines"
echo
PACKAGE='cracklib'
else
PACKAGE='virt-what gawk deltarpm cracklib ca-certificates pyOpenSSL python-dateutil yum-utils bash mlocate subversion rsyslog dos2unix net-tools imake bind-utils libatomic_ops-devel time coreutils autoconf cronie crontabs cronie-anacron gcc gcc-c++ automake libtool make libXext-devel unzip patch sysstat openssh flex bison file libtool-ltdl-devel krb5-devel libXpm-devel nano gmp-devel aspell-devel numactl lsof pkgconfig gdbm-devel tk-devel bluez-libs-devel iptables* rrdtool diffutils which perl-Test-Simple perl-ExtUtils-Embed perl-ExtUtils-MakeMaker perl-Time-HiRes perl-libwww-perl perl-Crypt-SSLeay perl-Net-SSLeay cyrus-imapd cyrus-sasl-md5 cyrus-sasl-plain strace cmake git net-snmp-libs net-snmp-utils iotop'
fi
else
if [ -f /tmp/curlinstaller-yum ]; then
echo
echo "skip unneeded yum package check/installs for curl installer routines"
echo
PACKAGE='cracklib'
else
PACKAGE='virt-what gawk deltarpm ca-certificates yum-plugin-security yum-utils bash mlocate subversion rsyslog dos2unix net-tools imake bind-utils libatomic_ops-devel time coreutils autoconf cronie crontabs cronie-anacron gcc gcc-c++ automake libtool make libXext-devel unzip patch sysstat openssh flex bison file libtool-ltdl-devel krb5-devel libXpm-devel nano gmp-devel aspell-devel numactl lsof pkgconfig gdbm-devel tk-devel bluez-libs-devel iptables* rrdtool diffutils which ImageMagick ImageMagick-devel ImageMagick-c++ ImageMagick-c++-devel perl-Test-Simple perl-ExtUtils-MakeMaker perl-Time-HiRes perl-libwww-perl perl-Crypt-SSLeay perl-Net-SSLeay cyrus-imapd cyrus-sasl-md5 cyrus-sasl-plain strace cmake git net-snmp-libs net-snmp-utils iotop'
fi
fi
declare -a array
array=(${PACKAGE})
ystarttime=$(TZ=UTC date +%s.%N)
{
# if curl one liner is used and detected should skip this yum install routine
# since it's already done by curl installer script
if [ ! -f /usr/local/src/curlinstall_yum.txt ]; then
for pkg in ${array[@]}
do
echo Processing package: $pkg
YUMINSTALLRPMCHECK=$(rpm -ql $pkg >/dev/null 2>&1; echo $?)
#echo $YUMINSTALLRPMCHECK
if [[ "$YUMINSTALLRPMCHECK" = '0' ]]; then
echo "----------------------------------------------------------------------------------"
# ${YUMDNFBIN}${CACHESKIP}-q -y update $pkg
# ${YUMDNFBIN}${CACHESKIP} -q list $pkg
echo "$pkg already installed"
echo "----------------------------------------------------------------------------------"
else
echo "----------------------------------------------------------------------------------"
cecho "Installing $pkg" $boldyellow
echo "----------------------------------------------------------------------------------"
${YUMDNFBIN}${CACHESKIP} -q -y install $pkg${DISABLEREPO_DNF}
# ${YUMDNFBIN}${CACHESKIP} -q list $pkg
echo "----------------------------------------------------------------------------------"
fi
done
sar_call
fi # /usr/local/src/curlinstall_yum.txt
## grouped devels for faster install
if [[ ! -f /etc/yum.repos.d/remi.repo ]]; then
if [ -f /tmp/curlinstaller-yum ]; then
echo
echo "skip unneeded yum package check/installs for curl installer routines"
echo
PACKAGEG='{libvpx,libvpx-devel} {ImageMagick,ImageMagick-devel} {ImageMagick-c++,ImageMagick-c++-devel}'
else
PACKAGEG='{libvpx,libvpx-devel} {t1lib,t1lib-devel} {expect,expect-devel} {readline,readline-devel} {libedit,libedit-devel} {openssl,openssl-devel} {curl,curl-devel} {openldap,openldap-devel} {zlib,zlib-devel} {gd,gd-devel} {pcre,pcre-devel} {gettext,gettext-devel} {libidn,libidn-devel} {libjpeg,libjpeg-devel} {libpng,libpng-devel} {freetype,freetype-devel} {libxml2,libxml2-devel} {libxslt,libxslt-devel} {glib2,glib2-devel} {bzip2,bzip2-devel} {ncurses,ncurses-devel} {e2fsprogs,e2fsprogs-devel} {libc-client,libc-client-devel} {ImageMagick,ImageMagick-devel} {ImageMagick-c++,ImageMagick-c++-devel} {cyrus-sasl,cyrus-sasl-devel} {pam,pam-devel} {libaio,libaio-devel} {libevent,libevent-devel} {recode,recode-devel} {libtidy,libtidy-devel} {net-snmp,net-snmp-devel} {enchant,enchant-devel} {lua,lua-devel}'
fi
else
if [ -f /tmp/curlinstaller-yum ]; then
echo
echo "skip unneeded yum package check/installs for curl installer routines"
echo
PACKAGEG='{libvpx,libvpx-devel} {ImageMagick6,ImageMagick6-devel} {ImageMagick6-c++,ImageMagick6-c++-devel}'
else
PACKAGEG='{libvpx,libvpx-devel} {t1lib,t1lib-devel} {expect,expect-devel} {readline,readline-devel} {libedit,libedit-devel} {openssl,openssl-devel} {curl,curl-devel} {openldap,openldap-devel} {zlib,zlib-devel} {gd,gd-devel} {pcre,pcre-devel} {gettext,gettext-devel} {libidn,libidn-devel} {libjpeg,libjpeg-devel} {libpng,libpng-devel} {freetype,freetype-devel} {libxml2,libxml2-devel} {libxslt,libxslt-devel} {glib2,glib2-devel} {bzip2,bzip2-devel} {ncurses,ncurses-devel} {e2fsprogs,e2fsprogs-devel} {libc-client,libc-client-devel} {ImageMagick6,ImageMagick6-devel} {ImageMagick6-c++,ImageMagick6-c++-devel} {cyrus-sasl,cyrus-sasl-devel} {pam,pam-devel} {libaio,libaio-devel} {libevent,libevent-devel} {recode,recode-devel} {libtidy,libtidy-devel} {net-snmp,net-snmp-devel} {enchant,enchant-devel} {lua,lua-devel}'
fi
fi
declare -a arrayb
arrayb=(${PACKAGEG})
# if curl one liner is used and detected should skip this yum install routine
# since it's already done by curl installer script
if [ ! -f /usr/local/src/curlinstall_yum.txt ]; then
for pkgg in ${arrayb[@]}
do
echo Processing package: $pkgg
pkggp=$(echo $pkgg | sed -e 's|{||' -e 's|}||' -e 's|,| |')
YUMINSTALLRPMCHECK=$(rpm -qi $pkggp | awk '/Install Date/' | wc -l)
#echo $YUMINSTALLRPMCHECK
if [[ "$YUMINSTALLRPMCHECK" = '2' ]]; then
echo "----------------------------------------------------------------------------------"
# ${YUMDNFBIN}${CACHESKIP}-q -y update $pkgg
# ${YUMDNFBIN}${CACHESKIP} -q list $pkgg
echo "$pkgg already installed"
echo "----------------------------------------------------------------------------------"
else
echo "----------------------------------------------------------------------------------"
cecho "Installing $pkgg" $boldyellow
echo "----------------------------------------------------------------------------------"
${YUMDNFBIN}${CACHESKIP} -q -y install $pkggp${DISABLEREPO_DNF}
# ${YUMDNFBIN}${CACHESKIP} -q list $pkggp
echo "----------------------------------------------------------------------------------"
fi
done
sar_call
fi # /usr/local/src/curlinstall_yum.txt
${YUMDNFBIN}${CACHESKIP} -y -q install mytop iftop${DISABLEREPO_DNF}
if [ -f /usr/bin/mytop ]; then
sed -i 's/"long|!"/"long|long_nums|l!"/g' /usr/bin/mytop
fi
if [ ! -f /proc/user_beancounters ]; then
if [[ ! -f /usr/sbin/ipset || ! -f /usr/include/libipset/data.h ]]; then
yum -y install ipset ipset-devel${DISABLEREPO_DNF}
sar_call
fi
fi
yum clean all -q
yumcentossixdownload
yumcentossevendownload
axelsetup
geoipinstall
customrpms
if [[ "$CENTOS_SIX" = '6' ]]; then
REMI_IMAGEMAGICK_PKGNAME='6'
else
REMI_IMAGEMAGICK_PKGNAME=""
fi
# use Remi's ImageMagicK 6.9.* package
if [[ "$REMIREPO_DISABLE" = [nN] && "$(uname -m)" != 'aarch64' ]]; then
if [ -f /etc/yum.repos.d/remi.repo ]; then
if [[ "$(rpm -qi ImageMagick | grep 'Release' | grep -o remi >/dev/null 2>&1; echo $?)" = '0' || "$(rpm -qi ImageMagick6 | grep 'Release' | grep -o remi >/dev/null 2>&1; echo $?)" = '0' ]]; then
echo
echo "----------------------------------------------------------------------------------"
cecho "Using Remi YUM repo ImageMagicK version" $boldyellow
echo "----------------------------------------------------------------------------------"
if [[ "$INITIALINSTALL" != [yY] ]]; then
${YUMDNFBIN} -y install lcms2-devel libwebp7 libwebp7-devel OpenEXR-devel ilmbase-devel libGLU-devel libGL-devel mesa-libGL mesa-libGL-devel libXxf86vm libXxf86vm-devel --enablerepo=remi${DISABLEREPO_DNF}
else
${YUMDNFBIN} -y install lcms2-devel libwebp libwebp-devel OpenEXR-devel ilmbase-devel libGLU-devel libGL-devel mesa-libGL mesa-libGL-devel libXxf86vm libXxf86vm-devel --enablerepo=remi${DISABLEREPO_DNF}
fi
sar_call
if [[ "$CENTOS_SIX" = '6' ]]; then
# only applies to CentOS 6 and CentOS 7 remi ImageMagick yum package has been renamed from ImageMagick6 to ImageMagick
${YUMDNFBIN} -y remove ImageMagick${DISABLEREPO_DNF}
fi
sar_call
if [ -f /etc/yum/pluginconf.d/versionlock.conf ]; then
VERSIONLOCK_REPO=',versionlock'
else
VERSIONLOCK_REPO=""
fi
if [[ "$CENTOS_SIX" = '6' ]]; then
# ${YUMDNFBIN} -y install libwebp libwebp-devel --skip-broken
${YUMDNFBIN} -y install ImageMagick${REMI_IMAGEMAGICK_PKGNAME} ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-devel ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++ ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++-devel --enablerepo=remi --disableplugin=priorities --skip-broken${DISABLEREPO_DNF}
sar_call
else
if [[ "$(rpm -qa libwebp-devel)" ]]; then
yum -y swap libwebp-devel libwebp7-devel --enablerepo=remi
fi
# disable base as CentOS 7.8+ has ImageMagick packages of their own which may conflict with Remi's ImageMagick versions
${YUMDNFBIN} -y install ImageMagick ImageMagick-devel ImageMagick-c++ ImageMagick-c++-devel --enablerepo=remi --disableplugin=priorities${VERSIONLOCK_REPO}${DISABLEREPO_DNF} --disablerepo=base
sar_call
fi
echo
fi
if [[ "$(rpm -qi ImageMagick | grep 'Release' | grep -o remi >/dev/null 2>&1; echo $?)" = '0' || "$(rpm -qi ImageMagick6 | grep 'Release' | grep -o remi >/dev/null 2>&1; echo $?)" = '0' ]] && [[ -f /etc/yum.repos.d/remi.repo ]]; then
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ "$(rpm -qa libwebp-devel)" ]]; then
yum -y swap libwebp-devel libwebp7-devel --enablerepo=remi
fi
fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
${YUMDNFBIN} -y update ImageMagick${REMI_IMAGEMAGICK_PKGNAME} ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-devel ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++ ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++-devel --enablerepo=remi --disableplugin=priorities${VERSIONLOCK_REPO}${DISABLEREPO_DNF} --disablerepo=base
else
${YUMDNFBIN} -y update ImageMagick${REMI_IMAGEMAGICK_PKGNAME} ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-devel ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++ ImageMagick${REMI_IMAGEMAGICK_PKGNAME}-c++-devel --enablerepo=remi --disableplugin=priorities${VERSIONLOCK_REPO}${DISABLEREPO_DNF}
fi
sar_call
fi
fi
fi
# remove /tmp/curlinstaller-yum
rm -rf /tmp/curlinstaller-yum
# duplicate
# yum -y update${DISABLEREPO_DNF}
} 2>&1 | tee ${CENTMINLOGDIR}/centminmod_yumtimes_${DT}.log
yendtime=$(TZ=UTC date +%s.%N)
YINSTALLTIME=$(echo "scale=2;$yendtime - $ystarttime"|bc )
echo "" >> ${CENTMINLOGDIR}/centminmod_yumtimes_${DT}.log
echo "Total YUM Time: $YINSTALLTIME seconds" >> ${CENTMINLOGDIR}/centminmod_yumtimes_${DT}.log
echo "Total YUM Time: $YINSTALLTIME seconds" > ${CENTMINLOGDIR}/centminmod_profiletimes_${DT}.log
if [ -f /var/cache/yum/timedhosts.txt ]; then
\cp /var/cache/yum/timedhosts.txt ${CENTMINLOGDIR}/timedhosts_${DT}.txt
fi
ls -lah ${CENTMINLOGDIR}/centminmod_yumtimes_${DT}.log
}