‫Instructor: Hi.
‫Within this lecture,
‫we are gonna install the vAPI inside of our server.
‫Right now, I'm inside of my server.
‫I have connected via SSH,
‫and it seems that I cannot type anything.
‫So it means that I have lost the connection, I believe.
‫So if you experience the same thing,
‫make sure you close the terminal
‫and open it one more time,
‫and connect to your server again
‫using the SSH or the web interface or PuTTY.
‫As you can see, it says broken pipe,
‫which means that I lost the connection.
‫Okay, so it's easy.
‫I'm going to do SSH one more time,
‫and give my password, and hit Enter,
‫and then I will be in.
‫So as long as you are inside of your terminal like this,
‫as long as you see this root at Ubuntu,
‫then you're good to go.
‫Now what I'm going to do,
‫I'm going to open this GitHub repository one more time
‫because that's exactly what we need
‫in order to install this.
‫Okay?
‫So we need PHP, we need MySQL, MySQL,
‫or we need other requirements or other dependencies as well.
‫But you don't need to worry about those,
‫because we need those inside of the server
‫not inside of our own machine.
‫Of course, we can try to run those on local hosts
‫but it won't be as realistic as it is,
‫and also it will require us to install a lot of things.
‫Right now, I'm just going to copy this Git, okay?
‫Git URL, rather than downloading the zip.
‫I'm just gonna copy this,
‫and come over here,
‫and put it inside of the Apache server directory.
‫So I'm going to run git clone of course.
‫And a Git will be probably installed
‫on the Ubuntu automatically.
‫But let me see, I'm inside of the root.
‫I'm going to try to go back,
‫and then if I say ls,
‫then I can see the V-A-R, var.
‫Then I'm gonna go into cd /var/www/html,
‫but it doesn't exist.
‫There is no such directory, great,
‫which means that I don't have Apache.
‫As you can see, I cannot go into the /var/www/html folder,
‫which means that I don't have the Apache,
‫but let me be certain.
‫I'm going to run this Apache command
‫and see if it's installed on my system or not.
‫If it's not, then I'm just going to go ahead
‫and actually install it.
‫So inside of the var, I don't even have a www folder,
‫which is again, an indication
‫that my Apache service is not present.
‫Here you go,
‫service apache2 status gives me, could not be found.
‫Okay.
‫Then I'm gonna run apt install apache2,
‫which will install the Apache2 on my Ubuntu server.
‫Of course, I'm gonna say yes,
‫but as you can see,
‫it cannot fetch some of the archives.
‫It cannot connect to the internet
‫or it cannot connect to the server for some reason.
‫I'm gonna ping the google.com.
‫Here you go.
‫It works.
‫It's connected to the internet, obviously it's connected.
‫Otherwise, we wouldn't be able
‫to connect to the server at all.
‫So what I'm gonna do,
‫I'm gonna run apt update --fix-missing, okay?
‫It's actually a very good idea
‫to run apt update or apt upgrade,
‫depending on your situation once you create a server.
‫Now, we haven't done that,
‫so most probably that's why we cannot install anything.
‫So I'm gonna run apt update as well.
‫Okay?
‫And here we go.
‫I believe this is now okay.
‫So I'm gonna run apt install apache2 one more time.
‫And I'm gonna say yes, obviously, and here you go.
‫Yeah, right now it's progressing.
‫It means that it's installing.
‫It couldn't download the thing previously
‫because we forgot to actually run apt upgrade or apt update.
‫Here you go.
‫So I'm gonna clear this thing right now.
‫I should have www folder over here.
‫So I'm gonna go cd /var, and run ls.
‫Here you go.
‫We have the www folder.
‫Now I'm gonna go inside of that folder,
‫and also inside of the html as well.
‫Currently, I'm inside of the /var/www/html,
‫and I can see the index.html over here.
‫So this is our web server.
‫So this is where I will run this command, git clone.
‫And I'm going to run this https://github.com.
‫So if you want, pause video here,
‫just copy the comment, okay?
‫git clone https://github.com,
‫because that is exactly what you need to do,
‫because it'll download all the codes inside of your server.
‫And if you run ls, you can see this vapi here,
‫V-A-P-I folder appearing in here.
‫So you can go inside of that by running cd vapi.
‫And here you go.
‫Now we see all the contents, and in fact,
‫we have seen them in our own computer before.
‫Right now, I'm inside of the vapi directory.
‫Okay?
‫So let's go to readme and see how it's installed.
‫So for the Docker installation, it's actually very easy.
‫All you gotta do is just run this docker-compose up -d.
‫Okay?
‫So it has been Dockerized for us.
‫So if you run this, it will just execute everything,
‫install all the dependencies that you need,
‫and run the server for you.
‫It's very easy to do.
‫All you gotta do is just copy this and paste it over here.
‫Of course, we should be inside of the vapi folder.
‫The docker-compose cannot be found,
‫so we have to install this as well.
‫So I'm gonna say apt install docker, first of all,
‫and I'm gonna say yes.
‫So it's gonna install the Docker.
‫And I believe we have to install the Docker Compose as well.
‫So apt install docker-compose.
‫Yep, here you go.
‫As you can see, this is around 360 megabytes,
‫so it can take a little bit of time.
‫So after this is installed,
‫then you can use Docker to instantiate your API.
‫Of course, without the Docker,
‫you can manually install this as well,
‫but if you're not a web developer,
‫or if you don't have any kind of DevOps
‫or backend development experience before,
‫I really suggest you stick to the Dockerized thingy.
‫Okay?
‫So here you guys,
‫you can see, it's almost done.
‫And after you see the screen, you can clear the thing,
‫and then run the docker-compose up -d one more time.
‫This is all you gotta do.
‫If you run docker-compose up -d,
‫as you can see it started to pull the dependencies
‫like it's actually installing MySQL right now.
‫If you don't have PHP on the server, it will install it.
‫If you don't have MySQL, it will install it.
‫If you don't have anything else, it will install it.
‫Very good.
‫Now as you can see, we're gonna have to wait a little bit
‫and see what's going on.
‫And then after this is done,
‫then we're going to actually run the API.
‫By the way, it's step one of four.
‫It's actually installing the PHP right now.
‫I didn't even have that.
‫And after this is completed,
‫I believe, it will automatically run the API.
‫And it will automatically run the API in the background,
‫so that we won't have to do anything else at all.
‫So if we look at the manually installing the server,
‫as you can see, we need to set up the database manually.
‫We're gonna have to install the MySQL manually,
‫and so much more.
‫So I don't think you should focus on that.
‫I believe you should just run docker-compose up -d
‫in order to make this up and running.
‫And then we're going to focus
‫on the penetration testing side.
‫So here you go.
‫I'm gonna wait a little bit.
‫Ah, here you go.
‫It's finished.
‫It's finished, but I believe we got an error.
‫So as you can see, we got an error over here.
‫Maybe you didn't get that error, but I got.
‫So let's see what kind of error do I get?
‫So it says that the address is already in use,
‫which means that we are using the port 80.
‫Okay?
‫It says that you are using the 0.0.0.0:80.
‫So it cannot create the API.
‫So something is using the port 80 in our own server.
‫So I suspect it would be Apache2,
‫because we have just installed it,
‫but of course we can kill it.
‫We can make it stop and just let the API do its thing.
‫So what I'm gonna do, I'm gonna open another tab over here.
‫Actually we don't need another tab.
‫I can just do it over here,
‫because I lost my connection somehow.
‫I'm just gonna give my password one more time.
‫I don't have to do everything from scratch.
‫I know something is using the port 80.
‫So I'm gonna go back to the same folder, cd /var/www/html,
‫and if I run ls, yeah,
‫I'm gonna go into vapi folder as well.
‫Right now, if I run the Docker Compose one more time,
‫it won't matter because the port 80 is in use.
‫So I need to understand what is using port 80.
‫In order to do that, you can run lsof.
‫Okay, lsof -i with a :80.
‫So this 80 stands for the port number.
‫If you're looking for 80, just write 80.
‫And here you go.
‫Now, as you can see, Apache2 is using the port 80,
‫and that is what is blocking us to launch the API.
‫So I'm gonna kill the Apache2,
‫so that we can run the API in a proper way.
‫So all you gotta do is just run kill,
‫and write the PID number over here.
‫This is the process id.
‫So for me, it's 3428,
‫and it will kill the Apache2 if I run the command again.
‫As you can see, there is nothing using the port 80.
‫So if you did not get this error,
‫then you shouldn't do that, okay?
‫You shouldn't bother doing it,
‫but as you can see, I got the error.
‫So I'm gonna run the docker-compose up -d one more time.
‫Since our dependencies' already installed,
‫I believe it will just start the API,
‫and here you go.
‫Now it says that starting API, it says, done.
‫Now I believe it should be okay.
‫Now, if I run ifconfig,
‫you will see that a lot of things is going on over here,
‫but what I'm gonna do, I'm gonna find my IP address.
‫Here you go.
‫Of course you can copy and paste it
‫from the DigitalOcean as well,
‫but I'm gonna run this,
‫and paste it in my browser to see if it's running up.
‫Here you go.
‫Now it means that it's running.
‫So it shows the Laravel, because it's written in PHP,
‫but we are not interested in this right now.
‫All you gotta do to reach the API itself,
‫say /vapi over here.
‫And here you go.
‫Now we are inside of the vulnerable API documentation,
‫which is exactly what we need.
‫Now if you see the screen, then you are good to go.
‫You are ready for pentesting.
‫Of course,
‫we're gonna install some tools for pentesting as well.
‫But aside from that, we are good to go.
‫Again, if you don't wanna set up your own server
‫or if you don't wanna set up your own API,
‫just take notes or just watch the lectures.
‫I believe you will learn something in this section.