Skip to content

Commit d1da16c

Browse files
committed
Release 2.1.0
1 parent 6c6c067 commit d1da16c

File tree

18 files changed

+398
-288
lines changed

18 files changed

+398
-288
lines changed

CHANGELOG

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ Moss Changelog
66
- Feature remove;
77

88

9-
2.0.1
9+
2.1.0
1010
=====
11-
2016-MM-DD
12-
! Update to support Nginx 1.10.x and above;
11+
2016-08-27
12+
! Update to support Nginx 1.10.x;
13+
! Update to support PHP 7.0.x;
14+
! MySQL and Redis password generates by random and save to /root/.my.cnf
15+
and /root/.moss;
1316
+ Add YUM Priorities plugin. CentOS-Base set to 1, CentOS-Plus set to 2
1417
and EPEL set to 3;
15-
+ Add dmidecode RPM;
18+
+ Add dmidecode curl c-ares RPMs;
1619
* Set default LANG and LC_ALL to en_US.UTF-8;
1720
* Fix Vim statusline;
1821
* vimrc optimized;
@@ -25,7 +28,10 @@ Moss Changelog
2528
* Optimize sysctl.conf;
2629
* Update Nginx SSL configuration;
2730
* Update Nginx PHP and MySQL logrotate policy;
31+
* Use NTP service instead of ntpdate cron job;
32+
* Use system default curl and c-ares to compile PHP;
2833
* Fix redis init script stop fail when requirepass used;
34+
* MySQL bind to 127.0.0.1 by default;
2935
* Redis bind to 127.0.0.1 by default;
3036
* redis.conf and redis init script set to 0600 and 0700;
3137
- Remove htop RPM;

common/config_sys.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ fi
5858

5959
## ntp client
6060
if ! grep '^SET_NTP' ${INST_LOG} > /dev/null 2>&1 ;then
61-
install -m 0644 ${TOP_DIR}/conf/ntp/ntp_client.conf /etc/ntp.conf
62-
if ! grep 'Moss Time Sync' /var/spool/cron/root > /dev/null 2>&1 ;then
63-
echo '' >> /var/spool/cron/root
64-
echo '# Moss Time Sync' >> /var/spool/cron/root
65-
echo '0 * * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1;/sbin/hwclock -w > /dev/null 2>&1' >> /var/spool/cron/root
66-
chown root:root /var/spool/cron/root
67-
chmod 600 /var/spool/cron/root
68-
/etc/rc.d/init.d/ntpd stop
69-
chkconfig ntpd off
70-
fi
61+
#install -m 0644 ${TOP_DIR}/conf/ntp/ntp_client.conf /etc/ntp.conf
62+
#if ! grep 'Moss Time Sync' /var/spool/cron/root > /dev/null 2>&1 ;then
63+
#echo '' >> /var/spool/cron/root
64+
#echo '# Moss Time Sync' >> /var/spool/cron/root
65+
#echo '0 * * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1;/sbin/hwclock -w > /dev/null 2>&1' >> /var/spool/cron/root
66+
#chown root:root /var/spool/cron/root
67+
#chmod 600 /var/spool/cron/root
68+
/etc/rc.d/init.d/ntpd restart
69+
chkconfig ntpd on
70+
#fi
7171
## log installed tag
7272
echo 'SET_NTP' >> ${INST_LOG}
7373
fi
@@ -247,12 +247,12 @@ fi
247247

248248
## system service
249249
if ! grep '^SYS_SERVICE' ${INST_LOG} > /dev/null 2>&1 ;then
250-
for SVC_ON in acpid atd auditd autofs cpuspeed crond haldaemon irqbalance messagebus network nscd portmap rsyslog sshd sysstat udev-post;do
250+
for SVC_ON in acpid atd auditd autofs cpuspeed crond haldaemon irqbalance messagebus network nscd ntpd portmap rsyslog sshd sysstat udev-post;do
251251
chkconfig $SVC_ON on 2>/dev/null
252252
service $SVC_ON start 2>/dev/null
253253
done
254254

255-
for SVC_OFF in arptables_jf arpwatch ip6tables iptables ipsec kdump mdmonitor netconsole netfs nfs nfslock ntpd ntpdate postfix psacct quota_nld rdisc restorecond rngd rpcbind rpcgssd rpcsvcgssd saslauthd smartd snmpd snmptrapd svnserve winbind;do
255+
for SVC_OFF in arptables_jf arpwatch ip6tables iptables ipsec kdump mdmonitor netconsole netfs nfs nfslock postfix psacct quota_nld rdisc restorecond rngd rpcbind rpcgssd rpcsvcgssd saslauthd smartd snmpd snmptrapd svnserve winbind;do
256256
chkconfig $SVC_OFF off 2>/dev/null
257257
service $SVC_OFF stop 2>/dev/null
258258
done

common/install_rpm.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ blktrace
3838
byacc
3939
bzip2-devel
4040
c-ares
41+
c-ares19
4142
c-ares-devel
43+
c-ares19-devel
4244
cmake
4345
crontabs
4446
curl-devel
@@ -66,7 +68,6 @@ graphviz
6668
iftop
6769
iotop
6870
iptraf
69-
jwhois
7071
lftp
7172
libaio-devel
7273
libjpeg-devel
@@ -136,18 +137,17 @@ fi
136137
## install saltstack
137138
if [ ${INST_SALT} -eq 1 2>/dev/null ]; then
138139
if ! grep '^YUM_SALT' ${INST_LOG} > /dev/null 2>&1 ;then
139-
succ_msg "Getting SaltStack repository key..."
140-
wget -c -t10 -nH -T900 https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub -P /tmp || fail_msg "Getting SaltStack Key Failed!"
141-
rpm --import /tmp/SALTSTACK-GPG-KEY.pub
142-
rm -f /tmp/SALTSTACK-GPG-KEY.pub
143-
install -m 0644 ${TOP_DIR}/conf/yum/saltstack.repo /etc/yum.repos.d/saltstack.repo
140+
succ_msg "Getting SaltStack repository ..."
141+
yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el6.noarch.rpm || fail_msg "Getting SaltStack Repository Failed!"
142+
echo 'priority=1' >> salt-latest.repo
144143
yum clean expire-cache
145144
yum install --disablerepo=epel salt-minion -y || fail_msg "SaltStack Minion Install Failed!"
146145
[ -f "/etc/salt/minion" ] && rm -f /etc/salt/minion
147146
install -m 0644 ${TOP_DIR}/conf/saltstack/minion /etc/salt/minion
148147
sed -i "s#^master.*#master: ${SALT_MASTER}#" /etc/salt/minion
149-
chkconfig salt-minion on
148+
[ ! -d '/var/log/salt' ] && mkdir -m 0755 -p /var/log/salt
150149
service salt-minion start
150+
chkconfig salt-minion on
151151
## log installed tag
152152
echo 'YUM_SALT' >> ${INST_LOG}
153153
fi

common/uninstall.sh

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ if [ ! -f "${INST_LOG}" ];then
77
fail_msg "Quit Moss uninstallation!"
88
fi
99

10+
1011
## uninstall Redis
1112
if grep '^REDIS$' ${INST_LOG} > /dev/null 2>&1 ; then
1213
y_or_n 'Do you want to remove Redis?' 'n'
@@ -53,6 +54,7 @@ if grep '^REDIS$' ${INST_LOG} > /dev/null 2>&1 ; then
5354
fi
5455
fi
5556

57+
5658
## uninstall MySQL
5759
if grep '^MYSQL$' ${INST_LOG} > /dev/null 2>&1 ; then
5860
y_or_n 'Do you want to remove MySQL?' 'n'
@@ -126,6 +128,7 @@ if grep '^MYSQL$' ${INST_LOG} > /dev/null 2>&1 ; then
126128
fi
127129
fi
128130

131+
129132
## uninstall Nginx
130133
if grep '^NGINX$' ${INST_LOG} > /dev/null 2>&1 ; then
131134
y_or_n 'Do you wish to remove Nginx?' 'n'
@@ -186,6 +189,7 @@ if grep '^NGINX$' ${INST_LOG} > /dev/null 2>&1 ; then
186189
fi
187190
fi
188191

192+
189193
## uninstall PHP
190194
if grep '^PHP$' ${INST_LOG} > /dev/null 2>&1 ; then
191195
y_or_n 'Do you wish to remove PHP?' 'n'
@@ -239,35 +243,3 @@ if grep '^PHP$' ${INST_LOG} > /dev/null 2>&1 ; then
239243
sleep 3
240244
fi
241245
fi
242-
243-
## uninstall CURL
244-
if grep '^CURL$' ${INST_LOG} > /dev/null 2>&1 ; then
245-
y_or_n 'Do you wish to remove CURL?' 'n'
246-
DEL_CURL=${USER_INPUT}
247-
248-
if [ "${DEL_CURL}" = 'y' ];then
249-
rm -f /usr/local/curl
250-
rm -rf ${INST_DIR}/curl-*
251-
252-
sed -i "/^CURL$/d" ${INST_LOG}
253-
254-
succ_msg "CURL has been removed from your system!"
255-
sleep 3
256-
fi
257-
fi
258-
259-
## uninstall C-Ares
260-
if grep '^CARES$' ${INST_LOG} > /dev/null 2>&1 ; then
261-
y_or_n 'Do you wish to remove C-Ares?' 'n'
262-
DEL_CARES=${USER_INPUT}
263-
264-
if [ "${DEL_CARES}" = 'y' ];then
265-
rm -f /usr/local/c-ares
266-
rm -rf ${INST_DIR}/c-ares-*
267-
268-
sed -i "/^CARES$/d" ${INST_LOG}
269-
270-
succ_msg "C-Ares has been removed from your system!"
271-
sleep 3
272-
fi
273-
fi

compile/cares.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

compile/curl.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

compile/mysql.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if ! grep '^MYSQL$' ${INST_LOG} > /dev/null 2>&1 ; then
5050
## init scripts
5151
install -m 0755 ${SYMLINK}/support-files/mysql.server /etc/init.d/mysqld
5252
chkconfig --add mysqld
53-
chkconfig --level 35 mysqld on
53+
chkconfig --level mysqld on
5454
## start
5555
service mysqld start
5656
sleep 3
@@ -74,6 +74,8 @@ if ! grep '^MYSQL$' ${INST_LOG} > /dev/null 2>&1 ; then
7474
# fi
7575
#done
7676

77+
MYSQL_ROOT_PASS=$(mkpasswd -s 0 -l 12)
78+
MYSQL_MULADMIN_PASS=$(mkpasswd -s 0 -l 12)
7779
/usr/local/mysql/bin/mysqladmin -uroot password "${MYSQL_ROOT_PASS}"
7880
/usr/local/mysql/bin/mysqladmin -h127.0.0.1 -uroot password "${MYSQL_ROOT_PASS}"
7981

compile/nginx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if ! grep '^NGINX$' ${INST_LOG} > /dev/null 2>&1 ;then
101101
## init scripts
102102
install -m 0755 ${TOP_DIR}/conf/nginx/nginx.init /etc/init.d/nginx
103103
chkconfig --add nginx
104-
chkconfig --level 35 nginx on
104+
chkconfig --level nginx on
105105
## start
106106
service nginx start
107107
sleep 3

compile/php.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@ if ! grep '^PHP$' ${INST_LOG} > /dev/null 2>&1 ;then
1515
# fix openldap libs link
1616
cp -frp /usr/lib64/libldap* /usr/lib/
1717

18-
CURL_SYMLINK=$(readlink -f /usr/local/curl)
19-
CURL_DIR=${CURL_SYMLINK:-/usr/local/curl}
20-
21-
LDFLAGS="-L${CURL_DIR}/lib -Wl,-rpath,${CURL_DIR}/lib"
22-
CPPFLAGS="-I${CURL_DIR}/include"
23-
2418
CONFIG="./configure \
2519
--prefix=${INST_DIR}/${SRC_DIR} \
2620
--with-config-file-path=${INST_DIR}/${SRC_DIR}/etc \
27-
--with-curl=${CURL_DIR} \
21+
--with-curl \
2822
--with-mysqli=mysqlnd \
2923
--with-pdo-mysql=mysqlnd \
3024
--with-openssl \
@@ -99,7 +93,7 @@ if ! grep '^PHP$' ${INST_LOG} > /dev/null 2>&1 ;then
9993
## init scripts
10094
install -m 0755 ${TOP_DIR}/conf/php/php-fpm.init /etc/init.d/php-fpm
10195
chkconfig --add php-fpm
102-
chkconfig --level 35 php-fpm on
96+
chkconfig --level php-fpm on
10397
## start
10498
service php-fpm start
10599
sleep 3

compile/redis.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ if ! grep '^REDIS$' ${INST_LOG} > /dev/null 2>&1 ;then
2323

2424
## for install config files
2525
SYMLINK='/usr/local/redis'
26+
RDS_PASS=$(mkpasswd -s 0 -l 12)
27+
echo ${RDS_PASS} > /root/.moss/redis.pass
28+
chmod 600 /root/.moss/redis.pass
2629
succ_msg "Begin to install ${SRC_DIR} config files"
2730
## user add
2831
id redis >/dev/null 2>&1 || useradd redis -u 1003 -M -s /sbin/nologin -d ${RDS_DATA_DIR}
2932
## data dir
30-
[ ! -d "${RDS_DATA_DIR}" ] && mkdir -m 0755 -p ${RDS_DATA_DIR}
33+
[ ! -d ${RDS_DATA_DIR} ] && mkdir -m 0755 -p ${RDS_DATA_DIR}
3134
chown redis:redis -R ${RDS_DATA_DIR}
3235
## log dir
33-
[ ! -d "/var/log/redis" ] && mkdir -m 0755 -p /var/log/redis
36+
[ ! -d '/var/log/redis' ] && mkdir -m 0755 -p /var/log/redis
3437
chown redis:redis -R /var/log/redis
3538
## conf
3639
RD_ROLE_TMP=0
@@ -63,7 +66,7 @@ if ! grep '^REDIS$' ${INST_LOG} > /dev/null 2>&1 ;then
6366
install -m 0700 ${TOP_DIR}/conf/redis/redis.init /etc/init.d/redis
6467
sed -i "s#REDISPASS=.*#REDISPASS=${RDS_PASS}#" /etc/init.d/redis
6568
chkconfig --add redis
66-
chkconfig --level 35 redis on
69+
chkconfig --level redis on
6770
## start
6871
service redis start
6972
sleep 3

0 commit comments

Comments
 (0)