forked from Ubuntu-ve/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_sw.sh
173 lines (153 loc) · 8.72 KB
/
check_sw.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
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
#!/bin/bash
# Author: Alpha Eva <kaneawk AT gmail.com>
#
# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
#
# Project home page:
# https://oneinstack.com
# https://github.com/lj2007331/oneinstack
installDepsDebian() {
echo "${CMSG}Removing the conflicting packages...${CEND}"
pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
for Package in ${pkgList};do
apt-get -y remove --purge ${Package}
done
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
apt-get -y update
echo "${CMSG}Installing dependencies packages...${CEND}"
# critical security updates
grep security /etc/apt/sources.list > /tmp/security.sources.list
apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
apt-get -y autoremove
# Install needed packages
case "${Debian_version}" in
[6,7])
pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
;;
8)
pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
;;
9)
pkgList="gcc g++ make cmake autoconf libjpeg62-turbo-dev libjpeg-dev libpng-dev libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl1 patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
;;
*)
echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}"
kill -9 $$
;;
esac
for Package in ${pkgList}; do
apt-get -y install ${Package}
done
}
installDepsCentOS() {
sed -i 's@^exclude@#exclude@' /etc/yum.conf
yum clean all
yum makecache
# Uninstall the conflicting packages
echo "${CMSG}Removing the conflicting packages...${CEND}"
if [ "${CentOS_RHEL_version}" == '7' ]; then
yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server"
systemctl mask firewalld.service
if [ "$iptables_yn" == 'y' ]; then
yum -y install iptables-services
systemctl enable iptables.service
fi
elif [ "${CentOS_RHEL_version}" == '6' ]; then
yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client"
elif [ "${CentOS_RHEL_version}" == '5' ]; then
yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution"
fi
echo "${CMSG}Installing dependencies packages...${CEND}"
yum check-update
# Install needed packages
pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sqlite-devel sysstat patch bc expect expat-devel rsync rsyslog git lsof lrzsz wget"
for Package in ${pkgList}; do
yum -y install ${Package}
done
yum -y update bash openssl glibc
# use gcc-4.4
if [ -n "$(gcc --version | head -n1 | grep '4\.1\.')" ]; then
yum -y install gcc44 gcc44-c++ libstdc++44-devel
export CC="gcc44" CXX="g++44"
fi
}
installDepsUbuntu() {
# Uninstall the conflicting software
echo "${CMSG}Removing the conflicting packages...${CEND}"
pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
for Package in ${pkgList}; do
apt-get -y remove --purge ${Package}
done
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
apt-get autoremove
echo "${CMSG}Installing dependencies packages...${CEND}"
apt-get -y update
# critical security updates
grep security /etc/apt/sources.list > /tmp/security.sources.list
apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
# Install needed packages
pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect libexpat1-dev iptables rsyslog rsync git lsof lrzsz ntpdate wget sysv-rc"
for Package in ${pkgList}; do
apt-get -y install ${Package} --force-yes
done
if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then
apt-get -y install libcloog-ppl1
apt-get -y remove bison
ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype
elif [ "${Ubuntu_version}" == "13" ]; then
apt-get -y install bison libcloog-ppl1
elif [ "${Ubuntu_version}" == "12" ]; then
apt-get -y install bison libcloog-ppl0
else
apt-get -y install bison libcloog-ppl1
fi
}
installDepsBySrc() {
pushd ${oneinstack_dir}/src
if [ "${OS}" == "Ubuntu" ]; then
if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then
# Install bison on ubt 14.x 15.x
tar xzf bison-${bison_version}.tar.gz
pushd bison-${bison_version}
./configure
make -j ${THREAD} && make install
popd
rm -rf bison-${bison_version}
fi
elif [ "${OS}" == "CentOS" ]; then
# Install tmux
if [ ! -e "$(which tmux)" ]; then
# Install libevent first
tar xzf libevent-${libevent_version}.tar.gz
pushd libevent-${libevent_version}
./configure
make -j ${THREAD} && make install
popd
rm -rf libevent-${libevent_version}
tar xzf tmux-${tmux_version}.tar.gz
pushd tmux-${tmux_version}
CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
make -j ${THREAD} && make install
unset LDFLAGS
popd
rm -rf tmux-${tmux_version}
if [ "${OS_BIT}" == "64" ]; then
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
else
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
fi
fi
# install htop
if [ ! -e "$(which htop)" ]; then
tar xzf htop-${htop_version}.tar.gz
pushd htop-${htop_version}
./configure
make -j ${THREAD} && make install
popd
rm -rf htop-${htop_version}
fi
else
echo "No need to install software from source packages."
fi
popd
}