(upbeat music)
All right, looks like the stream is running.
I'm gonna just quickly check that.
(upbeat music)
Seeing ourselves again and again and again.
That's funny.
(laughs)
All right, but it all seems to be working.
(upbeat music)
If you are joining us today,
it doesn't seem to be like there's anybody
in the chat right now.
So I'm just talking to myself for the looks of it.
But as you enter, do pop in and say hi.
(clears throat)
(upbeat music)
I'm gonna make sure that nobody is struggling to connect.
Seems to all be good.
Hey!
AJ's here, welcome.
Got some folks coming in, that's very cool.
All right, as usual, let me know if the audio is good
or bad, shall I say?
Let me know if the music is too loud.
I'm actually gonna drop the music down just a tad.
There we go.
And yeah, let me know if there's any audio glitches
or anything like that.
So, as you're joining today,
I wanna give a little bit of background
as to why we're even here this week.
I have been, for the last six months or so,
I have been working on the WordPress,
the beginner WordPress developer learning pathway
for Learn WordPress.
And I'm pleased to say that I have two videos short,
there's two more coming on here,
two videos short of completing this pathway.
And there was a series of lessons that I did
about a month ago now, a little over a month ago
around setting up a multi-side network.
And one of the comments on the setting up
a multi-side network video,
which I thought was quite interesting,
was somebody posted Amir Shayateh,
I apologize if I'm messing up your name there, my friend,
asked, "Can you make a video on how to set up a VPS
"with WordPress multi-side subdomain
"on open line speed with Ubuntu 20.04?"
So that got me thinking, yes, I could do that
because I have been fortunate to have fiddled
with some server things over time.
I'm gonna find the issue.
And I have played around with virtual private servers,
I have set up my own servers,
I'm a bit of an Ubuntu nerd.
And so I posted this as an idea,
and I got some feedback from folks to say that
folks might find interesting,
it's probably more of a niche topic.
What about if you two sort of don't target
one specific service setup or operating system,
make it more platform agnostic?
So then I thought, well, what about covering
installing WordPress and commercial multi-sides
on all the common web server platforms,
so Apache, Nginx, and OpenLiteSpeed?
And the reason that I thought,
sorry, one sec, I just need to turn something off.
Anyway, what I was saying was,
one reason that I want to do both all three,
Apache, Nginx, and OpenLiteSpeed is,
I'm fairly comfortable with Apache web server.
I'm also fairly comfortable with Nginx,
I'm more comfortable with, hey, I am,
excellent chip, hello.
I like the way you're into the chat, my friend.
So I'm very comfortable with Apache,
I've been using Apache as my default web server
since around 2006, I wanna say,
maybe even before that, 2004.
I'm fairly comfortable with Nginx,
I have set up and installed Nginx environments.
Apache is still my preferred option
because it's just, I feel easier to configure
and it supports HD access out of the box.
I know Nginx is faster in terms of serving static content,
but Apache is what I'm probably
definitely more comfortable with.
But I've never experienced OpenLiteSpeed,
I've heard about it, I know that it exists as a concept,
but I've never used it.
So I thought that this was a great idea
to actually turn this into three different live streams.
So how to install WordPress on Ubuntu VPS specifically.
Why Ubuntu?
Because in my opinion, it's the easiest server to get into.
It's based on Debian,
which is one of the more stable Linux servers.
And also it's the one that I have the most experience with.
I have used Ubuntu now since about 2006,
that's when I started using Apache on Ubuntu,
maybe even before that,
pretty much when I started web development.
I was on Windows at the time
and I just found Windows to be annoying to use.
And the thing that I struggled with was the path thing,
the fact that Windows,
PHP on Windows isn't specific about
whether your paths are uppercase or lowercase or whatever.
If your path has uppercase letters in it
and you type it all lowercase, it'll still work.
Whereas if you do that on Linux, it's gonna break.
And so I wanted to be developing in the environment
that I was gonna be deploying this code to.
So I taught myself basic Ubuntu server admin
and I had a little Ubuntu server
at home.
So I have probably the most experience with Ubuntu.
And so I thought that's what I'll do.
I'll start with Apache, then I'll do one on Nginx,
which will be a lot of the same stuff,
just the Nginx specific stuff.
And then the open light speed stuff
will be whatever open light speed is.
And obviously I'll have to do some research there.
So that's why we're here.
So this is the Apache version of this workshop
or this livestream, should I say.
I'm planning on doing the Nginx one sometime in July
and then the open light speed one
sometimes towards the end of July.
So if I look at the dates,
the July one will probably be
run about the first or second week of July,
second or third week of July.
And then maybe the Nginx one will be maybe
in the first week in August.
So that's the plan there.
And the goal is to try and build
a fully functional WordPress server
using Ubuntu, set up with Multisite,
using a domain and try and do it within an hour.
That's the goal.
I wanna try and do it within an hour.
And I've already spent eight minutes now
sharing the backstory.
So I'm cutting myself a little bit short.
Okay, let's get into it.
What I have done before this call
is I registered a DigitalOcean VPS.
They call them Droplets on DigitalOcean.
We're gonna see if I can log in here
without sharing my password.
So let's go log in with a different account.
And I think one password should have my password saved
for this account, there it is.
So I'm not sharing anything.
And I've created this droplets.
Now I've got to get my email.
So let me drag a tab off screen
so I can open up my email.
And I'll get this verification code that we need here.
Where's this email address?
There we go.
And I should probably configure this with my password manager
but I couldn't be bothered now.
So let's log in there.
The only reason I've used DigitalOcean for this
is because I'm, again, I'm more comfortable
with DigitalOcean.
I've used DigitalOcean quite a bit before.
So there is the VPS, I just called it Psychrotech VPS
and I'll explain why in a second.
And there is the IP address,
which is the most important part.
You don't have to use DigitalOcean.
There are things like Linode.
So Linode is another option.
There is Vulture,
which I think is now called something else.
I think Vulture got acquired by,
somebody got acquired.
Oh, it was Linode.
Okay, Linode got acquired by a Commy.
There's Vulture, there's Google Cloud,
there's Microsoft Azure, there's AWS.
There's all these services that allow you to create VPSs.
But DigitalOcean was one of the first ones that I ever used.
And it's again, the one that I'm the most comfortable with.
So I've created a very basic virtual server.
DigitalOcean calls them droplets.
It has half a gig of memory, 10 gig hard drive space
and I'm running up into 2204.
Now the person who requested this video
originally wanted 20.04,
but 2204 is the most stable LTS at the moment.
LTS has long-term support.
There is 2404, which has come out recently,
but that's still,
I always wait until the first point version of an LTS
comes up before I start using it.
So I'm gonna stick to 2204.
So that's what I did in the background.
I set up the server, set up the IP address.
And then the other thing that I did was I configured,
I have a custom domain.
My custom domain.
That I've owned for many, many years.
It's the psychotech.cosodomain.
And I use it for all these kinds of tests and things.
So I've set up the psychotech domain.
So if we ping psychotech.co.za,
you'll see it's pointing to the IP address 164.90.237.97,
which is the IP address of the server.
Where is it now?
164.90.237.97.
So that I did before this call.
So you will need to have a domain set up.
You will need to have your domain,
your DNS managed somewhere
and your DNS pointing to your IP address for your server.
I had to do all that upfront
because I was logging in and creating accounts
and I didn't wanna be doing that on the live stream.
But that's where we're at.
If you need, once you decide what server you're gonna use,
what platform you're gonna use,
they often will have instructions
on how to set all these things up.
You can Google this information.
It's all there.
Okay, so I've got my server set up.
What I also have done with Digital Ocean servers,
you can choose to set it up
with a root username and password,
or you can set it up with an SSH key.
I haven't gone the SSH key root.
I've kept it very simple, root username and password,
which I'll be using to log in with today.
And I won't be sharing my password with you.
But I might set up the SSH key during the installation.
We'll see how it goes.
Then let's quickly talk about resources.
So one of the other reasons
that I like to use Digital Ocean
is they have some amazing community documentation
around setting up and managing your servers.
This article, this how to install LAMP stack
when I put it, is an article that I have bookmarked.
I have used it many, many, many, many times.
I'm gonna share the link with you in the chat.
And what's nice is they update it every year
when the new versions come out.
And it's very, very, you know, they walk you through it.
Currently it's configured to set up for 22.04.
It has been the same way since 18.04.
So you can go through this
and you can usually set up everything you need
following these instructions.
So it's another reason why I like to support Digital Ocean.
I get no money from supporting them,
but I've always liked their walkthroughs, their tutorials.
They're very, very good and very, very detailed.
So that's what I'm going to be using today primarily
to set up the server.
And then once we have the basic LAMP stack set up,
then we'll dive into setting up WordPress
and all of those kinds of things.
Okay.
So let's dive in.
Today's gonna be very different
because I'm not gonna be doing much in my code editor.
I'm gonna be mostly working in the terminal.
So the first thing I wanna do
is I just wanna make my terminal window font
a little bit better, a little bit bigger
so that we can all see what's going on.
And I don't actually know where to do that, to be honest.
I wonder if you can just control command.
No, you can't do it.
Command plus maybe.
Oh, there we go.
Command plus does it.
Okay, command plus works.
So that should be that.
There we go.
That's a bit bigger.
It should be clear on screen what we're doing.
So that's gonna be where I'm doing most of my work today.
And I'm going to just open up my little note of screen
and copy the root password.
I'm going to log into the server.
The other piece of documentation
that I wanna share with you,
I wonder if they do it in this one.
Just wanna see patchy MySQL page.
They don't talk about setting up the SSH key.
So Digital Ocean does have an initial server setup guide,
which is basically just the process of setting it all up
and all the things you might need to install.
So let's go to that one and see what they have here
in terms of logging in as root creating a new user.
Okay, here we go.
Here's all the things we need.
Okay, so when you create a new server,
you should perform some important configuration steps.
So logging in as the root user,
creating a new user, always a good idea.
Granting the relevant privileges,
setting up a firewall, also a very good idea.
So we're gonna go through all of those steps first
and then we'll dive into the lamp stuff.
So let me copy this out for you and share it in the chat.
And those are basically the two articles
we'll be following today.
So I am on 2204, so that's great.
So now we log in as root.
So in the terminal, you're gonna go SSH root
at and the IP address.
Or in our case, we could use the Psychotech domain.
I'm gonna just use the IP address 'cause it's easier.
And then it's going to ask me for my password,
which I have copied off screen.
So I'm gonna grab that.
Don't want any of you logging into my server.
I'm gonna kill the server after the session anyway,
so it doesn't matter.
Okay, so there we are.
We're logged in, welcome to Ubuntu.
We're all good there.
Okay, excellent.
Then the next step, so they talk about the root user.
And basically what you wanna do is create a new user
and then turn that user into what they call the pseudo user.
We're having root privileges.
So it's gonna be add user and the username.
I'm gonna call my user Jonathan
and then I'm gonna run this user mod command
and go from there.
So what I like about Digital Ocean
is they allow you to copy these commands very easily.
What I'm going to do is I'm going to split screen
so that I don't have to keep jumping back and forth.
There we go.
Try and clear out that command.
So it's add user, add user,
and I'm gonna call it JBustenger just for being weird.
Okay, so it's created the JBustenger user.
I'm gonna type in a password
that I know is pretty strong.
It won't show up on screen, so that's fine.
If you're wondering, oh, passwords do not match.
Let me try that again. (laughs)
Okay.
(soft music)
Yay, password has been checked.
Okay, so full name, I'm just gonna put my name down.
Room number is always an interesting one to me.
I guess it comes from like Linux being used in dormitories
at universities back in the day.
Maybe Deviant, you know, I always find
that room number question interesting.
Okay, I don't care about work phone,
I don't care about home phone,
I don't care about other, that's all correct.
So there we go, created that user.
And the next step is to grant that user
the relevant administrative privileges.
It's something called pseudo access.
Basically, it's like the user has elevated permissions
if they run it with a pseudo command.
The nice thing about the pseudo system
is it does warn you if you're about to do something dangerous
and I believe, I saw this somewhere recently
on modern Linux systems, you actually can't
do anything dangerous without asking you first.
Like that whole joke about running
a Rm minus Rf star or something.
You actually can't do that as a pseudo user
without warning you, hey, what you're about to do
is dangerous.
So it's a really good idea to have a,
what we call a pseudo user setup,
which is what we're doing now.
So user mod, a, g, pseudo, and then it's the user name.
All right, so that's been done.
So now we talk about firewalls.
Setting up a fireball is a great idea.
It basically stops traffic to everything but certain areas.
There's a newer fireball application called UwF.
So if we run that command,
open SSH is the only thing that's currently available.
So the ability to SSH into the server, which is great.
So firewall allows a search connection.
So let's allow SSH.
Okay, that's been done.
And then now we enable the firewall.
So currently the only thing that you'll be able to do
is SSH into the server.
When we get onto, you know, MySQL and all that,
we can worry about that, what we need to do there.
We shouldn't have to do anything,
but we just want to open SSH enabled.
So yes, that's fine.
And active and enabled on system startup.
Excellent, so let's check the status quickly.
I love the fact that these things are copyable.
It's one of my favorite things
about modern technical documentation,
is the ability to just click copy on some code
and run it wherever you need to run it.
Okay, so status there we go.
So open SSH is enabled, excellent.
That's great.
Then we want to enable external access for the user.
So we need to make sure we can SSH in.
So they talk about configuring SSH access for your user
depends on whether your service root account
uses a password or SSH keys.
If you're logged in using your password,
then password authentication is enabled for SSH.
You can then SSH to your new account
by opening up a terminal and using SSH
with your new username.
So this, according to your instruction,
should be workable.
So let's try it.
So let's open a new terminal.
Let's do a new tab.
And I'm going to go sshj-bosinger@
and I'm just gonna go to Cycrotick
'cause the domain is pointing to the IP address
and its remote host identification has changed.
Now, earlier I tried to connect
to the Cycrotick.cozidomain.
So it's telling me that there's an error somewhere
with all of this.
So the nice thing is when this happens,
I can just delete line 15 in my known hosts.
So I'm going to edit this,
locally.
It's gonna ask me for my password.
(humming)
Okay, and it's one, one, two, three, four, five,
six, seven, eight, nine, 10, 11, 12, 13, 14, 15.
So there's all the Cycrotick ones.
So I'm gonna pop those out.
So I'm gonna just delete those,
check for any more, there's no more there.
Okay, excellent.
Basically the reason that's happening
is because I've connected to a server
that's linked to Cycrotick previously
when it was hosted somewhere else.
And it's got a line in the host file saying
this is where I think you're connecting to.
So are you sure you wanna carry on?
There's a problem.
So I have to not clean up my local doner.
This probably won't happen to you if you do this.
This is probably just a me thing.
So let's go and try and log in again.
Yeah, there we go.
It looks like it's better.
It's saying the authenticity can't be established.
Are you sure about this?
The host key is using other names.
You see it's telling us that it's using an IP address.
That's fine, I'm happy.
I want this to connect.
And then it adds that and then it asks me for the password.
And that's the password I just created
for that user on the server.
So now I need to remember that password.
If you're wondering why my head is turning back,
it's forth because I have to look behind my mic
so I can see my password keystrokes.
All right, I'm in, I'm good.
So now what's cool about this is I don't need to be logged
in as root anymore, which is not a good idea.
So typically what you would do now
is you would actually disable root access.
And I'm not quite sure how that's done anymore.
So I'm gonna hop over onto another article
that I often refer to.
This is a service setup guide
by a company called SpinupWP.
It's a company that I actually worked for for a while
while I was employed at Delicious Brains.
They do specifically WordPress VPS hosting,
but they also have a great article about setting up
your WordPress service.
So this is another one that I always keep bookmarked.
And I wanna just check if there is a,
if they talk about disabling the root user.
So there's all the stuff we just did.
There's the key pair.
I'm not gonna do that right now.
Public key, SSH keys, all of that.
There we go, SSH configuration.
With your news, you're created it's time
to further secure the server by configuring
a set of first and do is to disable SSH access
for the root user, which will no longer let you log
into the server via SSH using the root user.
So that's something you want to do.
Once you've got your user set up with your password,
it's always a good idea to disable root access.
So I'm going to, with my JBosenger user,
I'm going to go into the SSD config.
It's gonna ask me for my password again.
Yeah, I have to move my mic.
Okay, and then you need to find the line
that says permit root login, yes.
So I'm going to go and find,
it's asking me password's wrong.
There we go.
So we're looking for route, permit root login, yes.
You'll notice I'm using, let me actually cut out of here.
You'll notice that I'm using nano as a text editor
when I'm on the server.
You can use VI and VIM and those things
if you're more comfortable with those.
I prefer nano 'cause it's just easier to work with.
And you can use Control + W to do a search.
So I'm gonna go Control + W
and I'm gonna search for permit root login.
There we go.
And change it to permit root login, no.
Yeah, so there we go.
So the root user can't log in now.
I need to save that file
and then I need to restart the SSH server.
Now the SSH server is something that is enabled by default
on a new digital agent VPS.
Yes, I will share the spin up WP link in a second.
I actually think about that now.
So give me a second while I just finish here.
So there's the SSH restart, so that's done.
So now I'm going to exit out of here
and I'm going to try and log in as the root user again.
So let's do that one and it should give me an error.
I know it's gonna ask me for the password.
Okay, that's fine.
Once I pass in the password, it should give me an error.
So let me paste that password.
Yes, permission denied.
Okay, so the root user can't log in.
So that's great.
So even if you guys did hack my root password,
you wouldn't be able to log in now.
So that's that done.
Cool, let me grab this link.
The other thing I would mention
is that the spin up WP link, they specifically use Nginx.
So when I do the Nginx version of this live stream next week
or next month, whenever I'm going to be using that extensively.
So that's a good one to follow as well.
All right, so we've done the initial service setup.
We've got a user, we've got a secure user.
We're logged in as that user.
What is a good idea to do now?
And I should have actually done this
while I was still logged in as root,
is to actually log out as that user
once you've made changes and then log in again.
So I'm taking a bit of a chance.
So to make sure I don't have any problems,
what I'm going to do is I'm rather just gonna open up
a new tab and I'm gonna try and log in
as the JBosenger user.
So ssh JBosenger@psychrotech.c.c. today.
And that should allow me to log in.
It's asking for the password.
W, and I realize I might just mention my password
on the live stream.
So I'm not gonna do that anymore.
Okay, and I can still log in.
Now notice I can be logged in with the same user twice
in two different terminal sessions.
That's normal, that's expected,
but I can still log in, so that's great.
So now I can exit out of that one.
Roots has been locked up, so that's great.
And I can exit out of this one.
So let's just quit there and exit out of there.
And let's close down this tab.
And so now I've just got the one open.
Okay, so that is my recommendation.
Do the initial service setup.
Did I share that link as well?
Yes, I shared that link and I shared some NPL.
So that's all good.
So definitely do the initial service setup.
It makes your server more secure.
And then let's go and set up the software we need.
So the software we need is back on this article.
Here we go.
So this is your basic LAMP setup.
So Linux, Apache, MySQL, and PHP.
Now what I like about Digital Ocean
is because the articles are from the same space,
they have an update for the firewall.
So if you've set the firewall in the previous step,
then they give you some steps to update it,
which is very, very nice.
So the first step you should always do
is you should always update your server
whenever you start a new server.
So it's sudo apt update.
And that'll check for any new versions of any software
from the repositories and install any new software
and any new security updates.
It's always a good idea.
There are ways that you can configure your server
to automatically run these updates on a schedule.
I'm not gonna dive into that now,
but it's always a good thing to do
when you first start your server.
If you're running, if you're,
so just to go back to that, come on,
let me just clear this out.
Not that one, that one.
So sudo is what I do if I wanna run
any kind of root privileges command,
and updating my server software is one of those.
apt is the package manager for the server.
So on Ubuntu, it's apt on Red Hat, it's yum.
It's basically the package manager for the server,
and each Linux distribution has its own package manager.
There are additional package managers you can add up.
And so this is the one we'll use for Ubuntu.
Sammy says, "Did you mean live path
"regards to automatic update?"
I think that, is it called live?
Is it live path or live patch?
It's live patch.
Yes, that's one option, the live patch updating.
There's also something called unattended upgrades.
You can install that as well.
There's multiple different ways of doing it.
If you, my back, can you hear me?
Is it working?
If you're there and you can hear me,
please give me a hey.
That was extremely annoying.
I don't know what happened there,
but my screens went blank,
and when they came back, I lost my sound.
So if you're out there in the chat,
and you're still there, and you can still see this,
say hi, please.
Yay, AJ says, "The stream is back."
That's great.
I do apologize for that, folks.
I don't know what happened.
Was one of you trying to hack me, perhaps?
That is so frustrating.
But anyway, we're back, so we'll just continue along.
Oh my word, I don't think that's ever happened to me
in two years, well, maybe not a year.
Yeah, two years, three years of live streaming.
That has never happened to me, folks.
I apologize.
Now things are happening weird here.
Let me just copy this.
Okay, where were we?
What were we doing?
Can anybody remember what we were talking about?
(laughing)
I forgot.
All right, let's get on with it.
Oh yes, I was talking about package managers.
The mic, the mic, the mic is not working?
Can folks hear the mic?
Tarek says the mic is not working.
Okay, so seventh ward made me can't hear me.
Tarek, if you can give me a thumbs up
if you can hear me or let me know.
Okay, Sammy says clear.
So I'm gonna assume it's all good.
Maybe I just wasn't talking, which is very possible.
Okay, cool.
If you can't hear me, let me know,
but it seems like things are back to where they should be.
All right, we were talking about live patch.
We were talking about software.
We were talking about apps and all those things.
Okay, so let's get on with it.
So sudo ssh.
And this is one of the other reasons I like working
with a domain already set up
'cause I don't have to remember the IP address.
I just remember the domain name.
It makes life a lot easier.
Oh, now it's asking me for passwords here.
One day it's just gonna, let me take this off screen,
just in case.
Okay, it didn't show it anyway.
All right, yes, just do it.
Now it's gonna probably, oh no, that's fine.
Okay, now we gotta do another password.
And I'll be honest, this is one of the reasons
why it's actually a good idea to also set up
your SSH key pair because then you don't have to type
in passwords every time.
But anyway, I'm logged in now.
I'm not gonna worry about it.
Okay, let's get on with it.
So we ran the update and now we can install Apache.
And the nice thing about setting up LAMP
on an Apache server, so, oh no, Ubuntu server, sorry.
Linux, Apache, MySQL and PHP is it's very, very easy
because little known fact, the original developer,
the original creator of PHP, Rasmus Lödorf,
spent a lot of time, it's gonna be wrong now, you watch.
I can't do my password while I'm talking.
Ah, done it wrong again.
(soft music)
He spent a lot of time making sure that MySQL, come on.
There you go.
He spent a lot of time making sure that PHP Linux,
Linux, Apache, MySQL and PHP worked well together
and were easy to install.
So that's why LAMP became the default stack.
And so if you're on Ubuntu and you wanna install
the LAMP stack, it's one of the easiest to do,
which is why I chose it as my first topic.
So we're gonna do that.
So it's basically, it's one command,
it's sudo apt install Apache two.
It asks you about whether you wanna install services.
Yeah, that's fine.
When you get these kinds of screens in the terminal,
you can use tab to tab around and then enter for okay
and shift to trigger things.
It's like using a keyboard to browse around.
So I'm gonna restart that one.
It does a whole bunch of things
and installs a bunch of things.
And the cool thing about it, once it's done,
I should be able to browse to the domain name
and see the Apache landing page.
I don't know why it's taking so long though.
It should just work.
Let's see what happens if we browse to the IP address,
which I'm not gonna remember.
I'm gonna write it down somewhere.
No, I did not.
Oh, it's not gonna work 'cause I need to allow Apache.
Okay, so let's do that.
So sudo uf apt list.
So there we go.
So now Apache is available to enable, which is great.
So we want to enable those.
So we're gonna allow Apache on port 80,
which is there.
Come on, run it, thank you.
I'm not gonna worry about the status now.
And now I should be able to browse.
Let's see.
Might have to restart the service.
No, it should just...
Wonder if it needs to be restarted.
Let's see.
Okay, let's try again.
I have a feeling there's a command I need to...
Let's just go to status.
It's all allowed.
Let's try the IP address and see if that works.
(soft music)
Codes again.
So many things that I just have set up by default
that I forget that are needed when you do these things.
(soft music)
Let's copy the IP address and see if that works.
(soft music)
Okay, that works.
I thought, okay, so now that I think about it,
the reason the domain doesn't work
is because I haven't set up a virtual host for that domain.
So that does kind of make sense.
So that's fine.
So the IP address does work,
getting the default Apache two page, cool.
Apache is installed, excellent, all good.
All right, now the step two is installing MySQL,
step three is installing PHP,
step four is creating a virtual host for the website.
So that's the point where we'll set up the virtual host
which configures the domain name
so that when the domain makes a request,
the server knows what to do with it.
So that's why Cycrotech wasn't working earlier.
So we'll get there in a second.
So I do need the IP address.
I was hoping I wouldn't. (laughs)
Next step is installing MySQL.
So it's basically just this command over here.
So we'll copy that one out and we will paste it in there.
And there we go, does a whole bunch of things.
You can also skip this,
do you wanna continue by passing in a dash Y
when you do the install command?
We'll do that for PHP in a second.
And I'll show you how that works.
So that's gonna do its thing.
And then this is something that I'm very appreciative
that DigitalOcean has included in this big red box.
But basically in July of 2022,
there was an update to the MySQL database
that installed MySQL on your server by default
using what's known as the root authentication method.
Basically what that means is only the root user on the server
can log into the MySQL server to make any kind of changes.
And so what you need to do is you need to update
the MySQL server to allow for what's known
as password authentication.
So you can log in as a root user or whatever you want
and then you use those credentials
to connect your WordPress site or whatever the case may be.
So DigitalOcean is great,
they've got this whole process here
about all of these things.
So what you then do, once MySQL is installed,
you log in as the root user
by putting sudo in front of the commands.
Anytime you see sudo in front of a command
in front of your user,
it means you're trying to log in as the root user.
So sudo MySQL, there we go.
(upbeat music)
Ah, there was an error.
Didn't see that.
Let's try that again.
(upbeat music)
Yeah, that's annoying.
Server unable to determine
if the down is running.
Server failed to start.
All right.
It's just typical,
I've never seen this problem before in my life.
Let's see what's sitting in the error log.
This is gonna take longer than an hour now.
You watch.
This is annoying.
(sighs)
Roots log less into password.
Ah, good grief.
(sighs)
I'm gonna run, I've already run update,
and run update again,
and I'm gonna run upgrade and see if that fixes something.
Maybe there's some piece of software
that's out of date or something.
When in doubt, run update and upgrade.
(upbeat music)
Okay, so there were some changes, so let's see.
(sniffs)
A little part of the livestream where I got quiet
is I'm annoyed. (chuckles)
This is the part where you sit and watch,
and drink coffee. (chuckles)
Listen to music.
(sighs)
I hope this fixes it,
'cause if it doesn't, I don't know what I'm gonna do.
I might have to start googling.
(sniffs)
(upbeat music)
I should have run upgrade
before I did anything else on the server.
So that was a little lesson, folks.
If this does work, always make sure you run update
and then upgrade before you do anything else.
I need to go blow my nose.
I'm going to turn the mic off,
'cause I blow my nose loudly.
Doesn't get more live than that. (chuckles)
We've got 13 minutes left.
I'm not gonna get this done in an hour, now I'm annoyed.
(chuckles)
It's okay.
I did set aside two hours of this,
so it's not the end of the world.
Okay.
Unable to start the server.
All right, well, let's see if we can fix it now after this.
Still giving issues.
Yeah, I'm gonna keep the local version of that.
Unless he didn't think he's throwing the MySQL server,
it would be where we got stuck. (chuckles)
I wonder if it's a memory thing.
I wonder if the web server needs to be upgraded to one gig.
Hmm.
It's gonna be really annoying if that is the case.
'Cause I just chose the smaller server.
Without thinking about that.
I don't know how quick it's gonna be to upgrade the VPS.
(electronic music)
I wonder if it's worth upgrading the RAM.
I've only ever done VPSs, I think, with one gig of RAM.
So, I don't know if that could be the problem, though.
I think 512 would be enough
just to set up a basic lamp install.
Let's just see what free memory we have
after this thing finishes.
(electronic music)
Actually, I can check that one up here.
Bandwidth CPU, disk IOO,
oh, they don't show memory usage.
Hmm, that's annoying.
(electronic music)
Ah, hurry up.
(sighs)
(electronic music)
This is why Linux has had me charge you lots of money, folks,
'cause I have to sit around
and wait for this kind of stuff to finish.
(scoffs)
(electronic music)
I do this again.
I'm gonna run this before I run the livestream.
Hmm.
(electronic music)
Definitely, Sammy, I've definitely installed
this configuration on a one gig of RAM before,
so that's why I'm thinking it could be that.
So if this upgrade, if the software upgrade doesn't fix it,
then I'm gonna try resizing the machine
and seeing if that fixes it.
This is just taking really long, though,
which is mildly annoying.
And I'm wondering if that also has to do with the RAM,
the available RAM.
I do feel like that's what I need to do.
Yeah, that's what I should have probably done
before I started this seventh one.
Lessons learned.
Do that before you run the livestream.
(laughs)
I stupidly assume that by creating the server today,
I would get whatever the latest stuff was,
but I guess that was naive of me.
This is taking so long now.
(electronic music)
At what point do you give up?
(laughs)
At what point?
There we go, okay, couldn't do that.
I'm almost sure this is a RAM-related issue.
But it worries me, Nias, if I cancel this process,
what's gonna happen?
(laughs)
Well, Sammy, if you've learned nothing else today,
it's get bigger servers. (laughs)
Don't run, don't run livestreams
on the smallest server possible.
That was my mistake.
Blast.
(laughs)
Nice.
I really think I've shot myself in the foot,
but not giving it at least one gig of memory.
It worries me what's gonna happen now
if I cancel this before it's done.
(electronic music)
I'm gonna do it though.
Okay.
All right, here we go, it's doing some things still.
96%, come on, you can do it.
97.
(electronic music)
I'm gonna say, I'm gonna say.
98.
(electronic music)
I want it to be done by now.
I want it to have a working WordPress by now.
This is so annoying.
Hopefully we can get it done by half past.
(electronic music)
I'm hoping that the upgrade to more RAM and CPU,
whatever it is, is quick.
I do know you have to turn it off to resize it.
I'm pretty sure the RAM and CPU thing is quick.
I'm hoping that it's quick.
So I'm going to, when this is done,
that's what I'm going to do.
And then I'm going to hope for the rest.
(electronic music)
It's nice and 90%, come on, hurry up.
While it's doing that, I'm going to log in
to a new tab, okay.
(electronic music)
I'm just going to run the free minus M command
because I want to see how much free memory.
So total is 466, uses 423.
So it's very possible the memory is the issue
because it's like six bytes free or whatever it is, 19.
So it's very possible that's the issue.
(electronic music)
Is it possible to horizontal scale your server
while trying, I honestly have no idea.
With the digital ocean droplets,
you have to turn off your droplet
if you're going to increase the CPU and RAM.
I assume by memory serves horizontal scale
would mean adding more servers into a,
what do they call it?
And then having a load balancer
with balance between the two,
I think that's horizontal scaling.
So you have more instances of the server,
vertical is bigger server, I think.
I'm going to have to Google that now.
I really signed up, this is very difficult scaling.
If my memory serves.
Horizontal scaling excels in distributing workloads
across multiple nodes, vertical scaling
is where a single machine
can handle the entire workload efficiently.
So horizontal scaling would be adding another server
and then having a load balancer
balance the traffic between the two.
That you can obviously do while your servers are running.
That's not going to fix this problem.
If it is the memory, this problem is a vertical scaling issue
and I need to turn off the server to do that.
I am not a qualified Linux's admin,
so I can't advise you on the differences
and the benefits of horizontal versus vertical scaling.
I have worked in companies
where somebody else has managed that.
And basically vertical scaling,
Amazon does it pretty well,
DigitalOcean does it pretty well.
It has a load balancer, which is like a server
between the browser and your server.
And then it takes if there's like high traffic peaks
and it'll spin up a new copy of the current server
and then push the traffic to the newer server
and then you have your database
in a central location behind that
and the multiple servers can connect the database and back.
But that's a whole different configuration
from what we got here.
So that wouldn't help me here.
So that's finished.
I'm pretty sure it's the RAM.
So let's see if we can upgrade it.
So I'm going to upgrade it to the one gig
and let's see how long that'll take.
I first need to turn off the droplet.
So let's turn it off.
Okay, you also have the bolt.
Yes, all right, fine.
So let's turn it off.
While that's turning off, I'm going to exit out of here
and also close this one down.
This should happen pretty quickly.
Well, maybe not because there's never enough memory to shut down.
Cheepers.
Come on, I think it's so slow today.
Okay, it's off, let's go.
Go, go, go, go, let's upgrade it to one gig, let's see.
(soft music)
All right, it seems to be pretty quick, so it's good.
Not so much, this is like Windows version of time estimation.
I know that's up again, it's down again.
It's up again, it's going up.
It's going up more.
Okay, it seems to be positive, it's going pretty fast.
(soft music)
Okay, cool, it's been resized, that was nice and quick.
So let's turn it on.
All right, it's on, let's log in.
(soft music)
Yeah, we're going to log in.
(soft music)
Does it have a new IP address?
Please tell me it doesn't have a new IP address.
(soft music)
What the hell different IP address?
One, one, two, three, seven, seven.
(soft music)
Okay, so now memory users is 57%, so that's much better.
Let's see if we can install my SQL server.
It's the wrong password.
(soft music)
Okay, so there we have it folks.
You can't do this on a 512 gig memory server.
Lesson learned, don't do that.
Okay, the other thing I want to do here now
is I want to check the IP address
because I think it's changed 164, 90, 237, 97.
164, no it hasn't changed, 237, 97.
So I wonder why the domain wasn't working, that's weird.
Anyway, I'm not going to worry too much about it now.
It's working, that's all I care about at this point in time.
Okay, let's get back to what we were doing.
So we were logging in as the MySQL,
as the pseudo, as the root user, dammit.
So now we're logging to the database
and then it tells you to alter the root user
to be identified by a password.
So I'm going to just keep that very simple
and I'm just going to use that command.
So root user identified by password.
This is not recommended on a production environment.
I don't recommend using the password, password.
But I haven't opened up port 3306,
which is the default MySQL password
or any MySQL services in the firewall.
So I'm pretty sure this would be safe to do.
We can test it in a second to make sure,
but for now I'm leaving it as password.
But I don't recommend you do this on your own servers,
make it something secure or create a different user
if you want to connect your WordPress sites
because just now I'm going to use it in the WordPress install.
But I don't recommend doing this, okay?
So if I see you doing this on your live servers,
then I didn't tell you to do this.
But for now I'm just going to leave it as password.
Okay, and then we can exit out of here.
And now we should be able to run
this MySQL secure installation, which is this.
And it asks a bunch of questions.
So it says answer why for yes
or anything else to continue without enabling.
Okay, so enter the password for the root user
so we can say password, done, okay.
Validate password component.
Can be used to test passwords,
checks the strength of the password
as users do, do, do, do, do.
Would you like to install that?
Yes, I think it's actually going to ask us
to set a better password in a second.
So we'll do that.
Okay, then it talks about three levels of password.
So I'm just going to go, I'm going to go with low on this one,
but you know, you choose your own options there.
I'm going to go with low, change the password for root.
Then it asks you to change your password for root.
This is not to be confused with the system password.
And this is up to you whether you want to do this.
I am going to change the password for root.
I'm going to change the password right now.
So I have got a pre-prepared password that I have a screen.
I'm going to copy the first letter
just to see if I can paste it
just to help with some additional security.
Yeah, okay, that does work, excellent.
So I created a root password securely for myself
that I've copied, that I'm copying.
Hopefully I'm copying a little screen.
Let me just check my ops.
Yes, it is all screen.
(laughs)
So I'm going to just paste that in there
and that'll be my new root user password.
So even if somebody did try and hack my server now,
they wouldn't be able to use the default password anyway.
So that's great.
Do you wish to continue with the password provided?
Okay, so it says the estimated strength is 50
so it's gone from 50 to 100.
So I'm going to leave it like that for now.
Do you want to continue with the password provided?
Yes.
And then it asks you if you want to remove anonymous users.
So let's go ahead and do that.
And then disallow root login remotely.
So that would allow somebody external to the server
to log in, which we don't want.
You can always disable it later
if you want to access it, but I'm going to turn it off.
So yes, I want to disallow root login remotely.
So that adds additional level of security.
Remove test database.
I'm going to leave the test database.
Too worried about that.
Reload table privileges.
Yes, it's reload privileges.
And we're done.
Okay, so now you...
When you're finished test, we're able to log in
by typing that.
Okay, so it talks about if you log in that way,
you don't need a password,
but I should be able to log in
as the MySQL root user now.
So MySQL minus U root minus P and my password.
And that should allow me to log in.
You can see the password there now.
I should have done it like this.
Okay, I'll change that.
Let me change that quickly.
That was daft.
I just shared the password.
What was it?
Pseudo-MySQL and SQL installation.
Let's go through that process again.
(humming)
Yeah, so let's paste that password that I just pasted.
Okay, now it's not allowing me to log in
as that user and password.
That's what I should have done.
And then pasted the password.
And I can't log in.
Now I want to be able to log in as that password.
I can't do that either.
So positive minus U root minus P.
(sighing)
(upbeat music)
According to me, this should work.
It's not working, so I've done something wrong here.
So what I'm going to do is I'm gonna reinstall everything.
So pseudo-app remove.
(upbeat music)
MySQL server, I think it's purge.
While that's doing that, I'm going to open one password
and generate another password.
line.
Like you're annoyed, that didn't work the way I wanted it to.
Anyway, let's go back.
Okay, let's try this again.
Pseudo-app install,
MySQL server.
Eh?
Annoying.
(upbeat music)
I'm gonna bulk myself now.
Ah, there we go.
Okay, so that worked.
So now let's try MySQL,
see root, P.
See if that works.
That works.
I'm not sure why it works.
That's annoying.
But this is essentially what I wanted to get to.
I wanted to get to a point where,
I wonder if it's because I reinstalled it
in kind of a brief reason.
I wonder if I needed to reset the server.
Hmm.
'Cause what I want is I want to be able to log in
with the root user passing in my password.
'Cause when I set up the website, I want that to work.
So it works.
I'm a little annoyed that it does work, but it works.
I feel like maybe these instructions are a bit wonky.
Maybe I should have restarted this MySQL service
before trying it.
So that would have been something like
sudo service,
MySQL server restart or something.
Is it that one?
Should I?
It's MySQL D.
Can't remember now.
(soft music)
Did I service MySQL D restart?
That's what it's supposed to be.
(soft music)
Hmm, that's weird.
Feel like I've done something wrong,
'cause that should work.
(soft music)
Not a stop service, it's not allowed.
(soft music)
I'm confused now.
(soft music)
Okay, well the weird thing is I can connect to the server
using the password.
(soft music)
Which is weird.
(soft music)
I'm gonna just update that password
so that nobody tries to hack my server.
So just give me a second here, I'm gonna do that off screen.
I honestly don't know why this is working.
And this is annoying me now.
And normally what I would do now
is I would take a page out of whose book was it,
and I would nuke this thing and I would restart.
Because I don't understand why that didn't work.
(soft music)
So I'm a little bit frustrated.
Now I'm trying to change the password
and it says the password doesn't,
doesn't satisfy the current policy requirements, good grief.
Let's do this and one and I don't know, do that.
See if that works.
Yeah, that worked.
So I have a new root password now.
(soft music)
I'm just clearing the screen so you folks can't see it.
I'm annoyed.
I don't know why that didn't work and why it does work now.
So I'm gonna try this again when we do the Nginx version.
See if I can figure out what's going on there.
Sammy says when you install MySQL server,
does it come bundled with MySQL Workbench and MySQL CLI?
So Workbench, no, I don't think so.
I think that's a specifically a GUI application.
I think you have to install that separately.
It does come with a MySQL CLI,
which is why I'm able to run these MySQL commands.
So it does come bundled with that.
But essentially the end goal that I wanna get to is this,
where I can log in as the root user
and I can specify a password,
which I'm gonna not paste incorrectly now.
And then I'll use that user to connect
for the WordPress site.
So that's working.
I don't know why it's not working.
It's annoying me, but I'm gonna press on anyway.
And I'm gonna just have to check this out
on another server sometime
and see exactly what's going on here.
So I will do some research on this.
And when we do the Nginx version,
we'll see what's going on there.
Okay, next up is PHP.
So again, we can just install these packages here.
Now, the one thing I would note is that
in the DigitalOcean setup,
that only gets you to install PHP,
the Apache mod and MySQL mod.
It's a good idea to install anything else you might need.
So there is a local WordPress development environment
that I know, not that one,
that I manage.
And I have a slightly longer version of
that command in there.
I don't mind sharing this
because there's nothing, it's all public.
But the command that I use is this one.
So I'm gonna copy that out.
And then I will place this link in the chat
so you can see it all there.
But essentially it's this line.
So what I'm installing here, no, not that one.
Sorry, didn't want that.
I wanted the PHP stuff.
There we go.
Okay, so what I'm installing is PHP,
the Apache module, MySQL, common packages,
XML package, XML RPC, curl, the GD library,
image magic, the CLI, the IMAP stuff,
the MB string stuff, the SOAP stuff, the zip stuff,
'cause it's all used by PHP applications.
It's one of the things that I don't like
about the DigitalOcean instructions
is they don't go through all of that.
They just install the PHP.
And then as you realize you need packages,
then you have to install them separately.
I like to do that all up front.
So that's what I'm going to do now.
You'll also see there's the minus Y.
So that's what I mentioned earlier.
You can append minus Y and that just says
say yes to everything, to your app install commands.
Somebody shared earlier that they do, who was it?
Who was it that said they do?
There we go.
Seventh Ward made me update and upgrade minus Y,
same thing.
So that's what I'm gonna do.
So I'm gonna run that.
And then that's all, and it's gonna,
and you see it doesn't ask me,
do I want to install these things?
It just, off it goes and it does this thing.
Now what's interesting is that this is going to install
the latest version of PHP,
which I think is gonna be 8.3 on Ubuntu 2204.
I'm not sure.
So we'll check once it's finished.
According to this documentation, it's 8.1, so we'll see.
There is a way that you can install
different versions of PHP.
I'm not gonna dive into that today.
Maybe we'll do that in a future session.
But I just want to see what,
oh, it's 8.1 that's installing.
So that's perfect.
And that's another good reason
to stick to a slightly older LTS of Ubuntu,
because it's gonna be using a version
that is pretty well supported by WordPress.
I think WordPress just recently announced full support
for PHP 8.1, 'cause they're still busy
working on 8.2 and 8.3.
So running a slightly older LTS of Ubuntu on your servers
is often a good idea.
So in this case, I'm doing 2204,
which is the, so the most recent one was 2404,
which was released in April, so 2024.04.
So I usually run the one before that,
and I kind of keep it up to date that way.
Okay, so if we go PHP minus V,
there we go, 8.1, perfect, that's all we need.
Then it says changing Apache's directory index.
In some cases, you might want to modify
the way Apache serves files.
If the user requests, they'll first look for the index
or HTML, we want the website to prefer PHP files,
which is not a bad idea.
So to make this change, open the dir.conf file,
which is this one, so let's edit that.
There we go, and then all we'll do is we'll add
index.php higher up the list.
So over here, we'll just go index.php,
and then remove it down over here.
And all this is going to do is if there's an index.php file,
it's going to always load that first minute browser
to any folder, which is perfect,
that's exactly what we need.
So we can save that.
And then restart Apache.
So let's restart Apache.
I wonder if,
just do Apache that way,
I wonder if that'll work for MySQL D as well.
Something's gone wrong with this MySQL server installation.
I'm going to have to figure that out.
Anyway, not going to worry about it now.
I'm not going to worry about the status.
I'm happy that it should all be working.
Okay, here it talks about installing the PHP exceptions,
sorry, extensions.
So you can do a PHP search,
or an app search for everything to do with PHP.
And then it gives you this massive list.
But then you've got to go through all these things
and decide which ones you want.
So that's why I like to keep a copy of
what I actually want somewhere.
And I install that one.
I think they might give you,
so there's PHP CLI, for example.
Yeah, they don't give you a nice version of this.
So this is the one I always use.
This installs pretty much everything you need.
So you'll find it there.
So this is a cloud, cloud init thing.
You can use this to pre-configure servers.
I'm using it for an Ubuntu thing that I've got.
You're welcome to dive into that code, I don't care.
But I'm not going to go into that too much now.
Okay, let's get back over here.
So now we've got all the packages installed.
We've got Linux installed, the server.
We've got Apache installed.
We've got MySQL installed.
We've got PHP installed.
Now we need to create a virtual host.
So an Apache virtual host is basically a file
that tells the server when a URL requests data from me,
which files I serve.
And so in the case of the IP address,
it's using the default virtualized file.
But in the case of our domain that we set up,
so PSYK, ROTK, that's it, it doesn't know what to do.
It doesn't know what files to serve.
So it freaks out.
And then it just defaults to the default thing.
So what we're going to do is we're going to create
a virtual host for the domain,
which is what they talk you through here.
And then we're going to configure the file.
So let's copy this.
And we're just going to call this one,
"psychrotech".
And then we're going to assign it,
assign it to the user environment
of your current system user.
So that's that.
Tech, so this is creating a directory
inside the var ww folder, which points to that user.
And then we're going to create the virtual host.
Hey, it's Ryan.
Hey buddy.
Ryan's decided to come and visit my live stream
because I was on his the other day.
If you're not following, Ryan, now it's your turn.
Drop your Twitch in the chat.
And if you're not following Ryan, follow Ryan now.
Okay, so let's make this domain.
There we go.
And then you can generally just copy the virtual host details here.
There we go.
Ryan Welch of codes.
If you want to learn anything about WordPress development,
WordPress coding, block development, PHP development,
JavaScript development, go and follow Ryan.
He does a way better job of it than I do.
And he's in a US friendly time zone as well.
That's not why I showed up though.
Just kidding, man.
Okay, so let me finish this out over here.
So let's say server name, we'll call it.
Psychrotech and server alias.
I'm just going to get to before.
There we go.
And let's do server alias, psychrotech,
in case anybody comes from the www.
One of the most annoying things on the web, maybe a little,
is when people haven't set up their www alias.
And we'll just say webmaster@psychrotech.c.
That's okay, that's fine.
Document root is that.
And then a little thing that I discovered recently,
and this is going back to my local environment,
is on Apache.
Let me see if I can find it here.
I don't know if I'm going to have this problem,
but I'm going to see if it's an issue.
So let's just go here.
Scripts.
Of late, I have needed to set up these,
sort of require all order from allow, deny,
all that kind of things.
So I might need to use this in a second.
We'll see how it goes.
But that's the basic virtual host there.
So the server name is whatever domain name you're pointing it to.
The server alias is always good to include aliases
if you need to, especially for www if people come looking for it.
Server admin is usually your email address.
Document root is the path to the files,
and then the error logs in that you can leave as default.
So once that's created,
now we need to enable the virtual host.
So you run the sudo at-ensite command.
So sudo at-ensite,
we'll call it psychrotech.
Oh, const spell.
Oh, wait. Am I in the right place here?
Oh, it's because I didn't create a cont file.
I just close there.
Okay, so let's fix that.
So let's move.
etc, Apache2, sites available.
It's got to be a conf file, not just a plain text file without any extension.
Otherwise Apache doesn't know what to do with it.
So .conf.
Okay, and now let's try and enable it.
That should just work.
Yay, enabled new site. Excellent. Okay.
And then we can reload Apache.
So we'll go sudo system reload Apache.
There we go. That should work.
Now we just need to,
inside that psychrotech folder, we need to create something.
So let's just go nano index.php.
I think the documentation actually,
it actually says to disable the default site.
I'm not going to worry about that now.
You can do a config test, reload things.
And then it actually says start creating an index.html or whatever.
I'm going to create an index.php.
And what I like to do is I just like to create a PHP info file.
So PHP info, enough info.
There we go.
And that'll give me some PHP information when I hit that page.
So there we go. That's that.
So now if I go to psychrotech, I should see a PHP info page.
It worked.
Okay, so that is it set up. It should work now.
We should be able to install WordPress and all good.
One thing I want to note,
I don't think this documentation dives into it.
But you should be setting up what are they called?
SSL certificates for your websites.
The spinupWP documentation I shared with you earlier has got information about that.
I'm not going to dive into that now.
But essentially you set up the sort of, you can use Let's Encrypt.
You can set up a self-signed certificate.
And then when you do that, you set up a SSL Apache virtual host configuration
and you get that all working.
I am running out of time.
I was hoping to do that today, but I'm running out of time.
So I will try and see maybe we can do this again.
Maybe when we do nginx, we can cover it on there.
But that is a good thing to do.
But now we've got everything up and working.
We've got MySQL installed.
We've got Apache installed.
We've got PHP installed.
Now we need to install WordPress.
And my favorite way to do this on a server is to use WPCLI.
Because WPCLI is just easier and quicker and more straightforward.
So if you've never used WPCLI before, this is the perfect time to dive into it.
Especially if you're managing servers.
The installation is really, really quick and easy.
You run this command here, which basically downloads the WPCLI file.
So I'm going to just run it in the root of my user.
It's downloaded it.
You can do these things if you want to, but I'm just going to jump straight ahead
and copy it to my user local bin.wp directory.
So we're going to change the permissions.
Basically making the file executable.
No, not mark.
Paste.
So there we go.
And then we're going to move the file to this path here, to WP.
We'll just move it over.
There we go.
And now if I just run WP minus info anywhere on my machine, WPCLI will work.
So what's cool about that is now I can go CD, www, no, CD, vr, www, psychrotick.
And I can just run WP call download.
If I could spell it.
And it will just download WordPress for me.
You can also do a WordPress installation using WPCLI, which is what I'm going to do now.
So I think it is WP core install.
Okay.
It tells me it needs a config file.
So then I can create a WP config create and it will actually ask me some questions.
It's missing a DB name parameter and a DB user parameter.
So if I go WP config create minus minus DB name, I haven't created the database yet.
I need to create the database.
Okay.
Let's take a step back.
So let's create the WordPress database.
Now, this isn't in any of the documentation.
This is all just how to do things in the command line.
So I haven't got any links for you for any of this.
But if you want to create a database, you basically log in as the MySQL server, as the MySQL user.
You don't share your password on the live stream.
I'm going to make this bigger quickly.
So there I'm logged in.
I'm trying to clear it.
So hang on.
Let me do that again.
I like to be at the top of the window.
There we go.
Okay.
There we go.
And paste that.
Boom.
We're logged in.
And then you're going to go create database and I'm just going to call it psychrotech for now.
Always using semicolons at the end of any SQL statement.
So there it creates the database.
So that's good.
I'm going to use this root user to access the database.
So that's fine.
So that's all I need to do.
So now I can exit out of here.
So the database is created.
All right.
So then it was wp-config-create --db-user, I think it was.
And in this case, we'll make it root.
Oh, I just realized I need to specify the db password.
And I need to actually share the password with you.
So I'm going to take this off screen.
I'm going to have to share it anyway.
So I actually don't care.
I'm going to delete the server after it's all over.
So it doesn't matter.
I don't know why I'm being so secretive about it.
So I'm just going to copy this password out.
And then I think it's just a db name.
Equals psychrotech.
I think that will work.
Okay.
db -- I think it's db-pass.
Now that I think about it.
Yes, there we go.
So now if I have a look, I've got a wp-config.php file.
It's created for me.
It's got the db name, the root user, the password, localhost.
That's all perfect.
The other thing it doesn't do -- oh, no, it does generate keys and salts.
That's excellent.
It sets up the demo prefix.
So that's created.
Now I should be able to go to wp-core-install.
And it's going to ask me for the URL, the title, the admin user, the admin email.
And I'm going to specify the admin pass as well.
So wp-core-install --url is equal to --
-- psychrotech.cl.za
Title is -- we'll just call it psychrotech.
Admin user.
I'm going to make it j-bosinger.
And admin email.
I'm going to make my email address, which I have access to and you don't.
So I'll be able to set up a password.
Okay.
So that's going to run the install, set up the tables, all that kind of stuff.
Okay.
There's the password.
So if you want to, you're welcome to hop out over there and log into the site right now.
As I say, I'm going to destroy the server anyway, but let's go back over here.
So if we go to psychrotech, there we go.
There is the site.
And there is wp-admin.
And it's asking me to log in.
I'm going to do a last password so that it saves the password.
Get a new password.
Oh, it could not be sent.
Oh, I can't send out emails.
Oh, never mind then.
I'll just log in with the password.
So let's just pop that in there.
Yay, we're in.
And that is WordPress installed, up and running, ready to rock and roll.
I'm going to see if I can quickly take this off-screen and generate a new password
so nobody hacks my server.
Let's just go set it with new password.
There we go.
Update profile.
There we go.
I've got a new password now.
You can't hack it to my server.
I'm going to take that off-screen and pop it on over there.
And there we go.
We have WordPress installed.
We're running out of time, so I'm going to try and see if I can quickly do the multi-site thing quickly.
What I did do was I did set up.
So let's exit out of here.
I did set up a wildcard DNS entry.
So if I go ping bob@psychrotech.cir.za, it should come back with the IP address, which is what it's doing.
So in my DNS, I've set up a wildcard entry so that anything .psychrotech.cir.cir.cir today points to that server.
So that means I should be able to turn this into a multi-site now, which is one of the other things that I wanted to do.
So if we go over to the WordPress multi-site administration pages in the dashboard.
Oh, dear.
Develop has fallen over.
Let's do a refresh here.
Oh, don't you love it when the documentation dies when you're in the middle of a live stream?
But you're somebody's updating something.
That's so frustrating.
Okay, let's try the codex.
Ryan, go and tell somebody that the developer docs have fallen over.
Oh, the codex is done as well.
Oh, no.
Oh, dear.
Hopefully somebody's reported this.
I'm sure they have.
So I actually do have...
Let me do it this way.
Ryan says it works for him.
Maybe it's my internet doing weird and wonderful things.
Interesting. Interesting, interesting, interesting, interesting.
Yeah, that's what I was thinking now.
I've just enabled it.
Let me see here.
Ah, there we go.
Okay, so let's sort this out.
Okay, it's working.
Yay.
So it was me.
It was all me.
So multi-site.
Where is it?
Here we go.
Multi-site network.
Okay, so we're going to do a refresh here.
Okay.
So let's see.
Here we go.
Multi-site network.
And basically, to create a network, you log into the config file and you say define allow
multi-site true.
So let's do that.
So let's log back into the server.
There we go.
Okay.
Let's log into the config.
And let's define multi-site.
Okay.
Oh, that's interesting.
That's changed.
It must be a recent thing.
Okay, so we want to allow multi-site, so that's great.
And we save that.
And then if we go back here and refresh the dashboard, then we should have a network setting
thing somewhere.
It's in the tools.
Tools, networks, there we go.
Please make sure mod rewrite is installed.
I'm trying to think if mod rewrite is installed.
Check that.
See the A2E and mod rewrite.
Okay, so it wasn't enabled, so that was the command to enable it.
CIDO A2E and mod rewrite.
And then you restart Apache.
Oh, now it's asking me to authenticate.
All right, fine.
It's probably because I didn't use sudo.
Okay, so that's done.
So let's refresh this.
Okay, that looks much better.
I want to use subdomain, so because I've got the wildcard set up, that should work.
So let's leave that at that.
So I can take sides, that's all fine.
Let's go install.
Okay, that seems to work fine.
So now it's saying in the config we need to add all of this.
Above the line reading, that's all, stop, blah, blah, blah.
So let's edit the config.
I think I can go page down here.
Yeah, there we go.
So now multisite true.
Let's include that.
Multisite true subdomain has all of that.
Perfect.
Okay.
Want that to be updated, then add this to your access, HD access file.
Now, I didn't set up permalinks.
I wonder if I could do that now.
I should have done that before I did this blast.
Let me see if I can enable permalinks now.
Okay, maybe I can't.
Okay, we'll just pop this in the HD access.
So I'm going to go nano, HD access.
Now it doesn't exist.
That's fine.
Paste that all over there.
I'm going to be cheeky here.
I'm going to check what a default HD access looks like.
So this is a local site that I-- oh, it's not working.
Last.
Okay, should be fine.
I should have done the-- should have done the rewrite rules before I did this.
But anyway, it's fine.
I'll just save that and then go back here.
You'll be logging again.
So let's log in again.
It was--
This one and this password, which I'm not showing you.
Let's log in.
Okay, that's good.
All right, it was saved to day name, so that's fine.
So that's all working.
And there we go.
Now we have a multi-site and we can create different sites.
I'm going to create a new site.
I'm going to call it Bob.
Bob's site.
And let's just bar that psychrotech.
In case you're wondering, I've got a casual setup, so any emails that go to that thing will work.
And that site should now be created.
So if I visit the dashboard of that site, there's my barbed psychrotech.
And just to-- okay, that-- why is that not working?
Hmm, interesting.
That should work.
I bet you it's got something to do with Apache configuration.
Probably got something to do with the virtual host.
So this is where I'm going to take a break because I need to remember there's something I think I did to make this work.
I'm trying to see if it might be to do with htaccess.
I'm trying to see if the site works.
Yeah, you see the site is pointing to--
So I think what this is is I haven't got wildcard setup for the psychrotech domain, so I'm going to have to fix that as well.
So this is actually going to take longer than I thought it would.
So what I'm going to do is I'm going to take a break there,
and I'm going to go and do some research because I've forgotten how that even works.
And I'm going to do this process over because I want to figure out why that MySQL thing went weird.
And I want to remember how to fix the multi-site stuff.
I think it's got to do with the Apache virtual host.
Let me see.
Is there something in here about that?
Might rewrite support for HTS--
Options for the symlinks, that's right.
Options for the symlinks.
So that is--
Maybe I can fix this options for the symlinks already enabled, or at least not permanently disabled.
Make sure you have "Allow/Override All" options, all for the vhost.
Yes, yes, yes, yes.
Okay.
So--
I think it's all of this.
[Music]
I wonder if there's a quick answer on the internet.
Apache virtual host WordPress multi-site.
Let's see if I can get this working.
Ah, "Digital Ocean." There we go.
There we go. There we go. Here we go. Here we go.
This is what we need.
So let me copy this out and paste this in the chat.
Options for the symlinks, "Allow/Override All/ Require All" granted.
Okay. Let's go back and fix that.
So, "Sudo Nano / ETC Apache 2 sites available."
"Cycroturk.conf."
And then it's going to be in here.
I really am pedantic about lining up my configuration files.
I don't know why.
It's something I do.
So, "Options for the symlinks. Allow/Override All/ Require All" granted.
Let's fix this for this domain.
"P
S Y K R O D K."
All right.
And then we're going to have to restart Apache.
Hopefully I've got that somewhere in--
There we go.
Oh, wait.
"Sudo restart."
That shouldn't require a password because I think I've already logged in as the Sudo user.
There we go.
All right. Let's see if that worked.
No.
This might be my brave browser.
That's not working.
That's super annoying.
"Rewrite engine."
Oh, it's the rewrite engine stuff probably.
But that's in there.
Did we put that in there?
Yeah, that's already there.
I've done something wrong, I think.
"Configuring marker cell domain. Configuring version of spec methods. We'll talk about each."
"Definitely done this using just an Apache virtual host."
But I think I've got the virtual host configuring correctly.
"Rewrite engine on rewrite condition server name."
I'm going to have to do a bit of research here.
So it should be working.
There's something in the Apache configuration that I haven't configured correctly.
So I'm going to call this here.
We've got 10 minutes left.
I'm not going to fix this in 10 minutes.
So I'm going to call this here.
And I'm going to try and see if I can figure this out after the fact.
I did have this working at some point in the past,
and I can't remember now what that configuration is.
So I'm going to have to do a little bit of research on that one.
It definitely is possible.
"Options file as some links. Allow rewrite all. Options all."
Let's just have a look here.
"Now options file as some links. Allow run to options all."
I should see if options all is part of it.
Allow is not natural or not over at all.
I'm pretty sure I've done it with these.
I'm going to try these.
See if it makes a difference.
[typing sounds]
I'm feeling this has got to do with the newer version of Apache
because I've gotten this working using, I'm pretty sure, these settings.
So I'm going to try this and see if it makes a difference.
Let's try it.
No, it doesn't like that.
Something to do with the configuration file I've messed up.
So maybe a little bit of research would have been a good idea.
It's a problem with the live streams. I don't plan anything.
So something has gone wrong somewhere.
It's not pointing in the right direction.
Something in the v-host that I need to configure properly.
One more thing.
[typing sounds]
This works. I'm going to be annoyed.
Don't think it will, though.
[typing sounds]
Let's see.
[typing sounds]
Okay, that's funny. Sorry, would you have to agree? That's funny.
So I just hadn't set up the wildcard server alias in the vhost config.
That is hilarious. So now, does that mean that these are all going to work as well?
Let's see.
That is the funniest thing. I wonder if it even needs any of this.
I feel so stupid right now.
Let me come into all of these out and see what happens.
[typing sounds]
Let's restart the server.
Yep. That was literally it.
I didn't need those extra configuration files.
They were obviously already enabled on the Apache 2 server.
So it was literally just the fact that I had not set the server alias correctly.
I should have just set it to the wildcard. So there we go.
So I didn't need any of this stuff here.
That is the funniest thing it really is.
[laughs]
Fun, fun, fun. Let's delete all of these.
There we go.
Done. We have a WordPress server.
And that's it. That was setting up a WordPress multi-side subdomain method using Apache.
We had some trouble with the MySQL server, which I'm still not sure about.
But that is the way that I set up these things.
I'm going to destroy the server after this livestream.
So if you want to try and hack it, it's not going to be around for much longer.
But there we go. That's the process. That's what I use.
So I definitely use the DigitalOcean documentation a lot.
I use the WPCLite stuff a lot.
So all the commands that I ran all there, if you want to check those out.
And then the WordPress multi-side installation is very useful as well.
Okay. It is two minutes, four minutes to the hour.
I'm going to end that there. That was the Apache edition of this.
I hope that the Nginx edition goes a lot smoother.
I'm definitely going to do some research about that MySQL thing.
I'm going to turn the server off now. It's going to go away.
And then I'll delete it after this, and then we'll do a new one next time.
So next time will probably be in about three to four weeks' time.
We'll do the Nginx version of this.
I hope this was enjoyable, at least in some way or interesting.
You enjoyed me fumbling around and trying to figure it out.
But yeah, that's my bit for today. Cool.
Thank you, everybody, for your attention and for joining me on this journey.
And I will see you the next time I livestream. Bye.
[MUSIC]