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
.
Two questions:
<ol>
<li>How can I get MySQL to use the
directory as its database storage location? (I don't want to run the program from the
directory, just put the .sql file there.</li>
<li>How can I do the same for my web site? I plan on running a wordpress site and its current location is in the
directory. I want to change this to
.</li>
</ol>
I want to keep the web site files and database on a separate volume:
. 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
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:
EDIT:
This is what I am doing.
<ol>
<li>Create a new instance using this ami:
</li>
<li>Once the instance is up, I run updates using:
</li>
<li>One updated, I set it up as a LAMP web server using these instructions:
In addition to the above steps, I allow port 80 tcp connections on the built-in firewall. I run these commands:
and
Once this is done, I test my site at
(this shows me the Apache Test Page)</li>
<li>Once LAMP is installed, I install the MySQL Server by running this:
After that is installed, I proceed to the "To secure the MySQL server" instructions on the previous Amazon document.</li>
<li>Next, I install PHPMyAdmin using these two tutorials:
and
</li>
<li>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:
</li>
</ol>
THIS IS WHERE THE PROBLEMS START.
Using the information in this tutorial:
. It says FAILED.
Code:
/data
Two questions:
<ol>
<li>How can I get MySQL to use the
Code:
/data
Code:
/data
<li>How can I do the same for my web site? I plan on running a wordpress site and its current location is in the
Code:
/var/www/html
Code:
/data/site
</ol>
I want to keep the web site files and database on a separate volume:
Code:
/data
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
Code:
/data
Here are some of the tutorials and articles I been following/testing with:
Code:
aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1
Code:
spruce.it/noise/setting-up-a-proper-lamp-stack-on-aws-ec2-ebs/
EDIT:
This is what I am doing.
<ol>
<li>Create a new instance using this ami:
Code:
https://aws.amazon.com/marketplace/pp/B00IOYDTV6?ref=cns_srchrow
<li>Once the instance is up, I run updates using:
Code:
sudo yum update -y
<li>One updated, I set it up as a LAMP web server using these instructions:
Code:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
Code:
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
Code:
sudo service iptables save
Code:
http://IP-ADDRESS
<li>Once LAMP is installed, I install the MySQL Server by running this:
Code:
yum install mysql-server
<li>Next, I install PHPMyAdmin using these two tutorials:
Code:
http://tecadmin.net/installing-apache-mysql-php-on-centos-redhat/#
Code:
http://tecadmin.net/how-to-install-phpmyadmin-on-centos-using-yum/
<li>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:
Code:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
</ol>
THIS IS WHERE THE PROBLEMS START.
Using the information in this tutorial:
Code:
aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1