Installing LAMP Webserver In Debian 11

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
we're going to install lamp web server in debian 11. that is apache mariadb php 7 or 8. we're going to be installing phpmyadmin for our database manager we'll be configuring virtual hosts setting up our firewall and accessing our web server over the internet [Music] all of the commands shown in this video will be listed under the video on the website tradetech.meet additional articles and resources will be listed in the description below we'll install apache first open the terminal switch to the root user and we will type at install apache 2. say yes we will see apache is is now installed we go to localhost we'll see our server running we need to install curl this will be especially useful for php simply type apt install control we can test curl by doing this and we should see a response like so let's clear the screen now we will install mariadb we'll do app install server we say yes and it's done we have the root user for our mariadb database but i generally like to create my own account what i'll do is drop the default root account and make my own i usually like to give it a name but for the sake of simplicity we'll just call it root so we've dropped that user and now we'll create the root user again with the password of wayward now we need to granted permissions all permissions i'll just copy these commands and so this will grant the user all permissions now we need to flush permissions this will update the grants permissions without us without us having to restart the maria db server before we move on i want to show you how to stop and start your apache in mariadb server you can stop your apache server with system ctl stop apache 2 this will stop the server likewise you can use start to start the server and reload to reload the server you can also use status to check the status of the server and as you can see it's active and running for mariadb we do the same thing we'll do stop on mariadb and this will stop the server we'll start it up again and we're good to go now we will install php i'm going to show you how to install php 74 and then php 8. we'll start with php 74. to install php 7 we'll do apt install hp this will install php74 and it's complete now we will do app install php these will install the modules for php to work with apache say yes and we're good to go for php 8 there are some dependencies in a repository that you need to add these commands will be in the description but i'll go ahead and copy them so you can see what they look like once the dependency is installed we'll add the repository next we'll add the key and lastly we will do an app update now we can finally install php 8 app install and typo yes and it's complete now the commands for installing page p8 most likely differ after this video has been uploaded so just check with your distribution and find out which commands are most updated for installing php 8 on your system for the purposes of this tutorial though i'm going to stick with php 74. now to see that our web server is working we will open up our browser and go to localhost and we see the page loads we go to our system under var www this is where all of our websites will be stored this default page is located in html i'll open this folder as the root user so i can modify this file to test that our php is working so i'll just rename it index.php i'll edit it with our text editor we'll get rid of all of this and echo out our php info we'll save it and refresh this page and we see our php 74 is working now we're going to install phpmyadmin for our database management we'll type app install phpmyadmin we'll say yes and this will install phpmyadmin it's asking us how we want to configure our server we'll choose apache 2 and hit ok now it's asking us where we want to configure our php my admin do we want to do it in the db config comment we'll say no and it's done we can check our installation by going back to our server and going to php my admin we see that it's working and we can now log in with our database credentials from earlier and we're logged in to our phpmyadmin the next thing we want to do is secure our phpmyadmin because what we don't want is for it to be accessible over the internet once we set up our web server to be accessible to the public so what we need to do is go to our system under etsy apache 2 and let's open this up as the root user so we can modify this value so we want to modify the apache 2 conf file we'll right click and edit we want to go down to about here under this www directory and we're going to copy another directory and what we want is for the directory user share php my admin what we want is for localhost that's this system to connect to it that's these two lines and any device on our network to connect to it if you don't want any other devices being able to access your phpmyadmin you can simply delete this and just have localhost this will ensure that no one outside your network or device localhost will be able to access your phpmyadmin i'll hit save and close then we will restart our apache server now i'm going to show you how to set up virtual hosts this is good if you want to host multiple websites on a single server if you're just going to run one website you can store all of the files in your html but in this example i want to have another site so i'll right click open its root and i'll create a folder here called shape as i have a domain for a blog that i want to host from this folder now what i'll do back in my terminal going to enter this command which is going to recursively change permissions for the entire www folder granting our user full access so now as a regular user i can create a folder or document i'll create a document index dot php and in this we will simply say and we'll save we'll test this out when we set up our domain so now what we want to do back in our system what we want to do is go to etsy apache sites available and you want to create a folder file called main.com you can call this whatever you want i'm going to call my main and we're going to basically create a copy of this with our own rules of how we want our server to configure incoming traffic and we're going to add a virtual host clause in here we're going to say when the domain shaped by the blog it's the server we're going to route it to the shay directory so imagine you go to sheabutter.blog when it comes to this server it's going to load what's ever in the shay directory which is what's ever in here and in this case index.php will be the first thing you hit so when we go to that domain we should see the contents of this file we'll hit save and now we need to enable this conf and disable this default conf so to do that open a terminal we'll first enable our main by typing sudo a2 insight main and we will disable the default by typing a to disable site zero zero zero default and then we will simply restart our server system ctl reload apache 2 and since we've disabled the default com and enabled our own call and since the only thing in our conf is the virtual host for shea butter blog when we refresh our server instead of going to the default page it's actually going to load our message if we had another site for example let's say we had another website that we were posting in another folder here say test site we will do the same thing again except this time it would be test site baby.com or test site dot com and you would enter test site directory then you would hit save you would restart your server and when testsite.com comes to your server it will load the contents of test site you can also set the server admin email i'm just leaving it as the default for the sake of this tutorial i'm going to go ahead and delete this we're going to be working with shea butter blog for our setup with our web server setup we're now ready to see how to access it over the internet to do this we need to configure a firewall our router if we're behind one and our domain to dns for linux debian i'm going to be using a firewall program called tufw i'm going to install that this is a simple firewall program that will allow us to configure our firewall for opening the ports necessary for our server with that installed we can simply type in firewall and we'll see the program here we'll type in our password and we will briefly quickly set this up to public we want to enable it and we will allow outgoing requests and we're going to reject all incoming requests but we're going to set specific rules for our apache server we'll call this apache and we're going to allow in both port 80 or whatever port you're using for your web server and we'll hit add if you're doing ssl you do 443 you open that up but i'm just going to be doing port 80 for the sake of this video we'll hit close now we need to configure our router so i'll go to my router and log in under your router's port forwarding settings you want to add a profile where you open port 80 for the external port and for the ip address you need the ip address of your hardware your computer and you can find the ip of your computer simply by going to network and the ipv4 address is the address that you want to enter into the internal ip address in the command line you can also type in ip address and you would see that same ip address somewhere like here so now we will get rid of whatever is here we'll type 54.128 and we'll hit save next thing you need to do is get your ip address your isp's ip address we'll say my ip in google and it will bring up your ip address this is what you will need when you configure your domain's dns so copy that down you should also be able to find this in your router's configuration now we'll go over to my domain registrar and configure our domain alright i'm at hover.com where i have the domain sheabutter.blog i'm in my dns settings and i have two a records one a wild card and one an at record and in these records if you don't have one create them and under the ip address field you want to put the ip address that you saw in google or in your router your static ip address that your isp gives you so you should have two a records both with the value of your ip address your static ip address and so now with that set up it should take about five minutes depending on your domain register copy this in the browser now if i hit enter we see that our blog and if we then type say butter.blog our site still loads our domain is working our web server is working and that's it that's setting up a lamp server in debian 11. [Music] you
Info
Channel: Dre Techsoft
Views: 1,414
Rating: undefined out of 5
Keywords: dre techsoft, deandre wilson, drewilson.dev, how to install lamp server in debian 11, webserver debian 11, php 7.4 install debian 11, how to install php 8 in debian 11, debian 11 server setup, debian 11 web server, how to install phpmyadmin in debian 11, how to install curl in debian 11, how to install mariadb in debian 11, webserver linux setup, apache 2 in debian 11, apache 2.4 in debian 11, debian 11 tutorials, set up portforward in debian 11, set up domain in debian 11
Id: yflKHjMJV-0
Channel Id: undefined
Length: 16min 51sec (1011 seconds)
Published: Sun Aug 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.