一键部署gpmall脚本

部署gpmall

  • 基础环境
[root@node ~]# ls
gpmall-single.tar.gz

[root@node ~]# vim local.repo
[centos]
name=centos
baseurl=http://172.25.253.3/zwh/centos/
gpgcheck=0

[gpmall]
name=gpmall
baseurl=http://172.25.253.3/zwh/gpmall-repo/
gpgcheck=0
  • 编写default.conf

[root@node ~]# cp /etc/nginx/conf.d/default.conf .
[root@node ~]# vim default.conf 
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    location /user {
        proxy_pass http://127.0.0.1:8082;
    }
    
    location /shopping {
        proxy_pass http://127.0.0.1:8081;
    }

    location /cashier {
        proxy_pass http://127.0.0.1:8083; 
    } 
   ....
}
  • 编写my.cnf

# vi /etc/my.cnf
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
  • 编写脚本
#!/bin/bash 
passwd=000000

Init(){
    echo -e "\033[32;40m===正在配置基础环境===\033[0m"
    mv own/ /opt/
    mv /etc/yum.repos.d/* /media/ 
    mv local.repo /etc/yum.repos.d/local.repo 
    yum install -y httpd mariadb mariadb-server unzip php72w php72w-*
}

ConfigOwn(){
    echo -e "\033[32;40m===正在配置Owncloud环境===\033[0m"
    systemctl start php-fpm && systemctl enable  php-fpm
    systemctl start mariadb && systemctl enable mariadb 
    systemctl start httpd && systemctl enable httpd 
    unzip owncloud-complete-20200731.zip
    cp -r owncloud /var/www/html/ 
    chown -R apache:apache /var/www/html/owncloud/ 
}

Mariadb(){
    echo -e "\033[32;40m===正在配置数据库环境===\033[0m"
    mysqladmin -uroot password ${passwd}
    mysql -uroot -p${passwd} -e "create database owncloud;"
    mysql -uroot -p${passwd} -e "grant all privileges  on *.* to root@'%' identified by '${passwd}';"
    mysql -uroot -p${passwd} -e "grant all privileges  on *.* to root@localhost identified by '${passwd}';"
    systemctl restart httpd
    systemctl restart php-fpm
}

Init
ConfigOwn
Mariadb

 

posted @ 2022-03-15 07:54  衡衡酱  阅读(1)  评论(0)    收藏  举报
Live2D