AWS

Amazon Web service is well known service provider in cloud industry, which provides various services to use in this industry.

Install lamp with php7.2

  1. Clink on launch a virtual machine

  2. Select “Amazon Linux 2 LTS Candidate AMI 2017.12.0” A latest Amazon linux candidate 64 bit.

  3. Select “t2.micro” as Free tire instance.

  4. Select auto option “Configure Instance Details”

  5. Insert 30GB as storage.

  6. Create security group and assign port.

  7. Click on launch using a new key pair (Remember you need to put .pem file at secure place.)

  8. Now your instance is ready.

Tip

Ubuntu users Open Terminal and write below command ssh -i /web/yourkey.pem ec2-user@xxx.xxx.xxx.xxx

Windows users generate PPK file and use it in Putty

Start Below commands

  1. sudo yum update -y

  2. sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2

  3. sudo yum -y install php-mysqlnd php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-intl

  4. sudo yum install -y httpd mariadb-server

  5. sudo usermod -a -G apache ec2-user

  6. sudo chown -R ec2-user:apache /var/www

  7. sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;

  8. find /var/www -type f -exec sudo chmod 0664 {} \;

  9. sudo service httpd start

  10. sudo systemctl start httpd

  11. sudo systemctl enable httpd

  12. sudo systemctl is-enabled httpd

  13. sudo systemctl start mariadb.service

  14. sudo systemctl enable mariadb.service

  15. mysql_secure_installation

  16. cd /etc/httpd/conf

  17. nano httpd.conf

  18. Search for allowoverride None and replace it with allowoverride All

Install lamp with php7.1

  1. Clink on launch a virtual machine

  2. Select “Amazon Linux 2 LTS Candidate AMI 2017.12.0” A latest Amazon linux candidate 64 bit.

  3. Select “t2.micro” as Free tire instance.

  4. Select auto option “Configure Instance Details”

  5. Insert 30GB as storage.

  6. Create security group and assign port.

  7. Click on launch using a new key pair (Remember you need to put .pem file at secure place.)

  8. Now your instance is ready.

  9. Go to Terminal and write below command (Ubuntu) ssh -i /web/yourkey.pem ec2-user@xxx.xxx.xxx.xxx

  10. Open PuttyGen software and load your pem file to generate ppk file.(Windows)

  11. sudo yum update -y

  12. sudo yum install -y httpd24

  13. sudo service httpd start

  14. sudo chkconfig httpd on

  15. sudo yum install -y mysql-server

  16. sudo service mysqld start

  17. sudo chkconfig mysqld on

  18. sudo yum install php71

  19. sudo yum -y install php71-gd php71-ldap php71-odbc php71-pear php71-xml php71-xmlrpc php71-mbstring php71-soap curl curl-devel

  20. sudo usermod -a -G apache ec2-user

  21. groups to know correct group.

  22. sudo chown -R ec2-user:apache /var/www

  23. sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;

  24. find /var/www -type f -exec sudo chmod 0664 {} \;

  25. mysql_secure_installation

  26. Enable Mode rewrite

  27. cd /etc/httpd/conf

  28. nano httpd.conf

  29. Search for allowoverride None and replace it with allowoverride All

Extras

Create user

Connect to server ssh -i pathof pem file serveruser@yourip Create User sudo adduser username SetPassword sudo passwd username it will ask for insert SetPassword, you need to put your desire password. Set Directory Path of that user sudo usermod -d /var/www/html/ username

Mysql Initial

First logged in Mysql panel Adduser and provide permission CREATE USER 'mysqlusername'@'%' IDENTIFIED BY 'mysqluserpassword'; GRANT ALL PRIVILEGES ON *.* TO 'rsmaauusr'@'%' WITH GRANT OPTION; EATE USER 'ankit'@'%' IDENTIFIED WITH mysql_native_password AS '***'; GRANT ALL PRIVILEGES ON *.* TO 'ankit'@'%' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; GRANT ALL PRIVILEGES ON `adopted`.* TO 'ankit'@'%' WITH GRANT OPTION;

TimeZone change

ls -l /etc/localtime cp /etc/localtime /root/old.timezone rm /etc/localtime ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime

vsftpd install

pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=<Public IP of your instance>

Virtual Host Example

<VirtualHost *:80>
    ServerName www.xyz.com
    ServerAlias www.xyz.com
    ServerAdmin youremailaddress
    DocumentRoot /var/www/xyz.com/public_html

    <Directory "/var/www/xyz.com/public_html">
            AllowOverride All
    </Directory>

    ErrorLog /var/log/httpd/xyz.com-error.log
    CustomLog /var/log/httpd/xyz.com-requests.log combined
</VirtualHost>