I have an AWS instance running CentOS 6.5. It has been updated, secured, and setup for web hosting (LAMP). I attached an EBS volume to the instance and mounted it under /data.
Two questions:
How can I get MySQL to use the
/datadirectory as its database storage location? (I don't want to run the program from the/datadirectory, just put the .sql file there.How can I do the same for my web site? I plan on running a wordpress site and its current location is in the
/var/www/htmldirectory. I want to change this to/data/site.
I want to keep the web site files and database on a separate volume: /data. If my instance was to get corrupt or inaccessible, I can attach the EBS volume to a new instance.
I have read dozens of tutorials and articles on how to get MySQL moved to a different directory, but nothing is working. MySQL refuses to start up after. Can I keep MySQL installed as is, but have it read/write the database on a different directory like /data which is a mounted EBS volume or is this not possible at all with linux?
Here are some of the tutorials and articles I been following/testing with:
aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1
spruce.it/noise/setting-up-a-proper-lamp-stack-on-aws-ec2-ebs/
EDIT: This is what I am doing.
Create a new instance using this ami:
https://aws.amazon.com/marketplace/pp/B00IOYDTV6?ref=cns_srchrowOnce the instance is up, I run updates using:
sudo yum update -yOne updated, I set it up as a LAMP web server using these instructions:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.htmlIn addition to the above steps, I allow port 80 tcp connections on the built-in firewall. I run these commands:sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPTandsudo service iptables saveOnce this is done, I test my site athttp://IP-ADDRESS(this shows me the Apache Test Page)Once LAMP is installed, I install the MySQL Server by running this:
yum install mysql-serverAfter that is installed, I proceed to the "To secure the MySQL server" instructions on the previous Amazon document.Next, I install PHPMyAdmin using these two tutorials:
http://tecadmin.net/installing-apache-mysql-php-on-centos-redhat/#andhttp://tecadmin.net/how-to-install-phpmyadmin-on-centos-using-yum/At this point, I have a fully functioning web server. Now, I want to use the AWS EBS volume to store all the databases and website files. First, I attach the newly create AWS EBS volume. I use this tutorial to do this:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
THIS IS WHERE THE PROBLEMS START.
Using the information in this tutorial: aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1. It says FAILED.