Setup web server on Amazon AMI or CentOS [Part-1]
If you are using Amazon aws with ec2 instances, then i assume you already have the pem file to connect to the instances. Normally you will have different instances for your projects. I normally setup either Amazon AMI or Cent OS, prefer Amazon AMI as it is also based on Cent OS. Cent OS is best and easy OS for servers. I love the configuration and level of interaction it provides.
Let’s say you want to install a web server with MySQL and PHP, run the following command:
sudo yum install httpd mysql-server php php-mysql mysql php-xml php-pdo php-odbc php-soap php-common php-cli php-mbstring php-bcmath php-ldap php-imap php-gd mod_ssl
That will install all the necessary modules and packages to run a fully functional server.
In some cases we don’t need/want a web server, just database server will do:
sudo yum install mysql-server mysql
That will only install database server on the instance.
Now let’s say we dont need either PHP or MySQL:
sudo yum install httpd
Some time we don’t need database server on the same web server instances:
sudo yum install httpd php php-xml php-mysql php-pdo php-odbc php-soap php-common php-cli php-mbstring php-bcmath php-ldap php-imap php-gd mod_ssl
That will install all necessary packages excluding MySQL.
Now if you have a MySQL server, for sure you would like to make it secure, that is easy:
The above command will ask you some questions, answer the questions carefully and you will get through it.
Don’t forget to remove anon users and test database while running the above command.
If you have .htaccess file and want to utilize mod rewrite, enable it in /etc/httpd/conf/httpd.conf in the server directory section:
To auto restart your server and database server in case the system is restarted:
sudo chkconfig httpd on sudo chkconfig mysqld on
Manually start the servers:
sudo service httpd start sudo service mysqld start
Part-2: Backup MySQL data into CSV