Skip to content

Instantly share code, notes, and snippets.

@ellipsonic
Last active August 29, 2015 14:24
Show Gist options
  • Save ellipsonic/3dbd3f9dced3741c718f to your computer and use it in GitHub Desktop.
Save ellipsonic/3dbd3f9dced3741c718f to your computer and use it in GitHub Desktop.
Magekart - DB server
#!/bin/bash
#Instructions to use this script
#
#chmod +x SCRIPTNAME.sh
#
#sudo ./SCRIPTNAME.sh
echo "###################################################################################"
echo "Please be Patient: Installation will start now.......and it will take some time :)"
echo "###################################################################################"
#Update the repositories
apt-get update
apt-get -y install sudo
apt-get -y install nano
sudo su
sudo apt-get update
#MySQL and required packages installation
sudo apt-get -y install curl
sudo apt-get -y install git
#The following commands set the MySQL root password to root when you install the mysql-server package.
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get -y install mysql-server
# Create DB
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION" | mysql -u root -proot
echo "GRANT PROXY ON ''@'' TO 'root'@'%' WITH GRANT OPTION" | mysql -u root -proot
mysql -u root -e "CREATE DATABASE IF NOT EXISTS magento_5" -proot
mysql -u root -e "GRANT ALL PRIVILEGES ON magento_5.* TO 'root'@'localhost' IDENTIFIED BY 'root'" -proot
#Let any server access this database, if the username is root and password is root
mysql -u root -e "GRANT ALL ON magento_5.* TO 'root'@'%' IDENTIFIED BY 'root'" -proot
mysql -u root -e "FLUSH PRIVILEGES" -proot
sleep 15s
# Git all mysql files
cd /tmp
git clone https://github.com/ellipsonic/magekart_db.git .
mysql -u root magento_5 < /tmp/magento_5.sql -proot
# Allow any server to connect
sed -i "s/bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
echo "USE magento_5;update core_config_data set value = '{{base_url}}' where path = 'web/unsecure/base_url';" | mysql -u root -proot
echo "USE magento_5;update core_config_data set value = '{{base_url}}' where path = 'web/secure/base_url';" | mysql -u root -proot
#Restart all the installed services to verify that everything is installed properly
echo -e "\n"
service apache2 stop && service mysql restart > /dev/null
echo -e "\n"
if [ $? -ne 0 ]; then
echo "Please Check the Install Services, There is some $(tput bold)$(tput setaf 1)Problem$(tput sgr0)"
else
echo "Installed Services run $(tput bold)$(tput setaf 2)Sucessfully$(tput sgr0)"
fi
echo -e
@ellipsonic
Copy link
Author

With {{base_url}} changes to accept multiple app servers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment