Last updated : Dec 11, 2021
1. update and upgrade your system
For that open up your terminal and type
sudo apt update && sudo apt upgrade
2. Install Nginx server
For that open up your terminal and type
sudo apt install nginx
3. Check whether Nginx is installed or not
Open up your web browser and type localhost in url bar and you will see the following output
4. Now install php and php-fpm for Nginx
There is very good repository for installing latest version of PHP i.e., php-8.0 known as Ondrej/php. So we will add this repo to the system first. Open up terminal again and type
sudo add-apt-repository ppa:ondrej/php
After adding repo update the system again and type
sudo apt install php8.0-fpm
5. check whether php installed or not
Type in terminal
php -v
and if you get the php version then PHP is installed correctly, if any error occurs you can comment and tell. After checking PHP installation now verify php-fpm installation, type in terminal
sudo systemctl status php8.0-fpm
and you will get output something like this :
6. Till now no PHP page will run in browser
For running PHP pages we have to integrate php-fpm with Nginx. So type in terminal
sudo nano /etc/nginx/sites-enabled/default
you will see something like this :
after editing some lines, this will be the updated file :
7. PHP installation is completed. Now it's time to install Mysql
So type in terminal
sudo apt install mysql-server
After running previous command, now install mysql with command
sudo mysql_secure_installation
Now it will ask you some questions:
1. (Validate password component) press Y for yes, any other key for no : Y
pres Y for this because it is really important to secure mysql database and this component will help you to enhance password security
2. now it will ask you to create a password for root user.
3. remove anonymous users : Y
4. disallow root login remotely : Y
5. remove test database and access to it : Y
6. remove privilege tables now : Y
All done!
8. Till now PHP and Mysql installation is complete and time to install phpmyadmin
So type in terminal
sudo apt install phpmyadmin
It will ask you for selecting server but as we are using Nginx so we will select just press tab key and return key.
then it will ask you configure dbconfig_common but select no and continue. Now copy phpmyadmin from /usr/share/ to /var/www/html/
PHPmyadmin installed. You can browse phpmyadmin at http://ip_address/phpmyadmin/index.php
9. But you will not be able to login with root username because we have disallowed that
so we have to create new user. type these commands
sudo mysql -u root -p
enter old password
create user 'new_root'@'localhost' identified by 'newrootroot';
grant all on *.* to 'new_user'@'localhost';
flush privileges;
How video streaming works on t...
Read moreSetup react and express on sam...
Read moreHow neurons in brain function
Read moreHow to create custom router in...
Read moreRun C++ as CGI script in web b...
Read moreReal time chat application usi...
Read moreHow to secure phpmyadmin in Ub...
Read moreHow to create real time notifi...
Read moreHow to create simple api in no...
Read moreTask scheduling with cron job ...
Read moreHow to use modules in Javascri...
Read moreCreate a multi language(lingua...
Read moreCreate food ordering app - Foo...
Read moreLinear Regression in machine l...
Read moreCreate simple web application ...
Read moreWhy algorithms can drive the i...
Read moreWhy Javascript frameworks are ...
Read moreCreate authenticated API in La...
Read moreCreate simple and static websi...
Read moreSetup Pusher app
Read moreLaravel Installation and setti...
Read moreRealtime chat application in L...
Read moreWorking of neurons (the easy w...
Read moreProgressive web app
Read moreSign in for comment. Sign in