Last active
July 16, 2019 15:20
-
-
Save Eishfaq/d81ad6569c6bea65ec07e45a5a531d96 to your computer and use it in GitHub Desktop.
LNMP Environment Creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Step-1: Install Nginx | |
| #EPEL stands for Extra Packages for Enterprise Linux. Because yum as a package manager does not include the latest version of nginx in its default repository, installing EPEL will make sure that nginx on CentOS stays up to date. | |
| #To install EPEL, open terminal and type in: | |
| yum install epel-release | |
| #To install nginx, open terminal and type in: | |
| yum install nginx | |
| #Send the project to server | |
| scp portal.zip root@host.net:/usr/share/nginx/html | |
| #Unzip the file | |
| unzip portal.zip | |
| #If unzip is not installed install the package | |
| yum install unzip | |
| #Now unzip the file and after unzipping remove the zip file. | |
| rm portal.zip | |
| #Now install PHP | |
| rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm | |
| #Yum-utils can be used for manipulating package repositories and additional package management operations such as enabling or disabling packages without any manual configuration by a system administrator. | |
| yum install yum-utils | |
| #To install php7.2 enable it like below: | |
| yum-config-manager --enable remi-php72 | |
| #Then finally install PHP 7.2 on CentOS 6 with all necessary PHP modules using the following command. | |
| yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo | |
| #Check the php version which you have installed. | |
| php -v | |
| Output: PHP 7.2.20 (cli) (built: Jul 2 2019 13:52:57) ( NTS ) | |
| #Install MYSQL 8 | |
| rpm -Uvh https://repo.mysql.com/mysql80-community-release-el6-3.noarch.rpm | |
| yum --enablerepo=mysql57-community install mysql-community-server | |
| #Start mysql | |
| service mysqld start | |
| #You can find a temporary password in the mysql log file /var/log/mysqld.log | |
| #Run the mysql_secure_installation script to address several security concerns in a default MySQL installation. | |
| mysql_secure_installation | |
| #Now reset the password and after that log into mysql server | |
| #Create database | |
| mysql> CREATE DATABASE <database_name> | |
| #Import the sql to the database | |
| mysql -u root -p database_name < theSQLfile.sql | |
| #Remote connection allow | |
| #Log into mysql server and then create a user and allowing him remote access | |
| CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; | |
| GRANT ALL ON *.* TO 'myuser'@'%'; | |
| FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment