Build an Awesome Nextcloud Server (For Ubuntu 20.04)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] you know i love nexcloud that's probably why i create so many videos about it it's just a very awesome piece of software but it's not always very straightforward when it comes to how to install it now i've done many videos on nexcloud and this video in particular is not all new but i wanted to update it because the last video that i made about nexcloud about setting up nexcloud is getting to be about a year old and enough has changed to where i feel like it's time to update this tutorial now if you already have an xcloud server that you set up with my previous video then there's nothing to see here we're not going to be doing anything you know incredibly different but it is going to be an updated look at installing next cloud and not just installing next cloud i'll be showing you a bunch of other things as well i'll have time codes down below that you can use to get right to the section that interests you and by the end of this video you will have your very own next cloud server set up and ready to go now before we get into that though i want to take a moment to mention the sponsor for today's video lenode the node is a cloud server provider and not just any cloud server provider they are a linux based cloud server provider which means you can get your very own linux server through their platform they have linux server plans starting at just five dollars a month which is very affordable and if you don't already have an account on the node you could create a new account by using the url that you see on the screen right now by following that link you will actually get access to a hundred dollars in free credit towards your new account and like i mentioned they have instances that start at just five dollars a month so there's a whole lot of linux that you could fit within that credit their dashboard is very easy to use and it's fast and their entire platform is even faster now because they've recently launched nvme based block storage devices which is just so cool in addition to linux servers you can manage dns set up containers block storage object storage or check out their marketplace because there's all kinds of pre-made apps that you can benefit from right there in the marketplace and even if you're not feeling particularly creative when it comes to what to use your lynnode account for one thing you could do is create your very own linux server that you can use to follow along with any of the tutorials on this particular channel definitely check them out they've been a sponsor for this channel for quite a while now and i really appreciate it thanks yet again to lenode for their support and their continued support of learn linux tv i really appreciate it now let's get started with nexcloud i'm very excited because by the end of this video we're going to have our very own next cloud server set up and ready to go it's going to be awesome but in order to install next cloud we need a linux instance to install it onto so what i'm going to do in this section is create an ubuntu server 2004 instance here on lenode now on your end lenode is not required for this tutorial it's just what i'm going to be using for my examples all you really need is an ubuntu server installation specifically ubuntu server 2004 it's possible these commands might work with a different version of ubuntu but i've only tested these commands with ubuntu server 2004 so that's what i'm going with anyway in this section like i mentioned i'll be creating an ubuntu server instance here on lenode so if you stick around that's what i'm assuming you'd like to do or maybe you just want to see what the process looks like but if you already have an instance then you can skip this section and move on to the next now as a quick aside we have the marketplace right here and that's not what we're going to be using but i just want to show you guys that next cloud is actually available on the marketplace on lenode and you can use that there's nothing wrong with that it's actually pretty cool it automates the entire process but i'm a fan of actually setting it up myself not because i like to do things the hard way but i think it's better when it comes to learning to understand all the components that goes into an installation of an application and by doing it manually we're going to get a firsthand look at how to do this and it's not complicated as long as you know what the steps are and thankfully i do i'm able to show you guys the steps so we're going to be setting it up manually i just wanted to point this out because i'm assuming i'd probably get a comment asking me why i wasn't using the marketplace because it's faster and the answer is because i'm a big fan of manual setups they're just a lot more fun so anyway i'll go over here to lenodes and i will create a new linode instance and like i mentioned i'm going to be choosing ubuntu server 2004 when it comes to the region you can select whichever one you'd like i'm going to go with this one right here canada is pretty awesome i think they're relatively close and that's basically what you're trying to do is just find a data center that's close to you you can scroll through this list right here and just see if any of these are closer to your geographic area and whichever that might be you choose that option and we'll move on in this section right here we're going to choose the plan for our lenode instance and we really want to choose something with at least two gigabytes of ram preferably four but you might not need four we could go with two the dedicated cpu plans these ones are going to be a little bit more expensive probably not what we'd like to go with right now you can always change the plan later to save some money though what i'm going to do is go to shared cpu and 2 gigabytes of ram like i mentioned is the recommended minimum so you could go with this one and that would be fine you get 1 cpu core and 2 gigs of ram but on my end i'm actually going to choose this instance right here because we get 80 gigabytes of storage four gigs of ram and two cpu cores which is going to work a lot better for nexcloud again two gigabytes is the minimum so if you want to save some money you could just go with that one i'm going to be deleting this instance as soon as i'm done creating this tutorial i already have an xcloud server i just want to show you guys how to do it so i don't mind keeping a four gig instance around just to have a better experience for the label this is essentially the name of your lenode instance you can name it whatever you'd like maybe you'll call it next cloud because that's what we're setting up today but what i'm going to do instead is actually give it a label that matches the domain that i plan on giving the instance that's not required if you're using a domain it really doesn't matter what you call it you can name this potato if you'd like it doesn't have to match anything but i like to keep things consistent and i will be using a domain so i'll just add that right here for tags i'm going to leave that blank that is something that you could fill in if you want to give your instance some sort of tags tag suggest identifier is basically a name value pair and you could create whatever tags you'd like to create for example maybe have a production tag or maybe a development tag depending on how far along it is again i'll leave it blank it's really up to you if you want to use tags and what you want to call them tags can be used basically to further label your instances for the root password i'll go ahead and type that in and this password in particular is going to be the password we will use to log into our instance so make sure you remember it and if you have an ssh key like i do as you see here you can go ahead and check this box that'll make sure that your ssh key is able to log into the instance i'm not going to choose that though you can go ahead and do that if you'd like continuing you can set up backups i highly recommend that you set up backups for your next cloud instance you'll get a backup every single day which is really great because if something happens to your next cloud instance you could revert it back to the previous day which is always useful especially if you're doing some sort of maintenance or something like that it is an additional cost five dollars more a month for this particular plan get the total cost per month right here and again i went a little high on this instance type i didn't need to choose a four gig instance i would have been fine with two gigs so the price would have been a little bit lower private ip i'm going to leave that blank and let's go ahead and create a linux instance so right now the instance is booting up actually it's provisioning and any moment now it's going to change to booting so what i'm going to do is open up the list console right here and as soon as it starts booting up we should see the process right here in this window right so now it's booting up and as you can see here we have a login screen so what i'll do is just type in root for the username and then the password that we gave it during the setup process which i don't think i typed correctly let's try that again and there we go we're logged in to our lenode instance right now that's pretty cool now you can actually use the lish console for all the commands that i'm going to give you i prefer ssh that's just the way i like to do it if you don't have an ssh client for example you could just use this window lish console is fine but if you do have access to ssh i do think that's better highly recommended so what i'll do right now is just log out i'll type exit close this window right here we'll copy this ip address and i already have a terminal open right here as you can see so i could type ssh root at i'll paste in the ip there it is let's see if it works so i will say yes to confirm that i do want to continue connecting to this server type in the password and we're in again ssh is optional but recommended now we're going to come back to this in just a moment but what i want to do right now is take a quick detour and talk about domains and dns so we have this ip address right here and this particular ip address goes directly to this lenode instance and that means that this ip address is routable from the public internet but i don't know about you i probably won't remember that ip address it would be a lot better if i was to go ahead and add a domain instead and i'm going to do that right now because dns takes a little bit of time to propagate so i figure before we actually get the next cloud instance built we may as well set up dns early so that way maybe by the time we get to that point it'll already be propagated so i'll copy the ip address which i think i've already done so right here we actually have a feature for domains built right into the node so if you do have a domain name you can actually add it here to lenode so that way lenode could be the name server for your domain and then it makes it that much easier for you to set up a domain for your instance if you don't already have a domain name you just go over here to hover hover is actually my favorite place to buy domains they're not a sponsor or anything like that maybe i should actually reach out to them and ask them to be because i've been using them for so many years but as of the time i'm recording this video they are not a sponsor it's just what i use so if you don't already have a domain name then what you could do right here is just type in a domain that you would like to have if it's available and it'll let you know if it's available i just randomly typed mynextcloudserver.com that's not what i'm going to use and it is available so i guess if somebody is watching this you might want to score this domain as 13.99 if you like it i don't want to pressure anyone into buying anything but you don't need a domain it's not required i highly recommend you get one though because it just makes the process that much easier there's going to be a few things we'll set up that does require a domain but most of what we're doing today will not now what i'm going to do is switch over to a different lenode account this is just my demo hence the name right here my actual domain is on a different lenod account altogether and what i want to do is grab the ip address right here and then create an a record for the domain to point to this ip so what i'm going to do is open up a private window i don't want to lose my currently node session and i'm going to go back to cloud.lenode.com and log into my actual lenode account so what i'm going to do is go to domains right here and i have the domain learnlinux.cloud which is what i'm going to choose for this particular tutorial so what we'll need to do is create an a record and inside the a record we'll paste in the ip address so i'll paste that in right here and that's the ip address for the lenode instance that we'll be using for nextcloud and for the hostname i'm going to call it nexcloud just like that so my domain is learnlinux.cloud the subdomain is going to be nextcloud so the entire thing is going to be nextcloud.learnlinux.cloud now on your end if you are going to create a domain like i'm doing right here then what you'll need to do is just update the dns records for your domain so if you're using hover you would log in there update it there if you've imported your domain into lenode you could create the a record there like i'm doing right now you just basically do this wherever your dns server is you create an a record you paste in the ip address for your lenode instance and then you give it a subdomain which is how i like to do it and then i'll click save and this is going to take some time to propagate so what i'll do is just go ahead and put this aside for now put that right there and we have a domain the first thing i'm going to do is create a user for myself i'm logged in as root right now and that's really not something that we should be doing it's okay to log in as root at first but the root account is very important we want to lock that down but in order for us to lock it down we need to have another user account to use instead so what i'm going to do is type add user and then the username that i would like to use so in my case i'll add the user j i'll set a password for the user and i'll type it in again and here we could type in some additional information for our user i just skip all these fields but you could definitely fill them in if you'd like to especially if you're going to have multiple users using the system but i'm just going to leave it blank i'll just hit enter enter again enter enter enter so now it's just asking me to confirm that the information is correct y is capital which means if i press enter without typing y or n it's just going to assume yes so i'll press enter and now we have a user the next thing we want to do is make sure that user has access to sudo so first of all we'll type witch and then sudo and that helps us make sure that sudo is actually installed which it is now more than likely you should have that installed already so there shouldn't be anything that you'll need to do next what we'll do is make sure that our new user has access to sudo because installing the package isn't good enough we need to allow the user to use sudo and in the case of ubuntu server what we're going to do is type user mode dash lowercase a uppercase g so we want to add a user to a group and the group that we want to add a user to is sudo and the user that we want to add to that group is the one that we've just created so now if i type groups and then the username you can see that that user is now a member of the sudo group let's log out i'll just type exit we're back to our local command shell and if you're using the lish console you can just log in but in the case of ssh i'm going to remove root and replace it with the user that i just created type in the super secret password preferably correctly and we're in now the next thing that we're going to do is update all the packages on the server because every time we're setting up a new linux server we always want to start with the latest and greatest packages they include security updates so they're very important now that i'm logged in as my local user i don't actually have root privileges by default but sudo will give me that so what i could do is actually run sudo apt update and this will update the repository index so i'll press enter type in the password yet again so we have 89 packages that can be upgraded that's quite a few so let's take care of that the first command just updated the package repository index and the command that i'm about to give you will help you actually install the updates so the command sudo apt dist hyphen upgrade will install all available updates now here we can see that we have 89 packages that are going to be upgraded you have 42 security updates so this is very important so press enter to accept the default since y is capital and now we have all the updates installed that's really cool the next command you probably won't need this one is just probably a good idea considering how many packages needed to be updated and what i'm referring to is removing any orphan packages or anything like that very unlikely but what we're going to do is just run sudo apt auto remove and i didn't expect that it was going to find anything it's just a good idea to clean that every now and then but anyway we're good to go on that now we will need to reboot our server since we did install security updates but before we do that though i want to give the server a name right now the server is called localhost and that's fine i guess but what i like to do is give the server a name that identifies what it actually is so to do that i will type sudo nano that's the text editor that i'll be using quite often in this video i'm a big fan of vim but nano is easier to explain anyway the file that i want to edit is slash etsy slash hostname just like that and here we have the actual host name which we knew was localhost we saw it in the prompt and what we're going to do is give it a name like i mentioned that identifies the server and if you don't have a domain you can just call it next cloud if you'd like maybe you just call it nc short for next cloud you can name it potato pizza whatever you'd like it's just a name that you would use to identify the server there's no actual meaning to the name but if you do have a domain then i recommend you type the domain name for your instance right here and make that match this is only important if you do have a domain if you don't you could just simplify it down to next cloud or whatever you'd like to name it but since i will be using a domain for this instance i'm going to be typing the fully qualified domain name which means the entire domain name right here in this file and this is going to be the only thing that we're going to add to this file so ctrl o that brings up the save dialog enter to save it ctrl x to exit out and then the next file that we need to edit is slash etsy slash hosts on the second line here we have localhost if you recall that's actually the original name but we don't want to remove that we'll leave that one alone and right after that we'll create a new entry so the ip address is going to be different by just one this is another loopback address i'm going to tab all the way over here and then what you do is you give it the same name that you gave it in slash etsy slash hostname so if you called it nextcloud for example that's what you type right here if you do have a domain then you could type that right here just like that and then space and then what you do after the space is type just the hostname without the domain part so that way we could refer to localhost as localhost nextcloud.learnlinux.cloud or simply nextcloud so that's how i like to set up mine so go ahead and pause the screen if you want to jot this down there's also going to be a list of commands in the official article for this video the blog post will be linked down below in the description so if you'd like to copy and paste the commands you can get the commands from that article anyway ctrl o and then enter to save it control x to exit out so we updated this system we created a non-root user account and we gave the server a name as well so that was a lot of changes so what we should do right now is reboot the server and to do that i'll go up here we have the instance right there i'm going to click reboot you can also type reboot and press enter from the command line but i often find it easier if you're using lenode to just do it through the dashboard it actually does seem to reboot faster when you do that but it's not that long anyway in just a few minutes the system will be back up and running so we see it's rebooting so what we could do if we want to follow along with the process we can open the lish console and we'll wait for it to start back up all right so starting up should be ready any second now notice right here that it says next cloud login that's the host name right here the host name that we set earlier that's the shorter version of the hostname and right here it shows the fully qualified domain name and this is just a local naming scheme but we're going to test the domain right now and see whether or not it's actually available and it would be really cool if it is so let's find out so here i have my terminal and this is the terminal here on my local laptop it's very important because if you do this from the server you'll get different results what i want to do is type nslookup and then after that i'll type the domain for the next cloud server and actually it looks like mine has already been updated it's very possible that when you go to use ns lookup depending on how much time has passed you might not actually get a result dns sometimes takes a really long time to propagate i'm really lucky because it just happened to be very fast for me most often it usually happens within 30 minutes in my experience but i have seen some that take overnight it's just the way it is but at least in my case i could tell that it is set up and ready to go because the ip address here for this domain is in fact the ip address for the lenode instance and to prove that here i have the ssh command that i used to log into the instance as my local user but what i'm going to do instead is type nextcloud.learnlinux.cloud and it did recognize it it didn't give me an error message or anything like that so i'll say yes and then i'll type in my password and we're good to go you can even see right here in the bash prompt it says next cloud so it took the new name or fully up to date and that's really cool the next thing that i want to do is actually make a change to the ssh config file i want to disallow root login that's really important i have another video on my channel that goes over securing ssh just check that video out if you'd like but i'm going to be doing one of the tweaks in this video if you want to do the rest you can watch the other one what i want to do is type sudo nano slash etsy slash ssh slash sshd underscore config type in my password press enter and scroll down we're looking for the root login option permit root login yes we're going to set this to no and you should only do this if you've already created your local user account if you didn't do that well you're actually stopping your ability to log in via ssh if root is all you have so this is for after you've already created your local account which we've done so i'll save the file and then we'll restart ssh sudo systemctl restart sshd so now we've disallowed root login that's pretty cool all right so the next thing that we're going to do right now is download next cloud itself and we'll need to use a web browser for that or at least to get started anyway so i'll switch up here let me close this so i'll just type nextcloud.com into the browser now they actually change the website every now and then but what you're looking for is a place to download next cloud or git next cloud here's a button for that right here so we're going to hover over that and click server packages again the verbage might change but we just want to download it now we have a download button right here but i'm not going to click on it what i'm going to do instead is right click on it and we're going to copy the link and then i'll go back down here to the terminal we need to see if wget is installed in my case it actually is if you don't get any output when you type which w get that means it's not installed and if it's not you can run sudo apt install wget that'll make sure that you have wget on your system but obviously i don't need to do that because i already have it so i'll type w get and then what i'll do is paste in the url that i copied earlier and there it is so the url will probably change they release new versions all the time but as of the time i'm recording this video we're up to version 23.0.0 we have the version number right here so it could be on 24 or higher or maybe a point release doesn't really matter you just need to download the latest version and since we copied this link directly from the site this is going to give us exactly what we're looking for so now as you can see we have next cloud downloaded it's a zip file so we're going to leave that alone for now we will be needing that shortly but i just want to make sure we have it on our file system and as you can see we do so i'll put that aside and we'll move on to the next step now the next thing we're going to do is set up the database server for next cloud we definitely want to make sure we have that ready to go when we need it so first we'll install a special package that will give us access to a my sql server specifically mariadb so what i'll do is type sudo apt update which i've already done recently so there probably wasn't any need to do that again so soon but it's not a bad idea to make sure the index is up to date anyway next what we're going to do is type sudo apt install and the package that we want to install is mariadb hyphen server that'll give us the server component and there's going to be a number of other dependencies that will come along for the ride that's fine i'll press enter to accept the default of yes and that'll download mariadb and get it installed for us next what we're going to do is type systemctl status mariadb we want to see if there's actually any issues if it started properly there shouldn't be any issues if this is a fresh server but as you can see it's active running so we're good if for some reason it was not you could just change this to start and that'll get that taken care of another thing that you look for is whether or not it's enabled my font size is way too big so it's hard to see i'll just go to the right it says enabled right here if your show is disabled then what you'll need to do is change the keyword right here to enable and that'll make sure that the mariadb database server actually starts up with your server automatically so that way you won't have to log in and start it on your own so we have the database server installed next what we're going to do is change the default settings we have a special command for that here on ubuntu server we're going to run sudo mysql even though it's mariadb the command that we're using right now still refers to it as my sql it's okay my sequel underscore secure underscore installation now it's asking me to type in the current root password and it's not asking for the root user password the one that we created with our lenode instance or whatever your instance happens to be it wants the current password for the database server itself and we haven't set that yet so we'll press enter we'll leave that blank because the password is actually blank right now and now it's asking us if we would like to actually set the root password which would be a great idea so i'll press enter and now we need to set the root password for the mysql root user what i recommend you do is create a randomly generated password and save it in a very very safe place i'm going to type the password by hand in my case because this is just a tutorial but on your end i highly recommend a long randomly generated password because it would be a very bad thing if somebody was able to log into your mysql instance you definitely don't want that so just make sure you generate a very secure password and i'll type it again and now we have the root password set the next thing it wants to know is if we would like it to remove anonymous users that's a good idea i'll just press enter for yes because that is the default disallow root login remotely absolutely i'll press enter to accept the default for that as well we definitely want to make sure that we say yes to this we definitely want to disallow root login remotely very good idea remove the test database and access to it we'll be creating our own database we don't need the test database so i'll press enter for that as well reload privilege tables yes and now we have some relatively sane defaults for mariadb maybe not the most secure defaults but this is the least you should do when it comes to configuring the security it's just a good idea to run the mysql secure installation which is what we've done and now that's ready to go now the next thing that we're going to do is create the actual database we set up a database server but we need a database for next cloud so to log into the mariadb server i'm going to type sudo mariadb and that bypasses the password and everything but only users that have access to sudo will be able to do this so there's no security concern it's just a quick way to get to a prompt and we have the maria db prompt right here so what we want to do is actually create the database so what i'll do is type create database in all caps create database is an instruction we'll leave that in uppercase it's very common to uppercase instructions in the mysql syntax which is what mariadb uses and then we'll name the database nextcloud that could be in lowercase that's the name of the database it's not an instruction it's a variable basically we want to call the database nextcloud we will end the instruction with a semicolon which i you know still forget to this day over 20 years later so if you ever forget the semicolon don't feel bad it happens to all of us anyway i'll press enter it says query okay let's make sure that the database is truly there we'll type show and then databases semicolon and as you can see we do indeed have a next cloud database right there it's an empty database there's nothing inside right now we'll be changing that later but next we'll need to create some permissions to allow the next cloud application to access the database server and we do that by creating a grant we're granting permission and we're doing that by creating a user abstraction in mysql and what we'll do is type grant we want to grant everything we want to grant all privileges and we want to grant those privileges on the next cloud database we'll type dot star at the end to make sure that this is a recursive change to every part of the database we're going to grant those privileges to a user named nextcloud so that's our database user and that user is going to be present here on the local server we don't want this user to have actual remote login privileges instead we're going to restrict it to localhost that's more secure and then identified by and then you type a password in the quotes right here and what i recommend you do is generate a randomly generated password it's always a good idea you want to make sure that it's very very very secure but since i'm just using a test instance right here it doesn't really matter in my case since i will be deleting this i'll just use the password next cloud is awesome with the first letter of every word uppercase exclamation mark at the end so on your end just generate a random password to make it secure again this is just a demo so that's why i'm being a little lacks on that so i'll press enter it says query ok and then we'll enter flush privileges it'll make sure that all the privileges are refreshed since we did actually create a grant and that's it we're done with the database that's all there was to it let's exit out of here and we'll move on to the next step now the next thing we're going to do is set up the web server component i'm going to be using apache in my case you can use nginx that's beyond the scope of this video that's another popular solution that will provide you a web server next cloud needs a web server so that it can be well served so to do that what we're going to do is type sudo apt install and there's a ton of packages here so what i'll do is just paste in the list you can pause the video if you want to jot this down or just go to the article that i linked in the description down below but you'll have all the commands in there if you want to copy and paste so i'll just paste these in and then we'll go ahead and get started so there i've pasted in the list of packages but if you're ready to move on i'll press enter and this command will lead to the installation of quite a few packages because it's not just the web server that's being installed here it's also php and related php packages as well it's beyond the scope of this video for me to go over the purpose of every single package here but these are the ones you need so i'll press enter and now we have those packages installed next what we should do is check the status of the apache web server make sure it's running didn't have any errors or anything like that so we can type systemctl status apache 2 and the apache 2 package should have came along for the ride when we installed the other packages it should have been installed as a dependency so i'll press enter and as you can see apache is installed and it is running it says active so that's pretty cool if for some reason that command failed just make sure that you actually enter in all of the packages that i listed and if checking the status still failed then you can run sudo apt install apache 2 just like that which will make sure that apache is actually installed on your server now next what we're going to do is enable some php modules that are required some of these might already be enabled and that's fine we just want to make sure so what we're going to do is type sudo php nmod short for enable module we want to enable bc math gmp image magic which is actually abbreviated and intl so there you go i was able to enable those particular php modules i wasn't expecting any special output as long as we don't see any errors we should be fine now as a quick aside if we switch back to the browser here copy the ip address in a different tab we paste that in we'll have the default apache start page already ready to go so technically our web server is actually set up we still have to set up next cloud but what this proves is that our instance is available i typed in the ip address and it does show the apache 2 default page but what we should also be able to do is type in the domain name as well if you have one and it should take you to the exact same place we don't have a secure connection just yet that's okay we'll fix that but so far everything is working and on your end you should be able to access the apache 2 default page by either the ip address or a domain if you have one so as you can see here so far so good next what we're going to do is type which on zip we want to make sure that we have unzip installed here on our server and in my case i don't if i did i would have had some output from that command so i'll run sudo apt install and then unzip just like that and that was pretty fast what we're going to do right now is actually prepare the next cloud files for installation if you recall we downloaded this zip file right here earlier in the video so what i'm going to do is unzip that and it's going to explode in a bunch of files that's okay and as you can see we have the next cloud directory right here that came from the zip file so we actually don't need the zip file anymore so what i'm going to do is use the rm command to get rid of it so the only thing remaining is this folder right here and if i check the permissions though i am the owner of this next cloud directory but that's not what we want instead we want to make the web server user the owner of this directory because the web server is the one that's going to be serving it so the web server needs full control so to fix that what we're going to do is type sudo ch own dash capital r we want this to be a recursive change everything underneath next cloud and the user is going to be www hyphen data and then the group is also going to be the same and the folder that we want to make that change to is the next cloud directory and as you can see the next cloud directory is now owned by the www data user and group so far so good now what i like to do is name the next cloud folder or the you know app folder after the domain that i plan on using on your end you can just leave it as next cloud if you don't have a domain but what i'm going to do is move that and i will need to use sudo now that i actually change the ownership to a different user so we'll move it and what i'll do is move it to nextcloud.learnlinux.cloud in my case because that's my domain that's not required i just like to keep everything consistent and now that's done now currently the next cloud directory that we've just renamed is in my home directory here and i don't like that because we're not going to be serving next cloud from our home directory instead what we're going to do is serve it from slash var www so what i'm going to do is run sudo mv for move we want to move the next cloud directory that we've downloaded and extracted and changed the ownership on to its final location in the file system so we're going to move that folder and we're going to move it into slash var slash www it's cut off here on the side with a slash var www so as you can see we have the next cloud directory underneath slash var www and then next what we're going to do is disable the default site for apache we don't really need it it's just there to make sure that apache is working we did see the test page so we have no more use of it so what i'm going to do is type sudo a2 disk site and type three zeros and then tab it should autocomplete because the config file is where this command expects to find it that's a default config file we didn't create it it just comes along for the ride this is what gives us that default apache start page that we no longer need so by running the a2 disk site command we are disabling that particular virtual host we just don't need it so let's get rid of it now it's telling us that we need to run systemctl reload apache 2. we're not going to do that quite yet we will be restarting apache later and that'll automatically take care of that anyway so next what we'll do is set up a config file for apache for serving next cloud so what we'll do is type sudo nano and the file is going to be under etsy slash apache2 sites hyphen available and the name of the file i'm going to make exactly the same as the hostname or domain you don't have to do that but again i'm a big fan of consistency and this also helps you keep track of multiple sites because if you name the config file after the domain it just becomes that much easier to keep track of so anyway nextcloud.learnlinux.cloud just change this to whatever yours happens to be we want the file to end with an extension of conf it's a config file so that's what we're creating that's what we'll name it and this is an empty file so what i'm going to do is paste in the contents right here and then i'll explain it and here it is now you can actually find the contents of this file that i'm using in the official blog post for this video so what you want to do is grab that content paste it in right here and there's actually several things that you'll need to change so for example we have the document root you want to make sure that you actually have everything named exactly to what it actually is so i highly doubt you're using this name right here you just use whatever name you'd like or whatever your domain happens to be and you want to make that consistent throughout so we have it here we have it here we have it here as well and if we scroll down we have it a couple more times so as you can see there's various places where you'll need to update that so just make sure that you use the correct name right there that matches what it actually is and once you've done that we'll save the file control o enter and then control x and we have that config file so what we could do now is enable the site and the way we'll do that is we'll type sudo a2 and site next cloud dot learn linux dot cloud so we'll type sudo a2 and site and then whatever file name you decided to go with you don't have to type the path to it just the name of the file and this is mine here so i'll press enter and here's telling me that i need to reload apache in order to make this change take effect but we're not going to do that quite yet there's a few other things that we will need to do before we actually go ahead and restart apache so the next order of business for us is to configure php so what we're going to do is type sudo nano slash etsy slash php and then slash 7.4 that's the php version if that version ever changes you'll need to change that here as well but in ubuntu server 2004 at least it should always be 7.4 apache 2 and then php.ini this is the config file for php we want to be very careful with this but there's a number of changes that we need to make and the way that i like to do this is search for the string that i want to change because this file is massive so we can hold ctrl and press w that opens up a search box and the first thing that we want to search for is memory underscore limit and right now the memory limit is set to 128 megabytes let's crank this up to 512. and then the next one we want to find is going to be upload underscore max and that should be enough to type we shouldn't have to type the entire thing upload max file size that is what i was looking for we're going to bump this up all the way to 200 megabytes next up we have max execution time we're going to set that to 360. we'll search again this time for post max post max file size i'm going to set that to 200 megabytes and then next we're going to search for date dot time zone and that's going to be commented out we'll remove the semicolon in front and then at the end what we're going to do is choose our time zone and i will have some information in the blog article a link that'll get you a list of time zones that you could type in in case yours isn't the same as mine but mine is going to be america detroit that's going to be good enough again just check that link if yours is not america detroit if you're somewhere else in the world you just type the correct one for you check the link if you don't know what that is already next we'll look for op cache specifically whether or not it's enabled and it is but we'll uncomment that control w again app cache dot interned and this is the one we want is set to eight and that's actually correct so search for the next one op cash dot max which is the next one over i probably should have looked at that it's set to ten thousand that is correct we'll uncomment that next appcache.memory which was right here on the same page yet again opcash memory consumption that's what i was looking for we'll uncomment that and we'll leave it at 128 op cash dot save underscore comments there it is set that to 1 which it already was i just uncommented that one and the last one app cache we should be able to type just reveal so there it is so what we're going to do is just change that to one and that should be everything that we needed to do for the php configuration so control o and then enter control x to exit out and after this what we're going to do is enable some additional apache modules and to do that we'll type sudo a2 and mod we want to enable dur dir env headers mime rewrite and ssl and it's okay if they show that they're already enabled you just want to run that command to make sure that they are indeed enabled now that that's done we can actually restart apache the commands that we've run so far have asked us to reload it to restart it and we've been ignoring that because we had additional configuration changes to make now that we're done with that we can run sudo systemctl restart apache 2. and let's make sure that nothing exploded if anything failed we should have received an error message but just in case we'll check the status and it is running so far so good and now here's where things get especially exciting because we have most of the configuration done there's some other things that we have to do but if we go up here we still have the default page which actually no longer exists because we disabled this but i didn't refresh the page sends but if i do refresh the page we should see the next cloud configuration page come up and there it is how cool is that so what we need to do right now is set up our next cloud instance and the first thing is asking us to do is to create an admin account we'll give it a name i just named mine my first name easy enough and then we'll type in a password the data folder we're going to leave that alone and scroll all the way down to the database section the database user basically the grant that we created we named it next cloud and the password that i decided to use was next cloud is awesome with an exclamation mark hopefully you used a randomly generated password and obviously you shouldn't tell your password to everyone out there in the open but since this server is going to be deleted i don't really care so i'll type in the password database name we named it next cloud and the database server is located here on localhost we also have a box here that shows the verbiage install recommended apps i recommend that so we'll click finish setup and as long as i didn't type in anything incorrectly we should have our very own next cloud server all set and ready to go actually won't be all set quite yet it will be working we have a few more changes to make i'll just click finish setup and check this out next cloud is running we did it there's still some additional changes that we should make like i mentioned but this is a really good sign next cloud technically is working now what i don't really like about this though is that we don't have a secure connection to this particular app so what we should do right now is install let's encrypt and what that'll allow us to do is actually get a certificate to secure our connection it's a very good idea it doesn't cost anything and to do that what we're going to do is go to another website and that website is going to be certbot dot eff dot org slash instructions now the reason why i'm pointing you guys to the instructions here is because this process might change over time it probably won't but it's a good idea to get the instructions directly from the source so what we do right here is we just drop this down we choose apache because that is the web server that we're going with and then on system what we're going to do is scroll all the way down here to ubuntu 20. now it's actually a pet peeve of mine when people call ubuntu 2004 ubuntu 20. there's two different versions of ubuntu 20 so this is very misleading they're talking about ubuntu 2004 though so i'll click on that and if you scroll down you'll start to see some information right here so it's asking us to ssh into the server we need to make sure that snapd is installed so do we have snapd installed let's check we do not so what we're going to do is copy this command right here paste it in we'll clear the screen next what we're going to do is install certbot itself so we'll paste that command right here and if for some reason the commands are different on their instructions just go along with whatever their recommended instructions are on that site just in case it changes later and now we have certbot installed so i'm just basically running all the commands that they recommend that one was pretty easy and we'll run this command right here to actually install the certificate i'll paste that in we'll press enter so what it wants us to do right now is type an email address which is a very good idea if there's any issues with a certificate for example if it's trying to renew and it can't it'll send you a message ideally it should actually automatically renew the cert but again if it has any trouble it needs to be able to reach out and let you know so that's why i recommend that you actually type a real email address right here so i'm going to type in mine will agree so i'll just type y for yes i'm going to say no this is just asking if you want to be on their mailing list i don't personally want to be on their mailing list so i'll say no by typing n i'll press enter it's asking me which domain i'd like to use and it automatically detected the domain right here because i have that configuration already made so i'll type one and then enter and according to this it looks like it's ready let's see i shouldn't need this page right here let's go ahead and refresh and check that out you can see that our connection is now secure we can see that the certificate is verified by let's encrypt so we have the information right here that's pretty cool so now we've taken care of that so i'm just going to click right here and we're going to check one more thing and what we need to do is look and see what complaints next cloud has about our installation and even if you followed everything perfectly up to now you'll actually have some complaints and i did this on purpose because i want you guys to check this for yourself just in case there's something else so i've purposely omitted a few steps earlier that would have made this go away so what you'll do is click up here where your name is click on settings let me just blow this up a little bit and under administration click on overview and we have some warnings here now i'm going to show you how to take care of these particular errors the thing is though you might have different ones on your end all you should really have to do is just google the error message and you should get the solution but i'm going to take care of these right now so back in our terminal what we're going to do first is correct the permissions of the config file we don't want anyone to be able to read it and that's not actually related to any of the errors that we just saw it's just something that would be a good idea to do so what i'm going to do then is run sudo chmod we're going to set the permissions to 660. i have an entire video about permissions if you want to find out how exactly that works and what we want to do is type slash var www and then whatever you named your installation folder there's mine and then underneath the config directory we have config.php for setting the permission such that world doesn't have read access to the config file we definitely don't want that next what we're going to do is run sudo ch own we're going to make root the owner of that particular file and the group wwe data will also own that file it's going to be the same path var www app directory config config.php and there we go now to fix a couple of those errors what we're going to do is run sudo nano we're going to edit that same file rw app folder config folder config file and i need to make the font size a little lower here it's way too big what we're going to do is go to the very end of the file we'll go to the end of the last line right here we'll make sure that we're lined up exactly and since i'm lazy what i'm going to do right now is paste the option that we want to add we're going to be adding an option memcache.local this will take care of one of the errors that we saw in the admin section but we should also take care of another one in addition to that so what i'll do is paste in that option as well and what i added was the default phone region that was another error that it was complaining about and i set that equal to the two-digit country code for me which is us just change it to whatever yours happens to be if it's something different now what we'll do is save the file and then exit out so the next thing we'll do is get rid of another one of the errors which was referring to image magic and svg support and all we need to do for that is install another package and here it is i just pasted in the package name so press enter enter again and it actually should clear quite a few of the warnings or errors that it showed in the admin section so let's find out let's go back up here and what i'll do is just click somewhere else and then we'll go back to overview and now we have only one warning about our setup let's see if we can fix this one too so we'll go back down here to the terminal let's try to solve this we'll edit the virtual host file that we configured earlier so sudo nano etsy apache 2 sites available and then our config file and the file name is going to be a little bit different you should have one that has ssl in the name similar to this so what i'm going to do is actually scroll down just a little bit here and what i'll do is paste in the new option which you can get from the blog article along with everything else and i just pasted it in right there and i'll make it a bit smaller so you guys can actually see what i've done this right here is the line that i've just added so pause the video if you need to check the blog article if you need to just make sure that this line is right here it increases the security of our site so it's very important i'll save the file exit out and then next what we'll do is restart apache i'll check the status make sure that everything is good and so far so good let's go back to our site and we'll just go to another section i probably could have refreshed it but anyway let's see what happens all checks passed so in my case i was able to get rid of every single error that shows up here which is definitely a good thing to do if you have any errors here that were not solved with what we've done then what you could do is just copy and paste the error message i normally don't tell people to google things but just in case there's something i haven't seen before you could copy the error message then in google type next cloud paste the error message and you should probably find exactly what you're looking for to help you clear that message another thing to know is that by default we are on the stable channel if you wanted to check out something else you can actually change this to enterprise or beta i'm going to leave mine on stable enterprise actually receives slower updates so if you're using this for a company for example that might actually be a better idea but i'm going to leave it unstable beta is for those of you that just like to test new features so if you want to help the next cloud project out if you find any bugs while using beta you can report those bugs but for everybody else i recommend keeping it on stable before i close out the video what i would like to do right now is show you guys how to set up office integration within next cloud and this will enable online document editing which is just so cool and it's really easy to set up as well there's only two plugins that we'll have to install and then we're good to go so what we're going to do is go up here and click on our little user icon we're going to go down to apps and there's all kinds of applications or add-ons that you can install within next cloud that'll give it additional capabilities but again what i'm going to focus on right now is setting up office integration the first add-on that we're going to install is called the community document server so to find it we can simply type document here in the search box and here it is so i'll click on it and then i'll click download and enable so we'll give this a moment to download and enable and then we'll move on to the next step now the community document server is all set and ready to go now the next thing we're going to do is install only office so i'll search for that and there it is right there so i'm just going to click download and enable and it looks like it's already done that's pretty quick so let's go over here to files and test this out to make sure that it's working and what i'll do is just click into documents right here i'll click the plus icon and i'll click new document and i'm not going to worry about giving it a name i just want to test that this works so click on the arrow and check this out we have an office document editor right here within next cloud and as you can see it's working we're able to edit documents right here within nexcloud that's awesome so there you have it by now you should have your very own next cloud server how cool is that let me know in the comments down below what you thought of this particular tutorial or if there's anything that you might want me to go over in the future in the meantime though thank you so much for watching i really appreciate it and be sure to subscribe if you haven't already done so and click that like button because that lets youtube know that you want to see more awesome linux content just like this i'll see you again very soon [Music] so [Music] you
Info
Channel: Learn Linux TV
Views: 103,708
Rating: undefined out of 5
Keywords: Linux, Tutorial, Howto, Guide, Distro, Linux Server, Owncloud, Nextcloud, Cloud, Cloud Server, Nextcloud Hub, Let's Encrypt, nextcloud tutorial, install nextcloud, nextcloud server, nextcloud install, nextcloud setup, nextcloud installation tutorial, nextcloud ubuntu, ubuntu, ubuntu server, linux tutorial, cloud storage, nextcloud setup guide, nextcloud server install, nextcloud server setup ubuntu, nextcloud server setup, nextcloud setup https, install nextcloud on ubuntu 20.04
Id: 2OsNGj2n2zc
Channel Id: undefined
Length: 62min 9sec (3729 seconds)
Published: Mon Feb 21 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.