[root@qing mysql]# cat init.sls
include:
- mysql.install
- mysql.config
[root@qing mysql]# cat install.sls
mysql_user:
user.present:
- name: mysql
- shell: /sbin/login
mysql_path:
file.directory:
- name: /usr/local/webserver/mysql/
- user: mysql
- group: mysql
- dir_mode: 755
- makidrs: True
- recurse:
- user
- group
- mode
mysql_trans:
file.managed:
- source: salt://mysql/files/mysql-5.5.15.tar.gz
- name: /tmp/mysql-5.5.15.tar.gz
- mode: 755
- unless: test -e /tmp/mysql-5.5.15.tar.gz
mysql_cmake:
pkg.installed:
- names:
- cmake
- ncurses-devel
- bison
- automake
- autoconf
- ncurses
- ncurses-*
cmd.run:
- cwd: /tmp/
- name: tar zxpf /tmp/mysql-5.5.15.tar.gz
mysql_install:
cmd.run:
- cwd: /tmp/mysql-5.5.15
- names:
- cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -Wno-dev
- make
- make install
[root@qing mysql]# cat config.sls
mysql_peizhi:
cmd.run:
- names:
- chown -R mysql:mysql /usr/local/webserver/mysql
- ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
- cp /usr/local/webserver/mysql/support-files/my-large.cnf /etc/my.cnf
- cp /usr/local/webserver/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
- /sbin/chkconfig --add mysqld
- /sbin/chkconfig mysqld on
- /usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/var/lib/mysql/
[root@qing mysql]# tree files/
files/
+-- mysql-5.5.15.tar.gz
0 directories, 1 file