Skip to content

A How To! Tutorial For Beginners; Master A Powerful Web Stack LEMP Installation & Configuration Setup in Ubuntu 20.04 on VirtualBox Virtual Machine.

  • by
How To Setup Wordpress on LEMP Stack Nginx Server. 3T-InfoTinker Logo [Tip Touch Techniques]
For Step-by-Step Video Exercise:
My Youtube Channel
3T-InfoTinker


Welcome to my practical exercise on mastering the Powerful Web Stack LEMP!

If you’re looking to power your websites and applications with blazing speed and optimal performance, you’ve come to the right place. In this step-by-step navigational tutorial, you are going to walk through the process of setting up a robust LEMP environment on Ubuntu 20.04 Oracle VirtualBox VM.

Whether you’re a seasoned developer or a curious enthusiast, understanding the LEMP stack (consisting of Linux, Nginx, MySQL/MariaDB, and PHP) is essential for building and deploying modern web applications. While walking with me through this process of setup, you’ll gain the necessary knowledge and hands-on experience to harness the full potential of this powerful web stack (LEMP).

Do some googling to know about the core components of the LEMP stack and the reasons behind its popularity among web developers worldwide.
By the end of this exercise, you’ll have a fully functional LEMP stack up and running on your Ubuntu 20.04 VirtualBox VM or host computer, ready to host your websites, blogs, and applications.


Let’s dive in and embark on this exciting journey to master theWeb Stack LEMP!

لیمپ اسٹیک انسٹالیشین میں مہارت حاصل کرنے کی میری عملی مشق میں خوش آمدید!

اگر آپ اپنی ویب سائٹس اور ایپلیکیشنز کو تیز رفتاری اور بہترین کارکردگی کے ساتھ بنانا چاہتے ہیں تو آپ صحیح جگہ پر پہنچ گئے ہیں۔ اس مرحلہ وار نیویگیشنل ٹیوٹوریل میں، آپ لیمپ انوائرنمنٹ کواُبُنٹُو اور ورچؤالباکس کی مشین پربالترتیب تیار ھوتے ھوئے دیکھیں گے۔

چاہے آپ ایک تجربہ کار ڈویلپر ہوں یامشغلے کے طور پر لیمپ سٹیک شوقین؛ لیمپ اسٹیک کوبشمول (لینکس، اینجن ایکس، مائیسیکوئیل، ماریا ڈیی بی، اور پی ایچ پی)کو سمجھنا جدید ویب ایپلیکیشنز کے بنانے اور چلانے کے لیے ضروری ہے۔ سیٹ اپ کے اس عمل میں میرے ساتھ چلتے ہوئے، آپ کو اس طاقتور ویب اسٹیک کی مکمل صلاحیت کو بروئے کار لانے کے لیے ضروری علم اور تجربہ حاصل ہوگا۔

اسٹیک کے بنیادی اجزاء اور دنیا بھر میں ویب ڈویلپرز میں اس کی مقبولیت کی وجوہات کے بارے میں جاننے کے لیے کچھ گوگلنگ کرلیں۔

اس مشق کے اختتام تک، آپ کے پاس اپنے ھاسٹ کمپیوٹر پر یا ورچؤالباکس کی مشین پر لیمپ سٹیک مکمل طور پر فعال ہوگا اور آپ کی ویب سائٹس، بلاگز اور ایپلیکیشنز کی میزبانی کے لیے تیار ہوگا۔

آئیے لیمپ اسٹیک میں مہارت حاصل کرنے کے لیے اس دلچسپ سفر کا آغاز کریں۔

1.

Prerequisites Installation prior to install the WordPress:


ورڈپریس کی انسٹالیشن سے پہلےچند بنیادیضرورت کے پروگراموں کی انسٹالیشن

I’ll be doing all this exercise as superuser, the sudo user.



میں یہ ساری مشق “سُوڈو” یعنی روٹ یوزر کے طور پر کروں گا۔



$ sudo apt update
$ sudo apt upgrade -y

$ apt install nginx mysql-server php php-mysql php7.4-fpm
Command Copied

2.

$ sudo mysql Command Copied



If you’ve got on the MySQL prompt, then “Exit”.




اگر مائیسیکوئل چل جاتا ہے تو اس سے “ایگزیٹ” کر جائیں۔



mysql> exit Command Copied

3.

Securing MySQL installation:

مائیسیکوئل کی انسٹالیشن کو پاسورڈ کے ذریعے محفوظ بنانے کے لئے

$ mysql_secure_installation Command Copied

!Remember!
For production purpose, always use strong password.

!خبردار!
پروڈکشن کے مقاصد کے لئےہمیشہ سٹرانگ پاسورڈ کا استعمال کریں۔



🤯 if secure installation doesn’t
work: then use the following




اگر سیکیور انسٹالیشن کمانڈکام نہ کرے  اور اٹک جائےتو یہ کمانڈ استعمال کرکے پراسیس کو ختم کریں۔



$ sudo killall -9 mysql_secure_installation Command Copied



Run the MySQL again and use the Alter User command.




دوبارہ مائیسیکوئل کو چلائیں اور دی گئی  “آلٹریوزر”کی کمانڈ سے سیکیورانسٹالیشن والا مرحلہ مکمل کریں۔



$ sudo mysql

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Pass3t*use';
Command Copied

4.



Login to MySQL with password confirmation.



مائی  سیکوئیل میں پاسورڈ کنفرمیشن کے ساتھ لاگ اِن۔

$ mysql -u root -p Command Copied

5.



Creating a database with the name wordpress.




“ورڈپریس” کے نام سے ڈیٹا بیس بنانی ہے۔



mysql> create database wordpress; Command Copied



Creating a user with the name userwp and a password to identify the user.




“یوزر ڈبلیوپی” کےنام سے یوزر بنانا ہے اور یوزر کا پاسورڈ بناناہے۔



mysql> create user 'userwp'@'localhost' identified by 'wpPass3t*use'; Command Copied



Granting all rights of wordpress database and its tables to the userwp.






یوزر کو ورڈپریس کی ڈیٹا بیس کے تماجملہ حقوق دینے ہیں۔



mysql> grant all privileges on wordpress.* to 'userwp'@'localhost'; Command Copied



MySQL reloads the privileges from the grant table. This command ensures that the changes made to the privileges and permissions or user accounts are immediately applied without restarting MySQL server.

Flush Privileges command is used right after the use of CREATE USER, ALTER USER, GRANT, or REVOKE..




مائیسیکوئیل گرانٹ ٹیبل سے مراعات \پریؤلیجز کو دوبارہ لوڈ کرتا ہے۔
یہ کمانڈ اس بات کو یقینی بناتی ہے کہ مراعات اور اجازتوں یا صارف اکاؤنٹس میں کی گئی تبدیلیاں سرور کو ریسٹارٹ کیے بغیر فوری طور پر لاگو کر دی جائیں۔


CREATE USER، ALTER USER، GRANT، REVOKE کے استعمال کے بعد
Flush Privileges
کمانڈ کا استعمال کیا جاتا ہے۔



mysql> flush privileges Command Copied



After the flush privileges command. Now, exiting the MySQL environment.



فلش پریؤلیجز   کمانڈ کے استعمال کے بعد  اب مائیسیکوئل سے ایگزیٹ کریں گے۔

mysql> exit; Command Copied

6.



Enabling the services on the Reboots.



ویب سرور اور ڈیٹابیس کی سروسزکوسسٹم  ری-بوٹ  کےوقت خودبخودچل پڑنےکےلئے اقدامات۔



$ systemctl enable nginx && systemctl enable mysql && systemctl enable php7.4-fpm Command Copied

7.

Downloading and Installing WordPress.

ورڈپریس کاآفیشل ویب سائیٹ سے ڈاؤنلوڈ اور انسٹالیشن

$ cd /var/www/html Command Copied



If you don’t have these directories /www/html, then create them inside the /var directory.




اگر آپ کو یہ ڈائریکٹریاں [www/html/] نہیں مل رہیں تو بنالیں۔



$ mkdir /var/www
$ mkdir /var/www/html
Command Copied



Before downloading, I’ll step-in /html directory.




ڈاؤنلوڈ سے پہلے میں html/



میں جاؤں گا پھر ڈاؤنلوڈ کی کمانڈ لگاؤں گا۔

$ cd /var/www/html Command Copied

8.


I browsed the wordpress website to get this link for download. If you are watching my exercise video along with this, you can see that clearly.





یہ لنک آپ کو ورڈپریس کی سائیٹ سے مل جائےگا۔

اگر آپ میری مشق کی وڈیو بھی ساتھ دیکھ رہےہیں تو  وہاں آپ دیکھ بھی سکتے ہیں۔

$ wget https://wordpress.org/latest.zip Command Copied

9.



If you ain’t got the zip Unzip apps, then install them.






اگرآپ کے پاس زِپ ،أنزِپ  ایپس نہیں ہیں تو انہیں انسٹال کر لیں۔



$ apt install zip unzip Command Copied

10.



Now will unzip the downloaded zip file. And this will create a directory with the name wordpress and extract all the files in it.
Our current location is: /var/www/html, let’s check if it is.






اب ورڈپریس کی ڈاؤنلوڈ کی ہوئی زِپ فائل کو ایکسٹریکٹ/أنزِپ کرناہے۔ اور یہ خود سے ایک ڈائریکٹری ورڈپریس کے نام سے بناکراس میں ساری فائلیں ایکسٹریکٹ کردے گی۔







ہماری کرنٹ لوکیشن/ورکنگ ڈائریکٹری
/var/www/html/
ہونی چاہیئے۔ دی گئی کمانڈ سے ہم اپنی موجودہ /کرنٹ ڈائریکٹری کو جان سکتے ہیں۔

$ pwd Command Copied



Now the files will be extracted.





اب أنزِپ کی کمانڈ سے فائیلیں ایکسٹریکٹ ہو جائیں گی۔



$ unzip latest.zip Command Copied



Go inside the wordpress directory and copy all the files into the parent directory i.e. /html





اب ورڈپریس کی ڈائریکٹری کے اندر جائیں گے اور ساری فائیلیں “پیرنٹ ڈائریکٹری” html/ میں کاپی کر دیں گے۔



$ cd wordpress
$ cp * -avr ../
Command Copied

11.



Step back to the parent directory of html directory www, where we have to change the ownership the ownership and Read/Write permissions of this html directory for Nginx.





اب ورڈپریس کی ڈائریکٹری سے نکل کر html/کی پیرنٹ ڈائریکٹری میں جائیں گے۔
جہاں سے ہم نے html/ ڈائریکٹری کی اونرشپ اور رِیڈ/رائیٹ پرمِشنز تبدیل کرکے اینجن ایکس کو دینی ہیں۔

$ cd ..
$ cd ..
Command Copied


If we type this command,





اگرہم یہ کمانڈ لگائیں تو



$ pwd Command Copied



it will show you the current location on the root like this.

 یہ ہمیں ہماری کرنٹ لوکیشن کچھ اسطرح سے دکھاتی ہے ۔





/var/www



Now changing the ownership for the user:group that will be Nginx.





اب اؤنرشپ تبدیل کریں گے– یوزر:گروپ جوکہ اینجن ایکس کی ہوگی۔

$ chown www-data:www-data * -R Command Copied



The read/write/execute permissions to the user and group only. No permissions for others means No access.





رِیڈ/رائیٹ/ایگزیکیوٹ  پرمِشنز یوزر (اینجن ایکس)اور اس کے گروپ کو اور  — یعنی زِیرو  باقی سب کوکسی قسم کا ایکسیس نہیں۔



$ chmod 770 * -R Command Copied

12.



Let’s walk into the /etc/nginx/sites-enabled directory and edit the file named default.





چلیں جی اب  “سائیٹس اِنئیبلڈ” کی ڈائریکٹری میں جاتے ہیں اور “ڈیفالٹ”  فائل میں تبدیلیاں کرتے ہیں۔



cd /etc/nginx/sites-enabled
nano default
Command Copied



Following updates will be done in the default configuration file according to my system. As per given lines of script.





میرے سسٹم کانفیگریشن کے حساب سے مندرجہ ذیل سکرپٹ میں نے تبدیل یا اضافہ کیا۔



File name: default


# Default server configuration

#

server {

         listen 80 default_server;

         listen [::]:80 default_server;


         root /var/www/html;


# Add index.php to the list if you are using PHP

        index index.php index.html index.htm index.nginx-debian.html;



server_name _;


         location / {

                         try_files $uri $uri/ /index.php$is_args$args;

         }

}


Restart Nginx and php7.4-fpm

اینجن ایکس اور’ پی ایچ پی ‘ کوریسٹارٹ کریں۔

$ systemctl restart nginx
$ systemctl restart php7.4-fpm
Command Copied

13.



Creating wp-config.php file from the wp-config-sample.php file using Copy command.



wp-config-sample.php
سے کاپی کرکے

wp-config-sample.php فائل بناتے ہیں۔







You can find the sample file in /html directory.





یہ فائل html/ کی کرنٹ ڈائریکٹری میں ملے گے۔



$ ls Command Copied



Use the following command to create wp-config.php file.




مندرجہ ذیل کمانڈسے”کانفیگ” فائل بنا سکرپٹ میں نے تبدیل یا اضافہ کیا۔



$ cp wp-config-sample.pht wp-config.php Command Copied

14.

WordPress Configuration File Setup.

ورڈپریس کی کانفگریشن فائل کا سیٹ اپ


Need to make changes to this main wordpress configuration file. We will need the secret keys for the security of our installation and wordpress made this easy for by providing these keys on the following link.




اب ورڈپریس کی مرکزی کانفگریشن فائل میں کچھ تبدیلیوں کی ضرورت ہے۔
اور سیکریٹ کیز بھی چاہئے ہونگی اپنی اس انسٹالینشن کی سیکیورٹی کے لئے،جوکہ ورڈپریس نے ہماری سہولت کے لئے مندرجہ ذیل لنک پر مہیا کر رکھی ہیں۔



!Remember!
Never save or copy these keys, you have to use unique values each time.

!خبردار!
ان سیکریٹ کیز کو کاپی کرکے رکھنے کی ضرورت نہیں، یہ ہمیں ہر انسٹالیشن پر نئی استعمال کرنی ہیں۔

$ curl -s https://api.wordpress.org/secret-key/1.1/salt/ Command Copied



Now, will copy the keys for this time only and paste them into the wp-config.php file at their exact location. You may delete or ‘#’ the existing pattern.






اب ان سیکیورٹی کیز کو کاپی کرکے “ڈبلیو پی -کانفگ.پی ایچ پی” فائل میں اس کی بتائی گئی جگہ پرپیسٹ کردیں گے۔
آپ چاہیں تو جو نمونہ پہلے سے موجود ہے اسے کمنٹ کردیں یا ڈیلیٹ کردیں۔



15.



Adding the database name, user name, password and server name to the configuration file.






اب کانفگ فائل میں  ڈیٹا بیس کا نام،یوزرکا نام اورپاسورڈ اورسرور کا نام ان کی مخصوص جگہاؤں پر لکھنے ہیں۔



16.



The last step to proceed with the installation and set up in browser.

To see the IP of your host machine.






اب آخری مرحلہ آتا ہے، براؤزر میں انسٹالیشن کی تکمیل کا۔
اب ہاسٹ مشین کا ‘آئی پی’ دیکھنے کے لئے مندرجہ ذیل کمانڈ استعمال ہوگی۔



$ ip a Command Copied



OR



$ ifconfig Command Copied



if this command doesn’t work, then  net-tools will be installed using following command.






اگف یہ کمانڈ کام نہ کرے تو مندرجہ ذیل کمانڈ سے ‘نیٹ-ٹُولز’ انسٹال کریں گے۔



$ apt install net-tools Command Copied



Restart the Nginx and php7.4-fpm before proceeding further.
Now open the browser and type in the IP address of your host machine. In my case it is localhost.The wordpress setup page will appear follow the steps and enjoy the wordpress on you local machine.




 کچھ بھی کرنے سے پہلے’اینجن ایکس  اور پی ایچ پی ‘ریسٹارٹ کرنی ہے۔
اور اب براؤزر کھول کر اپنی ہاسٹ مشین کا ‘آئی پی ‘ ایڈریس ٹائپ کریں گے،جس سے ورڈپریس کا ‘سیٹ اپ’ کا صفحہ کھل کر سامنے آجائے گا۔ اس کی ہدایات پر عمل کرتے ہوئے ورڈپریس کا سیٹ اپ اپنی مشین پر مکمل کریں گے۔



Thank you for reading and watching, share it in your circle.
Stay in touch and visit again.
Happy learning.



میری بلاگ پڑھنے اور وڈیودیکھنے کے لئے آپ کا بے حد شکرگزارہوں۔
اپنے دائرۂ احباب میں بھی شیئرکریں اور رانطے میں رہیں۔

Leave a Reply

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