On this lesson you'll learn to install Craft Cms in your local computer using the Terminal, Nitro & Composer.
It has been the best investment I made in my design journey so far. I would consider myself a novice but I honestly feel like I've gained a genuine professional insight into the process of creating a high-level website.
I'm an early adopter of the KreativePro Masterclass, and I love how well put together it is. Neftali takes you through each step of the process from paper sketches to marketing all with fun visuals & clear instructions!
Okay guys, the first thing we want to do is install Multipass. Multipass will help us run Craft nitro. So you want to install that first. Then, what we want to do is open it up and you're going to see it on the top. We're going to be able to see that we have the shell kind of running. You can have it run on log-in or on start, we go back to craft nitro and, what we want to do is simply copy the bash terminal code that they are giving us.
So we copy that, open up our terminal by simply searching for terminal. We're going to copy and paste that and what it's going to do, it's going to start downloading all that into our computer. As in my Mac, it was a fresh install, I don't have complete control of writing on top of my local machine. So what it's going to do is just copy and paste that sudo the same line, but I'm going to add sudo on before it, so sudo cp./nitro, blah, blah, blah.
And then I'm going to add nitro init, which is the command to start the initiation. And it's going to ask a series of questions, like what kind of the machine. How many CPU, what's the memory. You're just going to click enter on all of those, because that's the default that we want to have. And you'll notice we have PHP 7.4, my SQL.
This is probably the longest part of the process. And let's just give it a few so that it completes and on the top of the Multipass, you'll notice that now that it's running, right. So over here, what I'm doing is just adding nitro on my terminal and you're going to see all the commands available with nitro.
So if I add in nitro info, I can go back and recall the same server information. Now we just simply copy the IP address from terminal, and we're going to bring it over to our Sequel Pro, so go ahead and download that for your Mac computer. Paste that into the host and add the username nitro and password nitro, you click connect and boom.
Go click add database, and we're going to create a new database within this space called craft-new. Okay. Click add. The next step is simply to install composer within nitro. So we're going to open up our terminal and write this command "nitro install composer." Once it's completed, you will see it show up in the terminal. The next thing we want to do is install craft.
Now there's two ways to do that, but the easiest is just go to the site. Click on the manual downloading link that's there in step one, once we download that folder or that zip, we uncompress it we'll see it on our downloads folder. Then we want to go to the root folder in this case, it's Kreative Pro, which is my user account.
And then we want to paste that inside a projects folder. Because that's where we're going to have all our projects. In this case, we want to rename it SVR, which is our project that we're working on. And I want to open up the terminal and show you a couple of simple commands to access our folders. So the first command is ls, which is listing the directory files.
Then cd changes your directory. So if I enter cd/projects/svr takes me there. And then the ls simply lists all the files that we just downloaded from Craft. Pretty cool right? Another cool thing that nitro gives us is the ability to add a domain on our local machine and those domains and with a .test, we're going to go ahead and do that by adding that through the terminal.
So we simply add nitro add.
And then we enter the host name or the URL that we want. We click enter. So, what nitro is doing is simply adding those configurations into a Jamel file. So what's going to happen is going to ask you to enter your password. So just, you know, your admin password of the computer, and then once you do that, you can access the hosts file.
So, oops. I think I, that's not the one, let me write in cat the command and then etc/hosts. You'll notice here now that that host document, is going to have the IP address of nitro and that's it. You should now be able to access the domain SVR dot test. Once that's done, all we have to do is open up our SVR folder, where our craft is.
And what we want to do is reveal some hidden files that we need. These files contain variables in order for us to install craft. You can simply click on the keyboard shortcut, command + shift and dot. And as soon as you do that, you're going to see a couple of files that are hidden. This .env file, we're going to open that up with sublime or with visual code, whichever you prefer.
So it is important that you have the IP address close by. So you can copy that over to one of these variables. So let's take a look. Okay. And as you scroll through these, you're going to find the database server. That's the IP address we need to replace with the nitro.
For the port we want to use 3306 is just the standard number we can use. Database, as you recall on Sequel pro, we're going to have that the craft-new and the user and password is both nitro. What I want to do now is go into our domain svr.test/admin/install. We should see something like this, right?
So that's similar to how we saw in previous lessons, but I want to install it directly using the nitro server. So we open up the shell. So it's the same as going nitro SSH. And we're going to put in ls to see what's inside our server. We're going to, we're going to go into the site's folder. All right. And once you actually see all the folders again, inside the SVR folder, you should see something like this.
We're going to go ahead and install it directly from here. So we're going to write in PHP craft set up. That's going to ask us a set of questions, similar to how we would do in the actual website. So we're just going to put in here in my SQL and we're going to put in the same enter because that's the default port.
The database is craft-nitro or sorry, craft-new. And that should give us that success message as testing the database correctly. Right. It's going to ask us to install craft. We click enter to, yes, we're going to put and create a username and an email, and you can create a password and confirm it pretty simple.
It's the same steps as you would do on the website. So let's add in the site name, SVR, and the site URL is going to be in this case, the domain that we just created. So it's SVR dot test and we click enter. We go ahead and click enter on English and boom. What it's going to do now is, composer going to start pulling all those files and installing everything successfully.
So let's jump back.
Gonna remove the install and we're going to see the homepage ready to go. And that's it. We have installed Craft locally on our server. If we jump into the admin and put in the password that you just created, we have access now to the panel to see everything we need. All right, this is awesome. So let's go ahead and jump in and start configuring everything into our craft site.
Access our premium community including bonus tutorials, project files & weekly resources.LIFETIME 💎 ACCESS