目录:
[root@master opt]# tree
.
└── src
├── base
├── dev
├── prod
│?? ├── modules
│?? │?? ├── application
│?? │?? │?? └── php
│?? │?? │?? ├── files
│?? │?? │?? │?? ├── install.sh
│?? │?? │?? │?? ├── oniguruma-devel-6.8.2-2.el8.x86_64.rpm
│?? │?? │?? │?? ├── php-8.0.10.tar.gz
│?? │?? │?? │?? ├── php-fpm
│?? │?? │?? │?? ├── php-fpm.conf
│?? │?? │?? │?? ├── php-fpm.service
│?? │?? │?? │?? └── www.conf
│?? │?? │?? └── install.sls
│?? │?? ├── database
│?? │?? │?? └── mysql
│?? │?? │?? ├── file
│?? │?? │?? │?? ├── install.sh
│?? │?? │?? │?? ├── my.cnf
│?? │?? │?? │?? ├── mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
│?? │?? │?? │?? ├── mysqld.service
│?? │?? │?? │?? └── mysql.server
│?? │?? │?? └── install.sls
│?? │?? └── web
│?? │?? ├── apache
│?? │?? │?? ├── file
│?? │?? │?? │?? ├── apr-1.7.0.tar.gz
│?? │?? │?? │?? ├── apr-util-1.6.1.tar.gz
│?? │?? │?? │?? ├── httpd-2.4.51.tar.gz
│?? │?? │?? │?? ├── httpd.conf
│?? │?? │?? │?? ├── httpd.service
│?? │?? │?? │?? ├── index.php
│?? │?? │?? │?? └── install.sh
│?? │?? │?? └── install.sls
│?? │?? └── file
│?? └── zabbix
│?? ├── apache.sls
│?? ├── config.sls
│?? ├── files
│?? │?? ├── config.sls
│?? │?? ├── index.php
│?? │?? ├── install.sh
│?? │?? ├── my.cnf
│?? │?? ├── php.ini
│?? │?? ├── vhosts.conf
│?? │?? └── zabbix.5.4.4.tar.gz
│?? ├── install.sls
│?? ├── main.sls
│?? └── mysql.sls
└── test
18 directories, 34 files
apache状态文件
[root@master opt]# cd src/prod/modules/web/apache/
[root@master apache]# tree
.
├── file
│?? ├── apr-1.7.0.tar.gz
│?? ├── apr-util-1.6.1.tar.gz
│?? ├── httpd-2.4.51.tar.gz
│?? ├── httpd.conf
│?? ├── httpd.service
│?? ├── index.php
│?? └── install.sh
└── install.sls
1 directory, 8 files
[root@master apache]# cat install.sls
"Development Tools":
pkg.group_installed
apache_packages:
pkg.installed:
- pkgs:
- openssl-devel
- pcre-devel
- expat-devel
- libtool
- gcc
- gcc-c++
- make
apache_user:
user.present:
- name: apache
- createhome: false
- system: true
- shell: /sbin/nologin
apache-download:
file.managed:
- names:
- /usr/src/apr-1.7.0.tar.gz:
- source: salt://modules/web/apache/file/apr-1.7.0.tar.gz
- /usr/src/apr-util-1.6.1.tar.gz:
- source: salt://modules/web/apache/file/apr-util-1.6.1.tar.gz
- /usr/src/httpd-2.4.51.tar.gz:
- source: salt://modules/web/apache/file/httpd-2.4.51.tar.gz
/usr/lib/systemd/system/httpd.service:
file.managed:
- source: salt://modules/web/apache/file/httpd.service
- user: root
- group: root
- mode: '0644'
#salt://modules/web/apache/file/install.sh:
# cmd.script
/usr/local/apache/conf/httpd.conf:
file.managed:
- source: salt://modules/web/apache/file/httpd.conf
- user: root
- group: root
- mode: '0644'
[root@master apache]# cat file/install.sh
#! /bin/bash
cd /usr/src
rm -rf apr-1.7.0 apr-util-1.6.1 httpd-2.4.51
tar xf apr-1.7.0.tar.gz
tar xf apr-util-1.6.1.tar.gz
tar xf httpd-2.4.51.tar.gz
cd /usr/src/apr-1.7.0
sed -i '/$RM "$cfgfile"/d' configure
./configure --prefix=/usr/local/apr && make && make install
cd ../apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
cd ../httpd-2.4.51
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork && \ make && make install
echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
systemctl daemon-reload
[root@master apache]#
mysql状态文件
[root@master mysql]# ls file/
install.sh mysqld.service
my.cnf mysql.server
mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
[root@master mysql]# cat install.sls
ql-pkg:
pkg.installed:
- pkgs:
- ncurses-devel
- openssl
- openssl-devel
- make
- mariadb
- mariadb-devel
- ncurses-compat-libs
mysql-user:
user.present:
- name: mysql
- shell: /sbin/nologin
- createhome: false
- system: true
mysql-datadir:
file.directory:
- name: /opt/data
- user: mysql
- group: mysql
- mode: '0755'
- makedirs: true
/usr/src/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz:
file.managed:
- source: salt://modules/database/mysql/file/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
- user: mysql
- group: mysql
- mode: '0644'
'tar xf /usr/src/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz -C /usr/local':
cmd.run
/usr/local/mysql:
file.symlink:
- target: /usr/local/mysql-5.7.34-linux-glibc2.12-x86_64
- user: mysql
- group: mysql
- mode: '0644'
trasfer-files:
file.managed:
- names:
- /usr/local/mysql/support-files/mysql.server:
- source: salt://modules/database/mysql/file/mysql.server
- /usr/lib/systemd/system/mysqld.service:
- source: salt://modules/database/mysql/file/mysqld.service
salt://modules/database/mysql/file/install.sh:
cmd.script
[root@master mysql]# cat file/install.sh
/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/opt/data/
echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
systemctl daemon-reload
[root@master mysql]#
php状态文件
[root@master php]# ls files/
install.sh php-fpm.conf
oniguruma-devel-6.8.2-2.el8.x86_64.rpm php-fpm.service
php-8.0.10.tar.gz www.conf
php-fpm
[root@master php]# cat install.sls
pkg-install:
pkg.installed:
- pkgs:
- libxml2
- libxml2-devel
- bzip2
- openssl
- openssl-devel
- bzip2-devel
- libcurl
- libcurl-devel
- libicu-devel
- libjpeg
- libjpeg-devel
- libpng
- libpng-devel
- openldap-devel
- pcre-devel
- freetype
- freetype-devel
- gmp
- gmp-devel
- libmcrypt
- libmcrypt-devel
- readline
- readline-devel
- libxslt
- libxslt-devel
- mhash
- mhash-devel
- php-mysqlnd
- libsqlite3x-devel
- oniguruma
- libzip-devel
'yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm':
cmd.run
/usr/src/php-8.0.10.tar.xz:
file.managed:
- source: salt://modules/application/php/file/php-8.0.10.tar.xz
- user: root
- group: root
- mode: '0644'
salt://modules/application/php/files/install.sh:
cmd.script
copysoft:
file.managed:
- names:
- /etc/init.d/php-fpm:
- source: salt://modules/application/php/file/php-fpm
- user: root
- group: root
- mode: '0755'
- /usr/local/php/etc/php-fpm.conf:
- source: salt://modules/application/php/file/php-fpm.conf
- /usr/local/php/etc/php-fpm.d/www.conf:
- source: salt://modules/application/php/file/www.conf
- /usr/lib/systemd/system/php-fpm.service:
- source: salt://modules/application/php/file/php-fpm.service
[root@master php]# cat files/install.sh
#! /bin/bash
cd /usr/src/
rm -rf php-8.0.10
tar xf php-8.0.10.tar.xz
cd php-8.0.10
./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --disable-debug --disable-rpath --enable-shared --enable-soap --with-openssl --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --enable-gd --with-jpeg --with-zlib-dir --with-freetype --with-gettext --enable-mbstring --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --enable-shmop --enable-simplexml --enable-sockets --with-zip --enable-mysqlnd-compression-support --with-pear --enable-pcntl --enable-posix && make && make install
[root@master php]#
|