the hey there everybody how are you
i hope you're doing well so my
name is boris and today we're going
to go over how we can have
our own madama incense i'm sure
we have heard a lot of positive
things about it during my summer camp
and so i want to host a
workshop on how everyone kinds sold their
own motto making sense now when we
want to have a moto mod incense
up and running the first thing we
will need will be
b to have a computer to run
it
so we'll also go over where you
can find different providers and i'll try
to make it as easy to follow
but in case anybody has questions during
the workshop please feel free to write
in the chat and i'll do my
best to explain everything to so but
before we dive into madama first i
would like to introduce myself so as
a mention my name is boris i
am based in albania which is located
in europe and i have been contributing
to different open source projects for around
six years now
i am a member of the local
hackerspace often up cyberspace and i also
am part of cloud succeed doubts he'll
wear what we do is we maintain
of different open source instances like matomo
for example where we not only install
them but
we make sure that our backups monitoring
for the health of the service and
provide support
so i think that's a pretty good
beginning introduction about myself so without further
ado i would like to getting to
how you can have your own muttering
sense so for the guide i have
estimated that armento my incense shall be
able
two handler around the hon one hundred
thousand visits and that is based off
the official documentation from them but on
my website of course as you scale
up you might need a different set
up to accommodate for all the traffic
that are going to be having so
as i was meant
running first thing we're gonna need is
a computer or more specifically what we
need is a server that way when
somebody goes to the u r l
for our mcdonald's site they will be
able to see the website and there
are a couple of different providers one
of the first things you need to
keep in mind
is if you're doing a set up
similar to what we're going to do
we need to be aware of where
most of your user visits are going
to beef from because the closer the
server is to your users the faster
it will load if i am in
europe and i try to access a
a server for example in asia it
might be much slower to load compared
to a server that's in german
so one of the providers i highly
recommend usually had snare they offer dedicated
servers but they also offer reassure private
servers and the differences that explain very
briefly is that with a vps or
a virtual
private server essentially get a small chunk
of a physical machine and you can
install whatever you want on it it
has it's own operating system and it's
quite easy to add more hardware to
it whereas compared with a dedicated server
you have a lot more hardware and
computing power allocated
to it but it does require more
maintenance because you have to look out
for stuff like a hard drive failures
or ram corruption and you have to
constantly monitored
so in head snare the virtual private
server section they call it had snared
cloud and they have free good beginning
prices so for a in the sense
of about one hundred thousand users something
like the cx eleven tier which has
one cp
new core and two gigabytes of ram
is a good start and if you
essentially use all of that computing power
you can just upgrade to the next
plan and downgrade later on down the
line
another popular provider is digital ocean the
good thing about digital ocean is that
it has a lot more data centers
compared to a head sooner so petzner
only has data centers in europe and
yesterday or the day before that they
launched a new dataset
tour in the us but digital ocean
has data centers in a couple of
us cities in europe as well as
in asia so if you're outside of
europe i would highly recommend checking out
digital ocean another popular provider is also
the node which is free
fairly similar to digital ocean you can
of course use amazon web services and
google cloud platform i personally don't use
them because i don't agree with essentially
their ethics and google amazon and other
big tech companies have been known
to not be the most privacy respecting
companies out there so i tried to
stay away from them but of course
you are free to cost them wherever
you want
okay so in preparation for today's workshop
i have already created a server on
had snare and the domain for that
i am going to pace it in
the chat really quickly will be montana
test dot cloud succeed ducks yell if
you go to that to rl you
will
will not see anything load and that's
because nothing has been set up yet
so give me a bit of time
to share my screen and i think
you shall be able to see it
now let me just make it bigger
so that you can see if the
screen
size of the font size is too
small please let me know and i'll
increase it okay so first thing you're
going to want to do is to
connect to that server and for that
we use ssh so this is a
command that lets you connect to the
server as root which is
as a user that can perform and
execute all the commands on the server
which will be very helpful during installation
but it's usually recommended to not run
commands as root so now we are
inside the server and you can see
that because
here it says earth at mcdonalds test
whereas before it was saying boris at
whatever my computer name is
okay first thing you do after connecting
to a new server will be to
make sure that it's up to date
with the latest version because packages come
out all the time so new software
comes out all the time and since
this computer will be publicly accessed we
want to make sure it's up to
date so
so that it's more secure so this
is running ubuntu eighteen and to update
the packages we have to run two
commands the first one will be a
p t update and this essentially just
refreshes the list of new software but
it doesn't actually
the install them so if we let
it finish real quick there we go
it says that three packages can be
upgraded and to upgrade them what we
have to do is we will have
to run abt upgrade in this case
so let's just confirm that we indeed
want to update
okay there we go so now what
we have to do is we are
going to have to install some other
software's to make sure that you know
if you go to that you are
out that i shared in the chat
matomo shows up and your browser knows
how to interact with isp
computer so the different components that we
need installed are mainly a web server
where it is a programming sole on
the server so that your browser knows
how to talk to it we'll need
a database so this is where matomo
will store all the data that it
collects and four
this guide will be using something called
my sequel you of course you are
free to use whatever you want as
long as the programming is compatible with
it and the last thing we're going
to need to install will be the
ph be
software's into the server so montgomery's retiring
page p and for that reason we
need to make sure that the server
itself can around this program and then
serve that on your browser
okay so chain install the web server
it's really really easy using the abt
command from before we're going to tell
you to install and then we're going
to say the name of the program
that we want to install in the
case of the web server were going
to be using something called engine x
enough
very popular option is a patsy too
but there are a couple more you
might want to diving into at your
own leisure
and other than nc next we are
also being changed soul my sql server
so this is the web server and
this is the database server that's just
around that really quickly
now wind comes to peach pie insulation
you can use different versions of bhp
my domain itself recommends using page p
seven point two or up for this
guide we'll be using peach pies seven
point four so
so the problem then becomes that page
b seven point four is not available
by default icing in ubuntu eighteen point
of four so we have to add
something called a repository which is like
a list of other packages or other
programs that you
can install on your computer that are
not available by default so to do
that what we first have to run
is this command which install some it's
essentially the a p t command again
but it installed some background applications needed
to follow the other steps
and we can save this case because
it didn't say installing anything new it
was already present in my installation ok
now we are going to run another
command which is add abt repository so
essentially add a new list of possible
programs that you can install
lol and then the repository that we're
going to be installing is andre slash
bhp so if you press enter on
that it will warn us
the things that we need to keep
in mind off and then it'll ask
us to press enter to find a
team so we're going to do that
and here you can see that it's
updating the list of programs so these
are what it had by default and
then you can see here what we
just added
okay now we can run the steps
to install hp seven plane fall so
let's go ahead and do that
i am going to be installing a
version of the page piece of one
point or cold f pm so let's
press enter on that
and let's just give it a little
bit of time to configure everything
okay so now we are pretty much
almost ready to continue with a month
domain installation but bhp in ubuntu eighteen
comes with what are called modules so
these are optional software is that trains
so on
your computer and they provide more functions
to hp if you had over to
the matomo user installation guide so let
me get that ink and a setting
that chat really quickly
so in here you will see that
their recommendation is saying so a bunch
of packages i have written them down
beforehand and what we're going to do
is we're going to install them but
we want to make sure that we
installed the same version for them
the module as we did for ph
pi when we initially insulted here so
i said seven point four and i
have to make sure that in here
it also says seven point four so
let's go ahead and press enter on
that
the
and let's give it a bit of
time there we go now we are
ready to download the matomo code from
matomo website so let me re share
my screen really quickly
and i think it's
this fun yeah
okay so let's open that in and
blurry view while we're going try and
do is we're going to want to
go to the download montano section and
we can see that the latest release
is version four point five planes zero
and we're going to want to right
click this button
over here and we're going to want
to copy the link
now let's jump back into the server
so let me share my screen one
more time
okay and let's make it a bit
easier to read by removing all of
these things if you also want clear
screen in case you're following along you
can type clear and once press enter
it will
essentially free up your views so that
it's easier to read what's going on
okay first we're going to want to
download the u r l we just
copied so to do that in ubuntu
you can use curl or you can
use something called w got i personally
prefer wk so let's go with that
and the syntax for that will be
w got and the u r l
that we just copied
so once we press enter we can
see that it has downloaded it we
can verify this by running another command
called el asked which is something like
list structure we can see here that
montana doubts it does indeed exist in
my current directory so
you can see that it's a dog
zip file so it's an archive and
it has a bunch of folders inside
watch where you're going try and do
is we're going to want to unpack
that so first let's create a directory
called matomo
in two greater directory i use the
command called m k dear then a
space and then the name of the
directory i want to create then we're
going to type mv which moves a
file or a folder to another location
and we're going to move my tom
and outset to
the mob tama folder
though if you run out as one
more time we can see that now
we have this folder and inside that
folder we have a zip file that
we downloaded ok then we are going
to want to enter that folder and
all the comments that are going to
be executing now will take place from
they're so to change the directory you
have to use a command called cd
and then after the space has entered
the directory that you want to go
in saying that case cd optoma and
we are going to want to unzip
this so we say unsaid and then
the file name
moto amount of zip and we can
see it sprinting out a bunch of
stuff though if you run ls we
will see thursday how chainsaw mcdormand dot
html very similar to a folder and
then there's the moto m on top
zip file that we downloaded
now for the next tap water revenge
one i do is we are going
to want to move this moto mods
folder that we just extracted and we're
going to want to move that to
a place where our web server so
no place where the programming our computer
which make sure that the cycle
notes from the browser has the option
of reading those photos so to do
that let's use the mv command again
and say month to month and the
place where we want to move this
and you put is slash bar slash
www
so they says a the full directory
that is created when we install our
web server so if we go over
there now
we will see that we have html
and mcdonnell and if we go to
let me share my screen again
but essentially if we go to r
u r l so that is matamata
thought cloud six ltl we will see
a welcome change the next page which
to me doesn't look a lot like
the software were wandering soul but the
good thing is we can change that
so too
do let that let's jump back into
our terminal window where we are typing
the commands and first a free run
ls so the same command to show
the structure but this time we add
a dash al it will show us
a bit
more information on the contents of the
slash bar slash www folder and what
you're going to want to do is
that for them onto my user currently
its owner is the root user which
is the user i am logged in
as but it's generally
recommended that you change the permissions of
this folder so to change the permission
exactly to change the one area we
have to type eight to one and
then we're going to type a option
which says done changed the owner of
just this folder but changed the owner
of all folders and files inside this
folder so
that is dash our capital r and
then we defined the user that we
are going to grant ownership of this
folder to so in the case of
engine acts on you go to this
user is called w w w dashed
data and then we'd have to do
do the same thing but this time
what we are defining here is the
group so we essentially sat an owner
which is a user on our system
and a group that have ownership to
this folder so let's go ahead and
complete the command by specify
buying the directory that we want which
is matomo and press enter now for
the neck next step we're going to
want to change the configuration of our
web server so to do that we
are going to be using a text
editor i'm sure a lot of people
have strong opinions about which
text editor you should use in my
opinion you showed just use a text
editor that you know how to use
and can easily navigate around so in
my case i use nano and the
file we are going to want to
add it is located inside the geeky
se folder
which is where most of the configuration
for different softwares is located in phoenix
and we're going to say engine acts
and we can see that there are
a bunch of files and folders here
but the one we're interested in is
types enable so let's go ahead and
type that and
here we can see that there is
a file called the forward so let's
go ahead and since that
i will admit just for a minute
for the ambulance to drive by
okay no it must be a bit
easier to hear and so i have
i am going to cheat a little
bit i am going to be using
a nancy next template which i had
already prepared beforehand but you can find
pretty much the same configuration online
and i'm going to want to change
a couple of things so before i
change slammed let me first explain what
were you doing when you visit a
website and you go to http what
essentially you say is hey i want
to access this server but think of
the server
as a building share you might want
to enter a building but you have
to choose a door in which you
enter from and in computers we use
port to describe this behavior so you
want to specify a port for that
luckily for us or one luckily depends
in how we
look at it some ports are standards
so for http we use sport achy
and four https so that's why the
site has a green lock next to
it and says that the site is
secure for your sport four four three
where not quite ready for four four
four three so let's change the configuration
of it by essentially commenting out some
of these functions but we can uncommon
them later to common then we just
use this icon in front of
what pre one to common so let's
go ahead and do that for a
few lines here what we're doing mostly
is where removing the ssl configuration so
we're removing the https config
now this is not permanent because it's
highly recommended that you do run https
on your site because you don't only
protect your own systems but most importantly
you protect your users and then we're
going to want to change this option
right here
it's actually located in two different places
called inventory haas name and this is
a template for the automating tool that
we use at cloud sixty eight but
what we're going to want to type
instead of that will be that you
are out for our website so long
the same atomic test thought clouds succeed
to seal and confirm everything
okay another thing we are going to
want to have to change is the
page b version because this template uses
version seven point two of bhp which
you can see here whereas read insult
beach before so let's make that change
as well and we are now
essentially ready to save the file so
in nano to save a file you
are going to
ah
yeah i'd date commend the server section
so in nz next the way you
define teams is you define server blocks
and in there you enter configuration as
you can see here we have two
server blocks and the reason for that
is we have one that listens on
port eighty
and only does it just redirects you
to https and we have another one
for https now i haven't commented this
section here and that is so that
we are essentially just using a single
server running on port eighty which will
be
serving them up to my website was
for going chunk common that later on
so let's
there we go so let's go ahead
and save by typing control and then
oh it will ask us where to
save lead to say that the default
file we opened and then we're going
to want to close the editor so
for that we type control and then
x
now we can go ahead and restart
our web server but it's usually recommended
we test if the syntax for what
pre-tested is correct so to do that
we are going to type and tenax
and then space dashti the cells and
tenax hey can you test my current
configure
ration and make sure i haven't forgotten
semicolon somewhere or forgotten to close a
server block
so we can see that the configuration
file is syntax is ok and we
are now ready to restart our program
to do this in ubuntu ubuntu uses
a system called system d so to
restart our web server are
application with without restarting our entire server
which is a bit ineffective we have
to type system fifty out then the
operation that we want to perform claim
this case restart and then the name
of the program you want to restart
so there we go and if
free refresh our site now let me
just change my screen
we now see a new page which
is the motto my installation wizard and
the spades in my opinion is really
really cool because first thing it does
is it performs a system check and
it sees a
if what you have is all correct
and if there is anything you need
to change so we can see the
hp emerging is find all of these
extensions and configurations are fine and then
there are some optional such suggestions so
you can see force ssl connection when
we're not using ssl
and that's a problem it also gives
us a bunch of information now i
do want to continue to the next
step which is database setup but when
we go to database setup we can
see that we are going to have
to enter a username a password a
name for a database so it's probably
good
how to configure https before we move
on
okay now to configure https you usually
have to have a as something called
an ssl certificate and ssl certificates there
are a couple of different ways to
get them you can buy one which
lasts for a year or you can
use let's encrypt let me me it
really quickly
as for the ambulance to go by
so as i was saying you can
also use something called let's encrypt which
gives you a free certificate available for
ninety days so we're going to say
that our website is running and xanax
and we're going to use ubuntu eighteen
http
four it will show us some commands
that we can run those commands first
we have to install something called snap
t which allows us to install other
packets not available by bbt
and let me just copy this amend
beforehand this command essentially refreshes the list
of available programs for snap doing so
it's very similar to abt update that
we performed
and then we've gone around snap install
third bolts so this is a program
developed by the electronic frontier foundation which
essentially makes it very very easy for
you to get a let's encrypt certificate
and authenticate yourself
self and then be able to use
it last thing we're gonna do is
run this command which i can't go
into details about what he does to
to due to time constrain but it
makes it possible for us around sirte
bought in our system and for you
to respond to us so let's cancel
this
to get the ssl certificate we're going
to round third bought cert only so
only give us have the certificate don't
do anything else sorry to some and
then dash dash and sonax which is
the web server we have installed are
going to want to type a email
address to get
security notices and renew william co for
now let's just use no reply at
cloud succeeded as ceo
do you need to agree to their
terms of service and if you want
you can sign up for their newsletter
after you do all that it will
ask you what names you will want
the certificate for so it has already
gotten month-to-month desk from an end to
next configuration so that just press enter
and sag bulk will do everything that's
needed for us we won't have to
date care off verifying who he
we are very fine that we have
access to this i mean we're yelling
so now he can head back to
art enter next configuration and uncommon everything
that had commented so in here we
define the location for certificate and these
are some other
configuration options just to increase general security
on the site so let's go ahead
and say we around to max dashti
again to verify everything is running correctly
and we restart our web server again
now if we go back to our
site let me close my screen sherry
so i can show you my browser
we can see that now this website
is running on https and we are
now ready to do our database configuration
though to your database configuration we are
going to have to talk to our
database server which is sold in the
same server we were using
let's go there and let me share
this
okay so we're going to want to
type my sql to talk to the
server and we can see that the
view has changed a bit first we're
going to stay create database matomo you
can name this anything you want then
we're dying to say create user map
the only user
local falls so great that user in
this system
identified by i might be confusing it
a bit with another syntax for another
database server but let's use a really
really bad password for now and next
we're going to run grant all privileges
on matomo so grand
all accesses isn't much i want the
database to the user
okay so everything's done now we can
now close that and go back to
the web page we were reviewing before
and for logging we're going to say
matomo
user for the password the password to
be defined and the database name and
we're going to click on next
there we go so my domo has
successfully talked to the database and created
the structure needed for us to continue
now we create a super user so
this is our username for the administrative
account let me generate a
a quick password for this
there we go and we're going to
want to type our email address
and we can click on the configurations
options that we want and click next
and we can see that database access
denied so what i'm assuming is happening
here is somebody might have done this
configuration before we have so let's go
ahead and check the logs really quickly
and to give me a little bit
but oh i can see that my
screenshot is not working let me check
really quickly what's going on
lucky me just a second
okay
so i just read the configuration again
apologies for announcing but i was essentially
just going over to the website again
and now we can set up a
website that we want to monitor so
let's say cloud succeed dots field which
is located at the crl
we select a time zone for our
website so let's try to find tirana
or
begun to say you dc plus one
we click on next
and it will now give us the
madama javascript code which we can add
to our website and start having analytics
and that a spray much it we
now have a beginning insulation of matomo
there are a couple of things we
can further do we can add a
geo data
base that will show us you know
we can see that there is a
database upgrade required so to do that
let's copy this command and run that
on our server
and i can see that you're not
seeing my terminals let's change that
there you go
now it's generally a bad idea to
do this without backups but this is
a testing sense so i guess you
only live once in this case but
please don't just execute commands on a
production system without making sure you have
good backups
and that's the permission
and that's upgrade my tama
that may change my screen again
and everything i mean
let me take my password again
and there you go you now have
a month domain since running as i
was saying there are more things to
configure your incense you have to set
up automatic backups gap just set up
monitoring to make sure the incense is
healthy you do have to set up
something
called cron cron jobs retard essentially background
jobs that
perform different operations on the data and
make sure that your instance loads quicker
because it doesn't have to compute everything
at the same time it can just
show you the data it has processed
ahead of time i want to show
you a few configurations really quickly that
are
r
just to optimize things since if we
have time if not please feel free
to stop me but essentially we can
see here that it it says we
shall set forth ssl to one in
the general section of our configuration of
matomo and we need to increase the
map
packet eating our sql database to at
least sixty four megabytes though there are
different in configuration and tweaks that you
can do to your incense to make
it behave more responsive so in case
there are any questions please feel free
to let
me now now's the time and i'll
look forward to answering them
though melanie asks how often showed the
archive cronjob a beast scheduled for every
hour or something else it really depends
in how much data you have really
i usually i set a config
duration where it rounds once every day
but this is for insulations that track
one hundred visits a day max you
can set this to run more often
something like an hour might be a
good idea if the traffic are getting
is around one hundred thousand vis
visits
because that's essentially going to process all
the data and when matomo has to
calculate all of that when you load
the page it's quite intensive for it
no problem
marianne sorry if i'm mispronouncing your name
asks any reason for using nc max
to be honest there's no strong reason
why you should use and xanax or
apache two in my opinion they are
optimized for different loads yes but the
main criteria you have to keep in
mind is you have to use a
software that are comfortable for
in my case i really like and
syntax syntax it's really easy for me
to read so that's what i use
but you can use any web server
there is on the planet as long
as you can configure a trap
and it seems like my pronunciation was
correct so eight
and lucas is sharing in the chat
if you are using nt max you
might want to look into this link
which is a github repository let me
open that between shares of the week
and take a look at it together
there we go
logan thank you for sharing this i
did not share it beforehand so we
can see that the matomo organization on
gate hub has a nc next configuration
from a demo so i would highly
recommend checking this out to have ascent
surely the same configuration that i copied
over from our template you can find
that one in here and this is
frequently updated so you might want to
check into it bland there are new
versions of the moto mom coming up
awesome
okay so lucas is sharing that the
reasoning is that the ht access file
so these are some files that configure
a part of how the web server
operates and they're usually used when you
use apache to ucas points out that
these f
files won't work in nc next which
is correct because it's an apache two
only setup so those configurations won't work
and and tenax and they have had
to write the config rules manually and
it's very very important for you to
copy the correct config because otherwise ceremony
to sense might not be protected some
files in them up domain since may
not be protected and that's not a
very good idea if you're muslim insulation
is public
so if i share my screen again
one such configuration for example is this
one and it says disable access to
the following directories config campy core and
link and it says deny all requests
to this location
ems and show up for three error
code yup i think you should really
use this config because if somebody can
access your configuration folder remotely then it's
pretty much game over so you want
to protect
that
is there any other question that you
want answered of course you can ask
me at any time even later on
my username almost everywhere is this one
i am also in the mavericks chat
where you can find me with this
user
name instead
awesome it looks like we have answered
all questions so thank you again everyone
for joining and i hope you have
fun during my summer camp and we'll
see around