Walle 구축 스 크 립 트

4334 단어
#!/bin/bash

NGINX_CONF="/etc/nginx/nginx.conf"
PHP_FPM_CONF="/etc/php-fpm.d/www.conf"
PHP_LOG="/var/log/php-fpm"
INIT_FILE="/etc/rc.local"
NGINX_USER="walle"
mkdir /data
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 
yum install net-tools openssh-server nginx php70w-fpm php70w-pdo php70w-pdo \
                  php70w-mysql php70w-xml php70w-gd php70w-mcrypt php70w-mbstring \
                  bzip2 php70w-pecl-redis mariadb mariadb-server  nginx openssh-server openssh-clients lrzsz redis -y 
useradd -m ${NGINX_USER} -s /bin/bash 
sed -i "/events/ause epoll;" $NGINX_CONF 
sed -i "s/^user.*/user $NGINX_USER;/" $NGINX_CONF 
sed -i "s/worker_connections.*/worker_connections 65535;/" $NGINX_CONF 
sed -i "/access_log/aunderscores_in_headers on;" $NGINX_CONF 
sed -i "/access_log/agzip_http_version 1.1;" $NGINX_CONF 
sed -i "/access_log/agzip_buffers 4 16k;" $NGINX_CONF 
sed -i "/access_log/agzip_vary on;" $NGINX_CONF 
sed -i "/access_log/agzip_types text/plain application/javascript text/css application/xml application/x-httpd-php image/jpeg image/gif image/png;" $NGINX_CONF 
sed -i "/access_log/agzip_comp_level 4;" $NGINX_CONF 
sed -i "/access_log/agzip_min_length 1k;" $NGINX_CONF 
sed -i "/access_log/agzip on;" $NGINX_CONF 
sed -i '/server/,/$#/d' $NGINX_CONF 
sed -i '$a }' $NGINX_CONF 
sed -i "s/^user.*/user = $NGINX_USER/" $PHP_FPM_CONF 
sed -i "s/^group.*/group = $NGINX_USER/" $PHP_FPM_CONF 
chown -R ${NGINX_USER}.root $PHP_LOG 
chown -R ${NGINX_USER}.${NGINX_USER} /var/lib/nginx 
chown -R ${NGINX_USER}.${NGINX_USER} /var/log/nginx 
ulimit -n 65535 
sed -i '$a ulimit -n 65535' $INIT_FILE 
sed -i '$a source /etc/profile' $INIT_FILE 
curl -sS https://getcomposer.org/installer | php 
mv composer.phar /usr/local/bin/composer 
npm install -g grunt 
npm install -g cnpm --registry=https://registry.npm.taobao.org 
systemctl start nginx mariadb sshd php-fpm redis
systemctl enable sshd nginx mariadb php-fpm redis
chown -R ${NGINX_USER}.${NGINX_USER} /data 
yum clean all
su - walle -c "composer config -g repo.packagist composer https://packagist.phpcomposer.com"

walle.sh
#!/bin/bash

echo -e "  \033[33m     create lnmp environment \033[0m"
sleep 2
sh lnmp.sh

echo -e "  \033[33m     create walle environment \033[0m"

echo "
####################################################################
#   CentOS 7            nginx-1.1.12                              ##
#                                                                 ##
#   walle-web-0.9.5                                               ##
#                                                                 ##
#   mysql-5.5           php-7.0.30                                ##
####################################################################
"

#Required environment 
#Environment path
DIR="/walle"
DIR_WALLE="$DIR/walle-web-0.9.5"
FILE="/walle/walle-web"
DIR_VENDOR="$DIR/vendor"
USER="walle"

#work dir
mkdir ${DIR}
tar xf walle-web.vendor.tgz -C $DIR
tar xf v0.9.5 -C $DIR
mv ${DIR_WALLE} ${FILE} && rm -rf $DIR_WALLE
mv ${DIR_VENDOR} ${FILE}

#mysql need database walle 
mysql -e "CREATE DATABASE walle;UPDATE mysql.user SET Password=PASSWORD(123456) WHERE User='root';FLUSH PRIVILEGES;"

#
cat ${FILE}/config/local.php | grep -A 3 'db' | sed -i "s#'dsn'       => 'mysql:host=127.0.0.1;dbname=walle'#'dsn'       => 'mysql:host=127.0.0.1;dbname=walle'#g" $FILE/config/local.php
cat ${FILE}/config/local.php | grep -A 3 'db' | sed -i "s#'username'  => ''#'username'  => 'root'#g"  $FILE/config/local.php
cat ${FILE}/config/local.php | grep -A 3 'db' | sed -i "s#'password'  => ''#'password'  => '123456'#g" $FILE/config/local.php
\cp walle.conf /etc/nginx/conf.d/
chown -R ${USER}.${UESR} $DIR

echo -e "\033[41;37m  need your yes  \033[0m"
sleep 2
systemctl restart nginx mariadb  php-fpm
/walle/walle-web/./yii run/setup

좋은 웹페이지 즐겨찾기