From 79fe8b00b4819d87aa67158ceed4c300e04bad3b Mon Sep 17 00:00:00 2001 From: Timothy Prepscius Date: Sun, 18 Aug 2013 16:09:58 -0400 Subject: [PATCH] adds setting up mysql --- install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO | 14 +++++++++-- install/setup-mysql | 23 +++++++++++++++++++ install/setup-mysql.remote | 6 +++++ install/setup-mysql.sql.template | 14 +++++++++++ install/setup-server | 2 +- 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100755 install/setup-mysql create mode 100755 install/setup-mysql.remote create mode 100644 install/setup-mysql.sql.template diff --git a/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO b/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO index 1341d88..60e2599 100644 --- a/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO +++ b/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO @@ -31,6 +31,9 @@ to the target machine. installing off of. Take a look at "enable_ec2_login" for what this means. +6. You MUST have your passwords setup, if you are just running this as a test it is easiest to run + "make" from within the mailiverse/passwords directory. This will create passwords using /dev/urandom + --- Ok now you are ready to go. @@ -39,6 +42,13 @@ from the install directory type in ./setup-server YOUR-SERVER-IP-NAME-WHATEVER -and it should create the various accounts for the system and enable ssh publickey access to them. -it should download apache james and enable it +and it should +1. create the various accounts for the system and enable ssh publickey access to them +from the computer/account you are running on now + +2. it should download apache james + +4. it should download and install java (oracle, don't use others with apache james, they crash) + +3. it should download and install mysql and set up the users and databases. diff --git a/install/setup-mysql b/install/setup-mysql new file mode 100755 index 0000000..5de6492 --- /dev/null +++ b/install/setup-mysql @@ -0,0 +1,23 @@ +set -x + +source requirements/server_root_account + +MAIL_PASSWORD=`cat ../passwords/mail` +MAIL_EXTRA_PASSWORD=`cat ../passwords/mail_extra` +JAMES_PASSWORD=`cat ../passwords/james` +CAPTCHA_PASSWORD=`cat ../passwords/captcha` + +M_HOST=$1 + +`\ +sed \ + -e ''s/MAIL_PASSWORD/$MAIL_PASSWORD/'' \ + -e ''s/MAIL_EXTRA_PASSWORD/$MAIL_EXTRA_PASSWORD/'' \ + -e ''s/JAMES_PASSWORD/$JAMES_PASSWORD/'' \ + -e ''s/CAPTCHA_PASSWORD/$CAPTCHA_PASSWORD/'' \ + setup-mysql.sql.template > setup-mysql.sql \ +` + +scp setup-mysql.remote $M_ROOT@$M_HOST: +scp setup-mysql.sql $M_ROOT@$M_HOST: +ssh $M_ROOT@$M_HOST ./setup-mysql.remote diff --git a/install/setup-mysql.remote b/install/setup-mysql.remote new file mode 100755 index 0000000..55b427a --- /dev/null +++ b/install/setup-mysql.remote @@ -0,0 +1,6 @@ +set -x + +sudo apt-get install mysql-server --yes + +mysql -u root < setup-mysql.sql +rm setup-mysql.sql diff --git a/install/setup-mysql.sql.template b/install/setup-mysql.sql.template new file mode 100644 index 0000000..263caff --- /dev/null +++ b/install/setup-mysql.sql.template @@ -0,0 +1,14 @@ +CREATE DATABASE mail CHARACTER SET utf8; +CREATE DATABASE mail_extra CHARACTER SET utf8; +CREATE DATABASE captcha CHARACTER SET utf8; +CREATE DATABASE james CHARACTER SET utf8; + +CREATE USER 'mail'@'localhost' IDENTIFIED BY 'MAIL_PASSWORD'; +CREATE USER 'mail_extra'@'localhost' IDENTIFIED BY 'MAIL_EXTRA_PASSWORD'; +CREATE USER 'captcha'@'localhost' IDENTIFIED BY 'CAPTCHA_PASSWORD'; +CREATE USER 'james'@'localhost' IDENTIFIED BY 'JAMES_PASSWORD'; + +GRANT ALL PRIVILEGES ON *.mail TO 'mail'@'localhost'; +GRANT ALL PRIVILEGES ON *.mail_extra TO 'mail_extra'@'localhost'; +GRANT ALL PRIVILEGES ON *.captcha TO 'captcha'@'localhost'; +GRANT ALL PRIVILEGES ON *.james TO 'james'@'localhost'; diff --git a/install/setup-server b/install/setup-server index d43e78c..334d72d 100755 --- a/install/setup-server +++ b/install/setup-server @@ -7,4 +7,4 @@ M_HOST=$1 ./create-server-accounts $M_HOST ./setup-james $M_HOST ./setup-java $M_HOST - +./setup-mysql $M_HOST