Episode: 820
Title: HPR0820: Setting up a web server and a mySQL server
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0820/hpr0820.mp3
Transcribed: 2025-10-08 03:01:44

---

This is HackerPublicRadio, my name is Clad 2 and this is the Networking Basics mini-series
Part 8.
In this episode we're going to set up a web server and we're going to do it internally
because all of the already we've set up a gateway server.
So we've got the internet going into that and going out to all of our clients on the
network.
We've got set up a DHCP server to actually give IP addresses to all of those clients so
that they can get to each other and get out to the internet and stuff that they've asked
for on the internet and get back to them.
And then the episode after that, which was this past episode, most immediate past episode
in the series, we set up a DNS server with the fine Mara DNS server, DNS server software
and we also mentioned DNS mask with a queue which apparently is sort of an easier version
of all that that uses the slash Etsy slash host file to sort of emulate DNS server
itude and resolve domain names to IP addresses and so on.
So in this episode we're going to just dive right into web server installation which
honestly after at this point it's just going to be really simple, you're not even going
to know what to do with yourself because it's basically practically one step but of course
we'll make it a little bit more interesting just because we can.
But yeah, the server, the typical web server install is something like yum install Apache
or something like that.
That's pretty much it.
App to get install Apache 2 and then literally, quite literally, if you go to one of your
client machines that you've got set up and you type in the address of that server which
since we have internal DNS running we can just do slacker media dot local and suddenly
you'll see the old it works greeting.
So on devian it's a it works page and it's white with black text and it says it works.
On Fedora you get a fancy it really works page with lots of text and like explanatory
like here's why you're seeing this page.
Don't panic this is normal, you know and you got the little Apache logo so it's that
simple.
It's done, it works where to find it.
Almost invariably you will find the slash where you will find the folder that contains
the stuff that people see when they go on to your website which of course really is just
a folder on your computer, right?
Well it's not in your home directory by default it's in slash a var because you want people
in your home directory slash www and if you look around in there by default at least on
my red hat install there's a CGI dash bin there's an error folder there's an HTML folder
and then there's an icons folder got no clue what's in the icons folder but if we go
into the HTML folder of course we'll see the default stuff in there which right now
is nothing.
In fact I believe that it gets forwarded by default to use usr slash share slash, I
don't know, usr slash local slash share slash httpd I think something like that and the
point being that too full that until you put stuff into that HTML folder all you're going
to see is a it works thing but that is where you want to put stuff slash slash www slash
html and the other thing is that the generic name of the Apache or the web server Damon
is httpd so on red hat you don't service start you don't service Apache to start you service
httpd start and that starts your web server now you can go to your website on a browser
I guess I kind of skipped over that step on Debian it would be slash Etsy slash init dot
d slash Apache to start so it's not called httpd the name of the Damon is Apache to on Debian
and the users that Apache runs as are different on red hat systems versus Debian I think on
Debian it's like wwwdashdata or something whereas on red hat it's Apache I think so that's
usually quite honestly that's about all there is on slack where it's slash Etsy slash rc dot
d slash rc dot httpd start and that starts the the http server there's not a whole lot more to it
if you've ever been on a website and you know how to make stuff appear then you're ready to go
you just see the end of slash slash www slash html and you can start making all the files that you
want now realistically you might want to assign like a specific user to to be your web dev user so
that all the stuff in there is being kind of managed by that one user you might not it really depends
on how you want to do it I had I I made a group called the the design group and that's the what all
the web developers all of them are members of that group and so when they sign in they all have
permission to change all this stuff in slash of our slash www slash html that is also where you'd
put premade things like droople like a droople install or a wiki media or a tiki tiki wiki tiki
wiki site whatever you know you dump it into your slash slash www slash html on red hat
and and then when you go to slackermedy.local in your web browser or 192.168.8.1 port 80 of course
then that's that's where you're going to to see everything now of course you can do a lot more
than just that and one of the things that you can do is since we have that DNS server going on
we can make different domains exist on the same box and one of those places or the place to do
that would be the slash of our folder and in slash of our slash www you can make folders that are
the different sites that you want to exist on the web server now you can't just make the folders
and have them be different sites that's not quite how it works that is something that you have to
set in the a pattern in the web server that you're running and of course it is important to note
since I nearly misspoke about it anyway that you can have different web servers running
or I mean you can use a different web server I'm using Apache because that's the big one that I
heard about and I just kind of figured well that's a good place to start but there are some really
cool alternatives out there like engine X and lighty PD that you should check out you know and try
try running those see if they're better or easier or faster you know whatever whatever you want
now Apache is kind of nice because it's kind of one of those everyone's going to support Apache right
I mean you you're not going to find that you made a mistake by configuring Apache you know you're
going to find pretty much that everyone every prebuilt site out there like WordPress and Drupal
and all the wikis and whatever you might want to install in this thing they're going to have a
Apache support out of the box so it's kind of the safe bet in that sense but at the same time it
is kind of I guess in a way I don't want to say it's the easy way but I mean it's it is the the
one that it's the most obvious one so the the place that you'd want to configure
where all the domains live and kind of what's called virtual hosting will actually differ from
Debian to Red Hat shouldn't really surprise you but it will in Red Hat it is in slash Etsy slash
httpd slash cunt slash http dot cunt I just put them down to the bottom of the
at the bottom of the file because that's where their little demo or their sample text was
and and the syntax is the same as Red Hat and Debian Debian actually does this really nicely
and they they split it up into sites that are enabled in sites that are actually or sites that
are available in sites that are actually enabled it's it's really quite nice actually read up a
little bit on that if you want because it's um to me that's kind of the way that I think maybe
everyone should do it it's really quite nice um but anyway in the Red Hat config at slash Etsy
slash whatever I said httpd slash httpd cunt I think they're down at the bottom there's a commented
outline that says use name based virtual hosting and under that it says name virtual host space
asterisk port 80 that simply says that um that that Apache is going to be aware if you
uncomment that line that configuration line that Apache is going to be aware that there are
more than one site living on this box and that they're virtual sites they're their virtual websites
because traditionally speaking I guess a website was a server but Apache came along and and maybe
displaced that notion with these virtual hosts so their virtual hosts uh it's just pretty simple
syntax for what I do it's and obviously you can find more complex configurations online but
it's just virtual host well uh less than symbol virtual host camel cased with a capital v in an
h space asterisk colon 80 greater than symbol uh next line server name again camel cased
with a capital S and in space www.slackermedia.local next line document root camel cased capital D
in a capital R space slash var slash www slash html slash www.publicsource.local
and then the next line you close the virtual host so it's it's a little bit you know xml so you do
less than slash virtual host camel cased greater than and that closes that that block so you duplicate
that block as many times as you want pointing each server name to a different directory within
your um within your within your server it's it's done the same way on debian it's just a different
file and then you can place the configurations for each of those websites in either server enabled
or I mean yeah site enabled or site available and you can move that file from one to the other to
turn the site on or off it's it's really really neat and and quite effective um I've not really
done anything too fancy on red hat so far in terms of of having multiple sites on on one main box
but it it is something that uh Apache apparently you know it does really well so I don't know how other
web servers handle that I'm sure they do I just don't know how but that is how you do it um I don't
know if we started the server yet I think we did right so it would be slash well it would be
service httpd start on on red hat or it would be um slash etsy slash in it dot d Apache 2 start
on on debian and if you would just change a setting you would want to usually restart that service
you wouldn't want to restart your computer obviously you just do service httpd restart or etsy
in it d uh Apache 2 restart and that will restart a lot of times if you're restarting a service
and it fails to restart it means that you've done some typo in the configuration file that you've
just changed and you need to go back and it's probably you know a misplaced greater than symbol or
a forgotten semicolon or whatever so the I guess some of the really common associated services that
people find themselves installing with with Apache for instance would be for instance my SQL server
my SQL server is a lot like in terms of simplicity and configuration and stuff I equate it in my
mind to ssh because you simply install you know you do an app to get install my sql dash server
and it grabs all the associated packages with a my sql database installation that will then
serve databases to various things including your own Apache server the reason I'm mentioning this
what one reason is because it's hugely famous I mean the lamp stack it's Linux Apache
MySQL and PHP so if you're doing this this is like a very common kind of activity and of course I
mean any any kind of internal site that you're going to install like Drupal or WordPress or whatever
they're going to require my SQL install or they're going to want something similar like a postgres
or something like that or MariaDB if you want to stay away from my sql so whatever you can get a
hold of database server that's a pretty simple install you would again just remember to start the
service which I typically in real life I remember to do it I just keep forgetting to mention it
on the show but you do the slash atc slash rcd or init d rather on devian init dot d slash my sql
d start or on red hat would be service my sql d start whatever so what that gives you is a running
idling my sql server that you can then do cool stuff with like my sql admin you know create
you some users or a user and then create a database table and then marry that database table to your
Drupal install or your WordPress install or your copper mine photo gallery install you know whatever
you're doing with that server that little local install you can you'll have my sql running on
local host so if you ever configured one of these through a web host company they usually have their
my sql servers running on some other box you know somewhere else in their data center or whatever
and so you're usually putting in on your Drupal configuration when you're going through that you're
putting in some random string of numbers and letters and then it's you know that's some other
server and then there's your user name and your password and the database name and the database
user and the database password all that other stuff same deal here except that it's not going to
be some weird database on some other server it's going to be the database running on that very
server so it's local host it's really nice it's very simple to set up and don't forget your
my sql password obviously there are lots of other kinds of servers that you can set up at this point
I mean right now what you have got is a server that is the the the center of your local network so
you can do all kinds of cool stuff you can either install more stuff onto that box if it's nice
and powerful and you feel really confident about performance or you can set up another box next
to it and put you know like a jabber jabber D server on that and an MPD server and you can just
run all kinds of cool services on these things point at it from your DNS records and and assign it
a DHC an static IP address with DHCP and suddenly you've got people chatting on your own internal
fully encrypted jabber service while writing wiki interviews on your internal wiki while listening
to music via your MPD server and it's just really cool it's it's amazing stuff so if you haven't
done this before and you have if you haven't been following along frantically with with all of
these episodes um you should you should do that you should set one up if you can possibly swing
that I mean I know it requires really to to to work the way that I'm describing it it does require
saw hardware with you know multiple network cards and and a switch and and all these other things
but you know that's it's kind of worth it if you can get a hold of all that stuff
and even if you can't you might as well try it with you know either two laptops to so to whatever
degree you can or you could try it with um with a laptop you know with one network card being the
ethernet cable and the the one that distributes out the information your wireless card or you could
try it with with virtual machines as well I've never tried it with virtual machines so I can't really
advise you on that what I can advise you on is the the role of routers in in this whole setup that
you've got so I don't know about you I don't have switches lying around um really well now I
actually do I lied but but back before I got a job where there were switches involved I didn't
have switches just lying around I had like a little router from Best Buy or whatever um and it
wasn't actually from Best Buy but you get the idea it was like one of those little cheap plastic
routers and that's kind of what I used and and that was that and that that little router actually
was the gateway server and it was the DHCP server I think some of the fans of your routers kind of
have a little tiny DNS server in there I I don't really remember I remember doing a lot of Etsy
host stuff so maybe the routers didn't but I bet you can find some with that feature um but the
the thing about the router now is that it might be handy but you you want to turn off a lot of
those features because if you think about what it wants to do it wants to do all the things that
you've just set up so if you if you set up a gateway and you set up DHCP you and and all that stuff
not you know network address translation the whole nine yards you've got running now on your
computer you don't need the little plastic router that you got from eBay to try to manage all
of that for you you actually don't want it to do that because then you're gonna have all kinds
of interesting network problems that you know everything thinks something else is a different
server or it's going through one router only to get to another router essentially so it's a lot of
wasted traffic there so make sure that if you're using a router kind of dumb it down so that it's
more like just a switch more or less it or basically a true router that you know it doesn't actually
serve DHCP it's a feature that it does that it really is like when you need your router to just
work and and magically propagate all these IP addresses for you stuff like that it's a feature
but in this case since we've kind of overridden that it would it would become a little bit of a
bother so I hope that this these three episodes in the networking basics series have been
informative um I will have more I'm sure at a later date but this is about as much as I've got
for you right now so I hope you enjoy them and I hope that you have fun playing around with servers
and uh good luck with them
you have been listening to Hacker Public Radio or Tacker Public Radio does our
we are a community podcast network the release of shows every weekday on day through friday
today's show like all our shows was contributed by an HBR listener like yourself
if you ever consider recording a podcast then visit our website to find out how easy it really is
Hacker Public Radio was founded by the digital dog pound and new phenomenon computer club
HBR is funded by the binary revolution at binref.com
all binref projects are proudly sponsored by linear pages from shared hosting to custom private
clouds go to lunarpages.com for all your hosting needs unless otherwise stasis today's show is
released on the creative commons attribution share a live video's own license
