Setting up an Amazon Linux AMI webserver (ec2)

Setting up a web server on Amazon Linux AMI

Make sure all your currently installed packages are up to date.

   sudo yum -y update

You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies:

   sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell

You can list all your installed packages (including dependencies) with this command :

   sudo yum list installed

Start server services and have them start up automatically on a reboot

Configure the new services to start automatically.

   sudo  /sbin/chkconfig httpd on
   sudo   /sbin/chkconfig mysqld on

   sudo  /sbin/service httpd start
   sudo   /sbin/service mysqld start

Edit httpd.conf

If you need to edit httpd.conf it is in /etc/httpd/conf

But by default the directory /var/www/html/ is the root web directory and you can install your web apps in there.

If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :

   sudo  /sbin/service httpd restart

Set up MYSQL

sudo mysqladmin -u root password 'new-password'

Make additional security-related changes to mysql. This can be done very easily with the command “mysql_secure_installation” and answering conservatively.

sudo mysql -u root -p

Leave a Reply

Your email address will not be published. Required fields are marked *