 Hi there and welcome to the Ubuntu Server fundamentals course. My name is Dan Mill and throughout this course, I'm going to be showing you the fundamentals of running an Ubuntu Server. Let's get into it. So the Ubuntu Server 2204 fundamentals course is designed to introduce you to the world of Ubuntu Server, one of the most popular and widely used Linux based operating systems in the world. This course is designed for if you're new to Linux or if you have some experience with it. It is my hope that this course will help you gain a solid understanding of the fundamentals of Ubuntu Server that you can use at home to further your education. Throughout the course, you're going to learn how to install Ubuntu Server, you're going to learn how to configure the system settings, manage users and permissions, we're going to set up a web server and much, much more. You're going to become familiar with the command line interface and various Linux utilities that are commonly used in an Ubuntu Server. The first part of the course is going to be focusing on some basics like what is a server, what is some server hardware examples, what is Linux and what is Ubuntu. I'd highly recommend not skipping over these videos to dive straight into the demos as these are important concepts to learn. Once we've got that out of the way though, we will be diving into an Ubuntu Server environment and giving you demonstrations on how to manage it. Each step of the way, we're going to be showing you the fundamentals of managing that operating system. By the end of this course, you will have the knowledge and skills needed to set up and manage your own Ubuntu Server and will be able to perform tasks such as configuring the network settings, installing and managing software and troubleshooting some of the common issues. So whether you're a student, a developer or an IT professional, this course is going to provide you with a solid foundation in the Ubuntu Server operating system and prepare you for more advanced topics down the line. So let's get started. I do just want to add one small disclaimer and that the contents of this course are intended for educational and training purposes only. They are not designed or recommended for use on production systems. While the course does provide valuable information on Ubuntu Server fundamentals, it's important to know that managing Linux servers in a production environment requires adherence to best practices and the use of reliable and up-to-date documentation. We strongly encourage you to refer to the official server documentation and follow recommended best practices when managing production systems. With that out of the way though, let's jump into our first lecture where we're going to be talking about what is a server? Hey there. Before we dive into the Ubuntu Server configurations, I just want to cover off what is a server for those of you that aren't aware. A server is a physical machine that provides services or resources to other computers or devices on a network. It stores and manages files, data and applications that can be accessed by users or other devices on that network. It can be used for various purposes, such as hosting websites, running databases, managing email, providing remote access to files and applications and many, many more. So in summary, a server acts as a central hub for managing and sharing resources within a network. Now let's take a look at the hardware that runs a server. The hardware components that go into a server can vary depending on the intended use and requirements of the specific application or applications that it's running. However, some common hardware components found in servers include the CPU, which is the processor, the memory, which can also be called RAM, the storage devices, the network interface cards, the power supply, and the cooling system. In addition to these basic components, servers may also include additional hardware components depending on the specific application. For example, servers used for data analysis may require dedicated graphics processing units, otherwise known as GPOs. While servers used hosting websites may require multiple network interface cards to handle that higher volume of traffic. There are different forms of servers, so there are tower servers, which are standalone units that sit on a desk or a floor. There are also rack mount servers, which is designed to be mounted into a standard equipment rack. Another really important factor to consider when choosing a server is redundancy. So redundancy is important because it ensures that a failure in one component of the server does not cause the entire system to fail. This can be achieved through techniques like RAID, which duplicates data across multiple hard drives, or through redundant power supplies and cooling systems. The main focus of what we're going to be looking at here isn't the server hardware, it's the operating system that runs on that hardware. A server operating system allows multiple users to access and share data and resources on it, and it provides services like file sharing, email, website hosting, and many more. In this course, we're going to be covering the Linux distro Ubuntu server, specifically the version 2204. When selecting server hardware, it's important to consider the future needs. This means choosing a server that can be upgraded as your needs grow and change. So this could include upgrading things like the processor, adding more RAM or more storage, or adding additional network interfaces. So overall, we've covered off the server hardware and why it's so critical in any component of IT infrastructure. Choosing the right server can help ensure that the operations run smoothly officially, both now and in the future. As you're getting into the IT career, you really need to start getting to grips with these different terminologies and understanding why servers are going to be a big part of your role. Thanks for watching. I'll see you in the next video. Hey, in this lecture, we're going to be covering the topic of what is Linux? So Linux is an open source operating system that's widely used in servers due to its stability, reliability, and security. In this lecture, we're going to cover some of the basics of Linux servers and why they're so important. First of all, I want to talk a bit about what open source is. So open source is a software development and distribution model in which the source code for a program is made available to the public, allowing anyone to view, modify, and distribute the code. In the context of Linux, open source refers to the fact that the code that makes up the operating system is available for anyone to use, modify, and redistribute, subject to the terms of the specific open source license, which is released. The Linux operating system itself is open source, which means that the source code is available for anyone who wants to use it. This has helped make Linux an extremely popular operating system, as it can be customized to meet the needs of different users and organizations. One of the key advantages of Linux servers is the flexibility. It's highly customizable and can be configured to perform a wide variety of tasks. Some of the most common server roles for Linux servers include web servers, email servers, and database servers. But there are many more not on this list, which you'll find out about in later lectures. Some fun facts about Linux is Linux is extremely case sensitive. So in Windows, for example, when you're creating a folder, if you put a capital first, so let's say you're creating a folder called home, and the first letter, h, is a capital h, and then the rest are lower cases. When you go to browse to that using the File Explorer, it doesn't matter if you use uppercase or lowercase, it's going to know what you mean. In Linux, that's not the case. It's very case sensitive, as you'll see throughout the courses we're about to do, so always keep that in mind. Another fun fact is it's estimated that Linux operates around 90% of the top 1 million websites in the world. It was created in 1991 by Linus Torvalds, many of the world's largest technology companies like Google, Facebook, Amazon, and IBM use Linux extensively in their operations. And Tux is a Penguin character and the official brand character of the Linux kernel. Linux has many distributions or distros, which are variations of the operating system that are customized for specific application or user needs. Some popular ones are Ubuntu Server, which we're going to be covering in this course. There's also Red Hat or R-H-E-L, the CentOS, and Debian. But I challenge you to go out and do a quick Google on Linux distros and just see how many are available and how many pop up. Throughout the course, I'm going to be stressing how important it is to keep your system secure. It's important for many critical reasons, like a security breach can compromise your sensitive data. A compromised server can also be used as a launching pad for attacks against other devices on networks. Therefore, maintaining the security of your Linux servers, even if you're just playing around with them at home, should be a top priority for anyone that values their data and reputation. That's it for this lecture. I'll go ahead and see you in the next one, where we're going to be talking a lot more about the Ubuntu Server distro. All right, it's time for us to get down to serious business. Let's talk about Ubuntu Server. Ubuntu Server is a version of Ubuntu operating system specifically designed to be used as a server. It is a free and open source platform that can be used for various server applications, like web servers, database servers, mouse servers, file servers, gaming servers, among many others. Ubuntu Server is really well known for its stability, security, and ease of use. It's widely used in small and large enterprises, as well as by individual users. It has a large active community of developers and users who contribute to the development of the operating system and provide support and share knowledge. There are even paid versions that come with levels of support through a thing called Ubuntu Pro, which we'll cover in a much later lecture. Ubuntu comes with a range of tools and software that can be used to configure and manage different server applications. Now, it is important to note that Ubuntu does have a desktop version that's designed for personal computers and laptops. It comes with a graphical interface that allows users to interact with the system using a mouse and keyboard. Whilst Ubuntu desktop can technically be used as a server operating system, it's generally not recommended due to its resource intensive nature and potential security vulnerabilities that may be introduced by its graphical interface. But as I always say, you're going to learn more from doing than you are by reading. So after the next lecture, where we just compare terminal versus graphical interfaces, we're going to dive into Ubuntu, get it installed in a virtual machine, and start working through the configuration labs. I'll see you there. So if you haven't used Ubuntu server before, one of the things you're going to notice is it's lack of a graphical interface, or otherwise known as GUI, where other operating systems like Windows and macOS have that graphical interface that allow you to use a keyboard, mouse, and monitor to be able to navigate around. Ubuntu server is command line only. Now when we talk about graphical interfaces, there are a couple of pros, so it can make it easier for users who are not familiar with command line interfaces to interact with the server and perform tasks like file management, software installation, and system configuration. It's also easier for users to visualize and monitor performance and statuses of the servers in real time, which can be helpful when troubleshooting issues. However, there are some big cons and reasons why Ubuntu servers stay away from it. The first one is that it's extremely resource intensive. A graphical interface can consume a significant amount of system resources like your memory, your CPU, which can negatively impact the performance of a server. It's also important to note that graphical interface often introduces potential security risks as it increases the attack surface of the server and may expose vulnerabilities that can be exploited by hackers. In summary, while graphical interface can make it easier for novice users to interact with the server, it can also introduce potential security risk and negatively impact the performance of the server. With that said, the more you learn and study on the Linux command lines, the more of pro you're gonna become and the more I believe is really gonna help your IT career. Having worked in managed service providers and internal IT, I cannot stress how important it was that I had that Linux experience. And I hope throughout the course, I'm gonna show you just how powerful Ubuntu server is and why it's something you really should have in your arsenal when you're applying for those IT positions. Now that we've got all the slide lectures out of the way, in the next section, we're gonna be diving into downloading and installing Ubuntu server in a hypervisor. So let's get into it. Hey there. In this video, we're gonna go through downloading the Ubuntu 22.04.2 Long Term Support Installation Media. Then we're gonna create the virtual machine in a Microsoft Hyper-V environment with that installation media. By the end of this video, we will have a fully working Ubuntu server virtual machine for our later lessons. At home, you may be using a different hypervisor platform and that's fine. There are plenty of guides out there in case you wanna use VirtualBox, VMware Workstation, Proxmox or any other platform. A lot of the details we go through in this video will be the same, just on a difficult graphical interface. So let's power through. The first thing we're gonna want to do is go to the Ubuntu website. To get directly there, we're gonna go to h2tps column forward slash forward slash ubuntu.com forward slash download forward slash server. In our case, the version we wanna download is the Ubuntu server 22.04.2 LTS, but there are other versions and other architectures available for download on this site. We'll simply click that and it will start the download in a few seconds. Now I have already downloaded it because this is gonna take about five to 10 minutes. So I'm just gonna cancel this download, but at home, it's simply download to your downloads folder or wherever you've got your downloads going to. Let's open up my Hyper-V manager and get that VM created. We'll go over to new virtual machine and this will bring up the new virtual machine wizard. We'll go next and we'll give this server a name. So I'm just gonna call it DMT, the DanMillTraining dash ubuntu 01. And I wanna store that virtual machine on my SSDs which is on my D drive. So I'm just gonna select the D drive. Of course in your environment, this will be wherever you've got space, but I highly recommend installing it on an SSD over a hard drive for that extra performance. We'll go next and we're gonna select a generation two virtual machine. Generation two just has a few added features, especially for 64-bit operating systems. So that's fine for our environment. We'll go next. Now the minimum specs for Ubuntu server are about one gigahertz of CPU, one gigabyte of memory and about 2.5 gigabytes of storage space. Of course, they're the minimum specs and if you run on those sort of specs, you're not gonna get great performance out of it. So because I have quite a few resources on this server and I'll show you a little bit about it. So I've got an i5 machine. It's got four cores installed there at 3.4 gigahertz. I've got 24 gigabytes of memory. I have an external network interface card and then an internal one which is just for my internal LAN. Now this isn't a proper server. This is just a gaming PC that I installed Windows Server 2022 on and made into a server. But it's important that it does have the virtualization capability. You know that, we'll go back to our Hyper-B Wizard and we're gonna install eight gigabytes of memory on this server so that we have plenty of performance and we don't notice any lag or anything like that. We'll go next. And for this, I'm gonna connect my external interface. So that's gonna go out to the internet. We'll go next. And I'm gonna give this only 32 gigabytes of size. Of course you can give it more, but 32 gigabytes should be plenty for what we're gonna be utilizing. I am gonna change the name of the disk to something so just Operating System or OS.VHGX. So I know that this disk is just for the operating system itself. We'll click on next and we're gonna select the installation media that we downloaded from the Ubuntu website. We'll go next and finish. I am just gonna change a few settings inside the virtual machine. So I'm gonna turn off Secure Boot. I'm gonna give it a few more virtual CPU processors. Coming down to automatic start action. In my environment, I'm just gonna put nothing. So if this physical server is to boot up, it won't automatically boot the virtual machine inside of it. And for automatic stop action, I'm just gonna turn to shut down. We'll apply those settings and we're ready to get started. So I'm gonna open up the hypervisor terminal and we're gonna start the VM. Now what that's gonna do is it's gonna boot into the bootable device that we downloaded. The first option there, try or install Ubuntu server is exactly what we wanna do. So we wanna hit enter on that. And that's gonna load up the Ubuntu wizard for installing Ubuntu server onto this virtual machine. Once you have booted into the Ubuntu server installation media, you're gonna be prompted to select your language and keyboard layout. So here I'm just gonna select English and for my keyboard layout, I'm gonna go and choose English Australian. So one thing to consider when going through the Ubuntu server installation is you're not gonna be using your mouse at all. All of this is done via your keyboard. So the arrow keys allow you to go up, down, left, right. The space bar is often for when you wanna select an option. So if there's a tick box, you just hit the space bar to select it and you can hit the space bar to unselect it and enter precede you forward once you're hovering over the dumb button. So I've gone up, I've selected English Australian. Now I'm gonna hit enter to proceed forward. I'm gonna stick with the Ubuntu server instead of the Ubuntu server minimized. The minimized version just has a smaller footprint so a lot of packages aren't included inside of it but we just want everything because a lot of our contents that we're gonna cover is in the default Ubuntu server installation. So we hit enter. I am just gonna leave it on DHCP for now. So that's the IP address that my router is assigning the virtual machine. I'll show you a bit later on in a later lecture how to configure a static IP. So but for now we're just gonna leave that on the DHCP address that's been assigned. If you don't have DHCP in your environment, you're gonna get what's called an IP address which may start with something like 169.254 but we'll cover off the networking a bit later on. So we'll hit enter for done. I do not have any sort of proxy server in my environment so I can just hit done and leave that blank there. The mirror address, it's automatically selected the Australian Ubuntu mirror. That's absolutely great. So that's where all the repository and the packages are stored. And next Ubuntu offers two installation types. So you can use the guided storage layout which is where Ubuntu figures everything out for you. Or you can do a custom storage layout. Custom storage layout is more for your advanced users. So as a beginner, we're just gonna stick with use an entire disk which is selected here with the X mark crossed in it. We're gonna have that X crossed of set up this disk as an LVM group as well and proceed with done. Next up, it's gonna give you a summary of how it's gonna lay out your file system. Again, as a beginner, we can leave Ubuntu to do all of this for us. So just hit enter and done. It is gonna give us a little bit of a warning saying that any data that exists on this virtual disk currently is gonna be erased. This is a newly created virtual disk so we don't need to worry about that. It is something to consider though if you're using this on a physical server, make sure that the disks you're using you're okay with completely formatting. So we're gonna hit continue and now we're gonna set up our user account. So this is the default user account that'll be set up when we first get into Ubuntu server. So your name, I'm just gonna put as Dan. The server name is DMT-Ebuntu01. Pick a username, again Dan, and pick a strong password. So I'm just gonna use a short password because we'll be using it a lot in these videos but it's important in your environment that you pick a strong password. We'll hit done. The Ubuntu Pro is a paid version of Ubuntu so a subscription version that allows added security features and as well as support. We aren't gonna go for it because this is just a demo homelab environment but it's something to consider if you need support for your Ubuntu installation. We'll hit continue. We do wanna install open SSH server and we have a future lecture about what open SSH is. Essentially, it's the management components of how you're remoting into the server to configure it. We do want that so I'm gonna hit the space bar to make sure there's an X tick there and go down to done to proceed. As a beginner, we don't need to worry about any server snaps so we're just gonna go done and proceed past with none of those selected and that's it. The server's now gonna install so depending on if this is on an SSD or a hard drive, an SSD should only take a couple of minutes whereas a hard drive might take a bit longer. I'm gonna fast forward the video so you can see exactly how long it takes on my system and we'll know it's done when down the bottom there we see an option that says reboot now. And there we have it. The installation is complete and it's now prompting us to reboot the server. So we're gonna head and hit enter on the reboot now. We have got an error saying it's failed to unmount the CD-ROM so an easy way of fixing that is just to go into the settings and delete the DVD drive from the configuration there. So if we hit enter again, now that we've done that, the server's rebooting and we're gonna see the Ubuntu server load. And there we go. We've now covered off in downloading and installing the Ubuntu server. We'll know this is successful because as you can see there's a lot of green as it's starting up that server and we're now gonna be prompted with the login screen. So we've also had SSH just pop up there. You can hit enter just to kind of get back to the login screen. We'll log in with the user we've just created and there we go. That's it for this lecture. In the next one, we're gonna be covering off the general networking side of Ubuntu server and how you can get that set up on a static IP, create static routes, as well as a few troubleshooting tools to help you with your networking. I hope this video has been informative for you. I'll see you in the next one. Hey and welcome back. In the last video, we downloaded and installed an Ubuntu server virtual machine and in this video, we're gonna talk about the networking side of an Ubuntu server. First of all, what is networking? Well, in simple terms, networking refers to the communication between devices or computers. In the context of a server, network is crucial for accessing the server remotely, transferring files and performing other tasks. In Ubuntu, there are a few key tools and configurations that are important for setting up and managing a network. So let's start with the basics. Now, one thing you can do in Hypervisor is if we hit this maximize button here, we're gonna get the whole interface for us. I will show you later on how we can SSH into the server, but for now, we're gonna continue using the Hyper-V console until we get to that point. So first thing, we're gonna check what the IP address our router has assigned to our Ubuntu server. You remember when we were installing and configuring the server, we set it to keep using DHCP. So let's find out now. Firstly, we're gonna check what the IP address our router has assigned our Ubuntu server. You remember during the install and configuration, we left it on DHCP, so let's see. We can do that by typing in IP space ADDR, which is an abbreviation for IP address. Here we can see the first one is a loopback address. Now that's typically used for troubleshooting, so we don't need to focus on that for now. But you can see next to the number two there, we've got eth0, which is the interface we've configured. There's some handy information like the MAC address of the interface, the IP address, which is that INET address there. So we can see it's been assigned 192.168.69.124 on a 24 subnet. That subnet is 255.255.255.0. If you're not up to speed on your network masks yet. There is also an IPv6 address that's been assigned. In this course, we're only gonna really focus on IPv4 as it's the most commonly used protocol in networking. But there is plenty of documentation out there if you wanna get involved with IPv6. If we want more details on the network interface itself, we can type sudo lshw-class network. Now you're gonna see me type sudo a lot before any of my commands that I run. And we will cover what this is in a later video. But for now, all you need to know is that sudo is gonna give us the admin rights to run these sort of commands. If we hit enter, we're gonna be prompted for the password. That's the password of the user we created during the Ubuntu installation. We'll type that in. And here we can see a bit of information about that network card. We can see it's been giving a physical ID. The description is ethernet interface. Now this may change to fiber interface if you're using fiber optic cables. We can see the logical name there. So eth0, which stands for ethernet zero. The zero is the MAC address. The size is actually the bandwidth that's been negotiated between this device and the uplink device. So if you're Ubuntu server was plugged into a switch, they would in order to negotiate the fastest speeds capable based on the type of cable and based on the type of network interface you've got. You can see there, mine has been assigned a one gigabit, but you may see other numbers in here like 100 megabit or 10 gigabit. And lastly, in the configuration, one thing you wanna take notice of is what driver version your network interface is using. Now we're gonna look at configuring a static IP on this network interface. So static IP is a fixed IP address that's manually assigned to a device, such as a server. And it remains constant unless it's manually changed. In contrast, a dynamic IP address or DHCP is assigned by a DHCP server and it can change over time. Static IP addresses are important in servers because they provide a consistent unchanging address that clients can use to connect to the server. If a server's IP address was to change frequently, clients would have trouble finding the server or connecting to its services. Most network protocols and applications on an Ubuntu server do require a static IP in order to function properly. With that said, let's look at the netplan file, which is the configuration file for the network settings. First though, we're gonna create a backup of this file with the following command. This command simply copies the file which is located in ETC forward slash netplan forward slash zero zero dash installer dash config.yaml and it's gonna put it in our home directory as a dot copy. So if we hit enter and then do an LS which lists the current directory, we can see that file is there. This backup file may come in handy if we're making changes and we accidentally break something, we can simply revert back to the settings that it's in the copy of the backup. It's a really good habit to get into to backup any files before editing them as a mistake can be costly. Now let's open up the configuration file. So we'll do sudo nano and then the network path as a netplan zero zero. We can just hit tab to order complete that. We hit enter, we can see the network configuration file. I've taken a little bit of fast forwarding to this file being completed just so I can run through with you what I've done. So the most important thing here is we've set the DHCP four to false. We've set the addresses so you can see we've put on the line here address and then indented one in for the IP address. This is very important that you do these proper indentations. So we've given this an IP of 192.168.69.235 on a 24 subnet. That's gonna be different in your environment depending on what your local subnet and what your IP address scheme is using. So please keep that in mind. Next up we've set the default gateway so the routes here, we've set a default route to my router. So that's 192.168.69.254 and that's to make sure we have some internet connection. And we've set the DNS servers to 1.1.1.1 and 8.8.8.8. That's Cloudflare and Google's public DNS for y'all that didn't know. We'll leave it on version two and we'll simply do a control X to exit out of there. If you're control Xing it may prompt you to overwrite the existing file in which you just wanna hit yes and complete that. And then to apply the changes we do a pseudo net plan apply. If we now look at our IP address we can see it's changed to the static IP we configured. That's it for setting a static IP in an Ubuntu server. If we wanna look at the route table inside of here we go IP route show and we can see that we currently only have one which is the default route that we set in that net plan file. So that's gonna route all internet traffic out through that router IP address. If you wanted to add a static route into your environment so let's say you've got some servers in a different VLAN or you've got quite an advanced network configuration to add a static route you simply do IP route add put in the subnet you're wanting to target so let's say for example, one on two on six eight one dot zero slash 24 and then do via the next hop address which in my case would be the router. And you can see I missed out the pseudo there which is exactly why I'm getting that error. Now if you do an IP route show you can see that that one on two one six eight one dot zero has been appended in there. Don't worry too much if you're low on the networking experience scale and you're not quite sure what a static route is with what I've just shown you at least when you get to terms with it you'll know how to do it. One other really cool thing I wanna show you is the ability to modify the host name file in order to set static host names for IP addresses. So if we go pseudo nano ETC hosts you can see there's a couple in here already. So if we were to ping DMT dash Ubuntu one it would resolve to the local IP address. But let's say I wanted to just instead of continuously using my routers IP address I wanted to give it a host name. I can just put the IP address in, hit tab and then give it a name. If I exit out of here now and do a ping router you can see that router is resolving to the IP address I just specified in that file. This can be really handy to use if you haven't got a DNS server in your premises and you wanna cut down on having to remember all those IPs. The ping command I've used there you've probably used a ton in Windows before and it's the exact same premise. It's just gonna send an ICMP packet to the destination that you specify and can be a really great troubleshooting tool. Some other troubleshooting tools to get to grips with is trace path which replaces the typical Windows tracer out and dig which is gonna allow you to look up the DNS details of a domain. So if we was to do a dig on Google.com there you can see all the details that you may need to troubleshoot if the DNS is not performing correctly. That's it for the networking fundamentals. I wanna thank you for sticking with me throughout this lecture and I'll see you in the next one where we'll be looking at updating and upgrading the Ubuntu server. Bye for now. When working with Ubuntu servers it's important to keep the system up to date with the latest security patches and software updates. Two important commands for doing this are the app to get update and app to get upgrade commands. The app to get update command retrieves the latest package information from the repositories configured on the system. You'll remember when we installed the Ubuntu server we had to pick the mirror and that's the repositories that the system's gonna use. To check on these we can go to nano, etc, apt, sources.list and you can see all of those repositories there. Some software and packages do require you to add different repositories in here but always be careful when doing so that they are from a trusted source. So these repositories are servers that contain a collection of pre-built software packages that can be installed on the system. By running app get update you ensure that your system has the latest information on available packages including the latest security patches and bug fixes. Let's run it now. So we'll do sudo first, app get update, password. And there we can see it's reaching out to those servers and checking to make sure the package lists are up to date. The app get upgrade command installs the latest version of all packages that have been updated since the last app get update command was run. This command ensures that your system is up to date with the latest software updates and security patches helping to keep your system secure and stable. It's important to note that whilst running app get upgrade is an important step to maintaining your system it can also potentially cause issues with compatibility or configuration. Therefore it's always recommended to test upgrades in a staging environment before running them on a production server. As we're just doing this for homelab and education purposes, let's go ahead and run it. So sudo app get upgrade. Now it's gone out and found 28 different packages that need upgrading and it's going to use about 1.2 megabytes of disk space which is absolutely fine. So I'm going to hit Y and Enter and now you can see it reaching out and pulling all those down. This is going to take a little bit of time depending on how out of date your system is. But it's a good idea to keep an eye on it just in case there's any errors or anything that goes wrong. Here it's come up with little graphical interface asking us which services should be restarted. So in the purpose of my homelab I'm just going to choose all of them using the space key to highlight them with a little asterisk and then hit OK. And there we go, that's completed. So in summary, app get update and app get upgrade are essential commands for maintaining an up to date and secure Ubuntu server. To summarize it, app get update updates the package information from the repositories whilst app get upgrade performs the latest updates for the install packages. Thanks for sticking with me in this video. In the next video we're going to be looking at SSH so I'll see you in that one. Hey and welcome back. In this video we're going to be talking about SSH which stands for secure shell. It's a protocol that allows secure remote access to servers and other network devices. It provides an encrypted channel for transmitting data between two devices often called the client and the server and it allows users to securely log in to a remote system to perform tasks. Up until now we've just been using the Hyper-V terminal but you don't want to have to log on to your hypervisor every time you want to be configuring your Ubuntu server. That's where SSH comes in. Now we did install SSH server during the installation but if you have an existing Ubuntu server and you want to install it you can simply run sudo apt-get install open ssh-server and then we do a dash y to say yes we do want to install it but as you can see I've run it on my one and it said it's already installed. If it wasn't it would simply run through and get that auto configured for you. Once the SSH server is installed if you need to configure it the main configuration file is located in etc ssh sshd underscore config. So here we go we can see the configuration file with all of the default settings included and we will go through and configure a couple of these in a minute. If you want to check the status of your SSH server you can simply run sudo systemctl status ssh and we can see that SSH is active running by the little green writing there. If it was errored for any reason or failed it would give you a little bit of a description as to why that you could go and troubleshoot. Now that you have SSH set up on your Ubuntu server it's important to take steps to secure it. Here are some best practices and ideas for securing your SSH server. First of all use a non-standard port. By default SSH uses port 22 for communication. Changing the port to a non-standard number can help prevent automated attacks that target the default port. You can change the port number in the SSH server configuration file. Let's do that now. So I'll go back to that config file and do a sudo nano so that we can write over it this time. SSH sshd and we'll find that port. We'll unhash it so it reads from this file and we're gonna change it to 2250. Now it's important to use a port that's not currently in use as that can cause some conflicts. To save an exit we're gonna hit control x hit y to save and then enter to override it and now we need to restart the SSH server in order to make those settings apply. Next up we can disable the root login over SSH. It's a good security practice as it prevents attackers from directly logging in as the root user. You can do this again by going back into the sshd config file, finding the line that says permit root login which we found right here, unhash it and just change it to no. Now only user accounts will be able to log in which will then need to elevate using the sudo commands to do any sort of administrative privileges. Some other things to consider is making sure that SS traffic is locked down. This means not just forwarding it through from your router or firewall at home to your Ubuntu server as this leaves it open to brute force attacks. You can use packages like fail2ban which automatically blocks any IPs if they fail to authenticate a few times. However, it's really best practice and really good practice for you getting into the IT industry to never leave port 22 or any other remote management port open to the internet. If you are going to be using port forwards always make sure you lock it down to a source IP or source network that you trust. This is going to help prevent unauthorized access to the SSH server which could then be used as a platform to launch attacks into your other devices in your network. You could also look at using key based authentication. So it's more secure than password based authentication and requires possession of a private key in addition to a password. You can generate key pairs using various tools out there install them on the SSH server and the SSH client and that removes an attack vector where someone just uses a password to gain access to your environment. Another option is you could look at multi-factor authentication. So there are packages out there that allow you to log in with a password and a second factor authentication token. However, for the sake of this fundamentals video we're just going to be sticking with the password login. Now that we've looked to that let's go and actually log into the server using SSH. So I'm going to exit out of the hypervisor I'm going to go into my folder where I've downloaded a tool called putties. This is like an SSH client tool. It also does things like telnet and console cable ports. We're going to put in our custom port which was 2250. The host name, which is the IP address we'd assign that server and hit enter. The first thing it's going to do is pop up with this little security alert. We're just going to accept because we do trust this server. It's our server. Then we're going to log in as the user we created during our installation. We'll maximize that. And there we go. We are now SSHed in and can remote access this environment from this server or any others in my local network. In summary, SSH is an essential tool for remote access to Ubuntu servers. Setting it up involves installing the open SSH server package and configuring the server itself. Securing it involves many different aspects such as changing the standard ports, limiting access with firewall rules, disabling root logins, and using key-based authentication or multi-factor authentication. I want to thank you for watching. In the next section, we're going to be talking about users and groups within Ubuntu server. I hope you stick around and I hope to see you in the next one. When it comes to users, they're an essential part of Ubuntu server and any other server as a matter of fact. They provide a means of identifying and authenticating users who are allowed to access and interact with the system's resources. In general, users in Ubuntu server are used for the following purposes. Security, each user account has its own unique username and password, which provides a way of identifying and authenticating users who are authorized to access the system's resources. By assigning different levels of permissions and access to users, administrators can control who has access to sensitive data and system resources and can prevent unauthorized access. Users are also used to manage system resources such as files, directories, and processes. Each user account has its own home directory where they can store their files in configuration settings. Users are also assigned different levels of permissions to access and modify files and directories owned by other users. Users can customize their own settings and preferences for applications they use on the server. It's important to note that users aren't always for people either. You can use service accounts that tie into different resources on your machine that gives them specific access to the resources they need access to. So for example, if you're running a web server, you may create a user called web server that manages the applications and packages installed on that machine. Here are some basic steps for managing users. First of all, let's go ahead and look at creating a user. You use the add user command inside the terminal here. So if we do sudo add user, and let's say we're adding a user called john. When we hit enter, it's going to ask us for our password, elevating our rights to be able to create that user. So we'll enter the password used for our own one. Next it's going to ask you to put in a password for the user you're creating. So we put in a strong passphrase there. It's important to note you're not going to be able to see the password you're typing in or even how many characters it is. So sometimes it's a good idea to put it into a notepad and then paste it into this field. We hit enter and we'll have to retype it to confirm it. And next we're going to get some optional values that we can put in. These are optional and can be skipped just by hitting the enter key. Or you can fill them out and they may come in handy for future situations. We're just going to enter through all of them there and then hit why to confirm everything we've entered is correct. And once we hit enter, that user has now been created. You see at the top, there's a couple of things that got created when the user was first initiated. It added the user john. It added a new group. So for every user that gets created, a group gets created with the same name. And lastly it creates their home directory. So they can go ahead and save files in there. To modify an existing user, you can use the user mod command. This command allows you to change various settings and attributes. For example, to change a user's home directory, we can do it like this. So first of all, let's go into the home directories. So here we can see John has got one. If I make a new directory and we'll call it John2, and we're going to need to use sudo for that of course. Now what I can do is sudo user mod dash D, put in the path, so home John2, and then put in the user that you're changing the directory for. And there we go. John's home directory has now been changed from John to John2 in the home directory folder. To change one's password, we simply do a sudo p-a-s-s-w-d and then put in the user whose password we want to change. It's going to ask us to put in that new password. So we'll do that. And it's going to ask us to retype it to confirm it. And there we go. The password for John has been successfully updated. To delete a user account, you can use the del user command. This command will remove the user's account and home directory, but will not remove any files or directories owned by the user. For example, we can run sudo del user John. And there you go. We've removed John from this system. Let's go ahead and add a couple of different users into the environment that we can use for later on. I'll tab on up till we see the add user. So we're going to make Billy. Now I've got the password wrong now, so let's do it again. Tab through all of that. And we're also going to make Mike. To see a list of users on an Ubuntu server, you can use the cat command. To view the contents of the ETC p-a-s-s-w-d file, like this. Now you may be thinking, well, I haven't created all of these users. That's absolutely right. Ubuntu server by default creates a lot of system users that it needs to be able to run various things on the server. But down the bottom, you'll often find the users you've created. Each line represents a single user account and contains the following fields. Here's a brief explanation of each of the fields. First off, we've got the username. Secondly, we've got if there's an encrypted password. This field is typically set to an X indicating that the password is stored in the shadow file. The UID is the numeric user ID of the user account. You've also got one of these for the group ID. Here, we'd have the full name, which is currently blank. The home directory is created by default, but as you saw earlier, we can change this. And lastly, the path to the user's default shell. In this video, we've covered off the fundamentals of adding, modifying, and deleting users and what they are in an Ubuntu server. In the next video, we're gonna be tackling groups. So I'll see you there. Groups in Ubuntu server are used to organize users and provide a means of managing access to system resources. Each user in Ubuntu server belongs to one or more groups which are used to control access to files, directories, and other resources on the system. Here are some key points to understand about groups in the Ubuntu server. Ubuntu server supports two types of groups, primary and secondary. Each user has a primary group which is specified in the ETC PASSWD file. Users can also belong to multiple secondary groups which are defined in the ETC group file. Groups are used to control access to files and directories. Each file and directory on the system has an owner and a group. File permissions can be set for the owner, the group and everyone else. This allows administrators to control who can read, write or execute files and directories on the system. We'll cover this in a later lecture. Ubuntu server creates a number of default groups during installation, including the root, sudo and users groups. These groups are used to manage system resources and provide access to administrative tools. Understanding how groups works is an important part of managing users and securing your Ubuntu server. Let's dive into some of the commands. To add a new group in Ubuntu server, you can use the group add command followed by the name of the group. For example, sudo group add sysadmins. We'll put in the password for our user giving us administrative rights to create that group on the server. And there we go. We've now created a group on the server called sysadmins. In order to add a user into a group, we simply type sudo user mod dash log case A capital G, the group, so sysadmins, and then the user we want to add. So Mike has now been added to sysadmins. We're to go up. We can also add Billy and we can also add Dan. If we want to remove a user from a group, we can use the G password command followed by the dash D option and the name of the user. For example, to remove the user Dan from the sysadmins group, we can run the following command. sudo G password dash D Dan sysadmins. Removing the user Dan from the group sysadmins. In order to delete a group in Ubuntu, you can use the group del command. So we'll do sudo group del sysadmins. And that group we created has now been deleted. It's important to note that managing groups and user membership should be done carefully as it can impact system security and access to resources. Always double check your commands and ensure you have a backup plan in case of an accidental change or mistake. In order to list all the groups on the server, we can simply run get EMT group. And there you can see similar to the commands we ran in the user's lecture. We have a list of all the groups that have been created. Most of these being done when the Ubuntu server was created. If we go through what we've learnt now, let's go and create a new group. Let's call this one sales. Then we'll tab up and we'll add users to that. Apologies. To see the members of this group, we can simply do the same command of get EMT group and then put the group name at the end. And there we can see all three members of the sales group. We can also see the group ID which can come in handy for other advanced commands on the system. And that's it for the fundamentals of utilising groups within Ubuntu server. In the next section, we're gonna be talking about the root user and the pseudo commands that we've been using and give them a bit of an explanation. I'll see you in the next lecture. Now in this video, I wanna talk to you about the root user and the pseudo command that we've been using up until now to elevate our privileges. So in Ubuntu server, the root user is a special user account with administrative privileges that allows the user to perform actions that would normally require super user or elevated permissions. The root user has full access to all files and directories on the system and can execute any commander program. The pseudo command, which stands for super user do is a command line tool in Ubuntu that allows a regular user to execute commands with root or super user privileges. When a user enters a command using pseudo, they are prompted to enter their own password to verify their identity and authorization to execute the command as a super user. There are some best practices around these and they are as follows. First of all, avoid using the root user account for everyday tasks. It's not recommended because it has full access to all system files and directories, which can be dangerous if something goes wrong. Instead, always use a regular user account and pseudo command to execute a task that require elevated permissions. Only use the pseudo command when it's absolutely necessary and only for tasks that do require super user permissions. Avoid running commands with pseudo unless you fully understand what they do and the potential impact on the system. Always be careful with pseudo commands. Double check the command you're about to execute to make sure you're executing the correct command with the right parameters. A typo or mistake in a pseudo command can have serious consequences. And make sure you use it with care. This means not just copy and pasting commands that you find on the internet. Always make sure you're doing your research before you put anything into your Ubuntu server to make sure it's safe and secure. So first we're gonna create a new user. So we're gonna go pseudo add user. Let's just call them admin one. So it's gonna ask us for their new password which we'll put in, retype it and we're gonna skip through all the optionals. Now we need to elevate them to have those super user privileges or to be able to elevate themselves into those super user privileges. In order to do that, we need to run pseudo user mod dash lowercase a capital G. The group, so the group we're adding them to is the pseudo group and then their username which is admin one. To verify this has worked, let's go ahead and open up an SSH shell. Jump into our server using that new admin. So admin one with the password. Let's try that again. Fantastic. So now in order to get into root, which I'll show you, you can do a pseudo dash I. Now if we've given this user the correct permissions, this will allow them to do that. Fantastic. It's asking for their password. Once they're authorized, you can now see that they've changed from being logged in as admin one to being into the root. So you do that with a pseudo dash I command and now we're elevated into the root permissions which we wanna try and avoid where we can. So let's say we've done everything we need to do and we wanna go back to our user, we simply type the word exit and that logs us out back into admin one. So just remember, the pseudo group is a group of users with pseudo privileges. By adding a user to the pseudo group, you're granting them the ability to run commands with that admin privilege. If you wanna see who is a part of the pseudo's group, we can do the get EMT root pseudo and we can see here that currently we've got Dan, we've got a user called new admin and we've got admin one, which we just added. I hope this has been informative for you and I hope you've learned a thing or two about the root user and about the pseudo commands. Thanks for sticking with me. I'll see you in the next video. In this video, I wanna talk to you about Vim and Nano. Now Vim and Nano are two popular text editors used in Linux and Unix based operating systems. Both editors have their own strengths and weaknesses and are favored by different users depending on their preferences and requirements. In this lecture, we're gonna compare and contrast Vim and Nano and try and help you decide which editor may be best for your needs. The first one we're gonna look at is Vim. So to use Vim, you simply type in Vim followed by the file that you wanna edit. So if we go back to our SSH file that we were editing earlier, here you can see what it looks like. Vim is a powerful text editor that is highly configurable and can be customized to suit the user's needs. Vim has different modes, including normal, insert, visual and command line modes. Each mode allows you to perform different actions and commands within the editor. So for example, we've just opened this file and if I start typing on my keyboard, you see nothing is really happening. Vim, my default when you open it, is in read-only mode, meaning you can't make any changes. If I want to make a change, I have to hit the insert key on my keyboard and now you can see I'm able to type. Now that warning down the bottom there, changing a read-only file, that's because we entered this file without sudo, so it's not gonna allow us to overwrite it, but for the demonstration, that's fine. Vim has thousands of plugins available for it which can add new features, improve existing ones and streamline your workflow. Vim is designed to be operated using keyboard shortcuts which can make it faster than a mouse-based editor like Nano. For example, if I was to hit escape to go out of insert mode and then do a forward slash permit root login, you can see there it's searching for the exact syntax. When you've got files that are thousands and thousands of lines long, having that search function is really handy. Now that you've seen Vim, we're gonna exit out of there. So to exit a file without saving the changes, we do our colon, queue, exclamation mark. And there we go. We've now exited that file without making any changes. Let's jump on over to Nano, which we've already seen a bit in the videos, but now we'll get a bit deeper dive into what it is. Nano is a lightweight text editor that's easy to use and ideal for beginners. Nano has a simple user-friendly interface that makes it easier to learn and use. I highly recommend getting used to Nano before trying to jump into Vim. Nano has a smaller number of keyboard shortcuts and most of its functionality can be accessed through the simple menu system down at the bottom there. Nano is available on most Unix systems, making it a popular choice for users who work with multiple different distros. To show you how to search within Nano, we simply hit control W. It'll bring up a search bar. So again, if we do permit root login and hit Enter, there we go. It's gonna find that, and if it doesn't find anything, it's gonna let us know that the search parameters that we put don't exist. And there we go. If we control X, that's it for Nano. I just wanted to give you a really brief overview of the two. Obviously, there is so much documentation out there on both of them, so it's really up to you to go out and do your own research to find which one's gonna suit your needs and which one's gonna benefit you more. Ultimately, the choice between Vim and Nano will depend on your personal preferences. Your level of experience and the tasks you need to accomplish. Thanks for sticking with me throughout the video. In the next section, we're gonna be looking at the file and storage structures within Ubuntu. I'll see you there. In this video, we're gonna be looking at the disk and file structures within Ubuntu Server. We'll look at disk management first, which is an essential task that enables you to allocate, partition, format, and mount new disks. Discs are storage devices that can be internal or external. They can be hard drives or SSDs, and they can be partitioned into several logical units to store data separately. If we wanna list all the logical disks and partitions currently in the server, we can do a sudo fdisk space dash L. We'll put in our password to elevate ourselves, and there we go. The main one we wanna be focused on is down here. So we have that 32 gigabyte disk that we installed during installation. We can see it's recognized as a virtual disk, and it's been split into several partitions that the Ubuntu server is using for the boot and operating system. Now I wanna give you a bit of an overview of if we add a new disk into the server, what will that look like, and how do we get it online? So we'll open up our Hyper-V manager, go into the settings of the VM. We're gonna add a new hard drive. So we're just gonna call this hard drive, we'll go dynamically expanding, that's fine. We're just gonna call this test disk, and let's make it 64 gigabytes so we can establish it's different from the 32 gigabyte one. We'll apply that, now the cool thing about Hyper-V is you can do this while the VM is running. So now if we go down and do another fdisk, here we can see that new disk. We've got the 64 gigabyte disk there, it's recognized again as a virtual disk, but unlike our slash dev slash sda, which is how you determine the difference between different disks, so this one's sda and our new disk is sdb. Unlike this one, you can see there are no partitions or anything under it. Let's go through now how we would partition this into a working disk on our server. So what we can do is sudo fdisk, and then put in the path of the disk. So slash dev slash sdb, so with putty I can just highlight it and then right click to paste. And there we go. We've now opened up a sort of like a little wizard within the Ubuntu server for partitioning disks. So it says, welcome to fdisk. Changes will remain in memory only until you decide to write them. Be careful before using the right command. Device does not contain a recognized partition table. That's fine because we just created it. So if we do an M for help, we can see all the different keyboard shortcuts we can use within fdisk in order to partition this disk. So the one we wanna first do is this one here, which is N for add a new partition. So we'll go N. It's asking us if we want a primary or an extended partition. In our case, we want a primary. So we'll hit P. Since we're only gonna be making one partition on the drive, we're just gonna enter the number one. So the partition number is one. Now it's asking us where we want the first sector to be. So we want it at the very start. So default 2048, we're just gonna hit enter to just keep that as the default. And now it's asking us where the last sector on the disk is. Again, we just want it as the default, which is the last sector. So we'll hit enter. And there we go. We've created a new partition with the size of 64 gigabytes. Now, even though we've gone through and created a partition, it still hasn't written it because we need to do the W command, which is write the table to disk and exit. So you always wanna be sure before making this that you've done everything correctly and done everything you need to do. We have in this instance, we're just gonna go W, enter. And now the partition table has been altered. If we do an F disk dash L, sorry, pseudo F disk dash L, we can see we've created that partition there now. So the dev SDB now has one partition. But if we do a DF dash H, you can see it's not currently present within our file system. That's because we need to format it with a file system first in order to store data. Now Ubuntu Server supports several different file systems like EXT4, NTFS, ZFS. But in this case, we're just gonna format it with the standard EXT4. Now EXT4 is the default file system used by Ubuntu Server, as well as many other Linux distributions. A file system for those that don't know is a method of organizing and managing data on a storage device, such as a hard disk or a solid state drive. Those familiar with Windows computers will know that disks are formatted in an NTFS file system. So EXT4 is really just the Windows equivalent of that. It's a journaling file system, which means that it keeps track of changes to the file system in a log before writing them to disk. This helps to prevent data loss or corruption in the event of a system crash or power failure. EXT4 also includes a number of performance and reliability improvement over its predecessors. Overall, it's a robust and reliable file system that provides good performance and scalability for Ubuntu servers. In order to format this disk, we're gonna type in the command sudo mkfs dash T, EXT4, and then we're gonna put in the partition name. So there is slash dev STB1. Now it's not this one here, which is just STB, that's just the disk. The partition is STB1. So we're just gonna copy and paste that in. So sudo mkfs dash T, EXT4, and then the path will enter. And there you can see it gave us some information as to what it was doing, and it's now completed it. Now still, if we do a df dash H, it's not gonna be present. That's because we need to mount it. Once you've formatted a partition, you need to mount it to a directory in the file system to access its contents. Ubuntu server automatically mounts some partitions, such as the root partition during boot, but you mainly need to mount other partitions. You can mount a partition using the following command. First, we need to create the mount. So we'll do it mkdir for slash mnt. So this is the path that we're gonna be creating that mount, and for this one, we're gonna just call it myDrive. And we need to do a sudo, there we go. Now we use the command mount dash T, EXT4, slash dev slash STB1, and the path that we've just created. We just use tab to get that to autocomplete. And I'm missing my sudo, there we go. So if we do a df dash H now, we can see it has created that in the file system, and that's now something that we can save data and write data to. This has been manually mounted, but it will not automatically mount during boot. In order to get it to mount during a boot, we need to first update the mounting file. Now in order to do that, the first thing we need to do is we need to do an ls, sudo ls dash AL, dev disk by UUID, and that's gonna give us all the UID paths for those disks. What we need to do is we need to grab the one that we've created, so we can see STB here. We need to grab this string right here, and that's gonna come in handy in a second. Now we're gonna open up a file called fstab, which is the data that Ubuntu server reads during boot as to which disks it needs to mount. So we'll do a nano, a sudo nano, etc fstab, there we go. Now we need to type in UUID all in caps equals what we've just copied. We need to put in the path that it's going to map it to every time, so mount my drive. We want ext4 as the type, options we just want as defaults, and dump and pass just zero zero. So UUID all in caps equals the string that we pasted from our ls command. The mount point, so slash mount slash my drive. The type, so ext4, the defaults, and then these two we're just gonna leave as zero. So for nano, we're just gonna go control X, hit the Y key, and then hit enter to override. Now let's reboot our system and make sure that that one comes back. To reboot, we simply just type the command reboot. Of course, I seem to be forgetting the sudo quite a bit today, so we'll give that a couple of seconds. I'll probably just fast forward the video to let the server reboot, and then we'll check on it when it comes back up. We'll do a df-h, and we'll make sure it automatically is mounted our drive. All right, we're back in business. The server's just rebooted, so we'll do a df-h. And there, we can see the disk has automatically mounted. So if we wanted to go to it, we just do a cd. If we did an ls, we can see there's currently nothing in there except the lost and found folder, which is just by default. Now I want to talk about the file system. Now the file system in Ubuntu server is organized as a hierarchy of directories. Starting with the root directory, which is commonly referred to in the forward slash, each directory can contain files, subdirectories, or other types of objects. So if we do a cd to the root, so a change directory to the root, and do an ls, lh, here we can see under the root, there is lots of different sub files each with their own use. So the root as marked here by that forward slash is the top level directory in the file system hierarchy. All other directories are subdirectories of the root directory. And in Ubuntu server, the root directory contains system files, configuration files, and executable programs. The bin contains essential binary items that are required for system boot and recovery. The boot directory contains files required for booting the system, including the kernel, bootloader configuration files, and initial RAM disk images. The dev contains device files, which represent physical and logical devices, such as hard drives, USB drives, and serial ports. In Ubuntu server, device files are used to access hardware resources and communicate with device drivers. The ETC directory contains system configuration files that control the behavior of the system and its applications. Configuration files for system services, network settings, and user accounts are all stored here. The home directory is the home directory from regular user accounts. Now, we've already seen that in a past video. Each user has a sub directory within the home directory, which contains their personal files and settings. The lib directories contain system libraries that are required by the system and applications. The media is used to mount removal devices, such as USB and CD-ROMs. The mount directory is to use to temporary mount file systems or network shares, or as we've just seen, we can permanently mount them there too. The op directory is used to store third-party software packages and applications. Proc is a virtual file system that provides information about running processes and system resources. It has information like system memory, CPU usage, and kernel modules that can be accessed through files in this directory. Root is the home directory for the root user. The root user is the super user with admin privileges on the system. The reason this is separate to the home is that if during boot up, the home had an issue and couldn't load for any reason, the root is still outside of that and shouldn't have an issue. The S-bin is system binaries that are required for system administration tasks. Temp is used to store temporary files that are created by applications or the system. Usually files in this directory automatically deleted when the system is restarted. The user directory contains user-related programs and data like system utilities, libraries, and documentation. And lastly, the last one I want to cover is VAR directory contains variable data, such as system logs, mouse pools, temporary files created by applications. To get into any of these, we simply do a CD and then put the path we want to go to. So if we're gonna go CDVAR, there we go. If we did an LS now, which lists everything inside of here, you can see all the sub files within the VAR. If we then wanted to do CDTemp, we can do that. Same command and you can see the same in here. So you can get into each of these and have a look around. I highly would recommend it just to get a bit of idea as to what each one does. But now that we've covered off disks and the file structure within Ubuntu Server, in the next lecture, I've written a text article on how you can configure MDADM, which is the inbuilt RAID package for Ubuntu Server. However, in the next video, we're gonna be looking at something a bit more advanced, which is ZFS. It is quite an advanced topic, but something I think you're really gonna enjoy. I'll see you there. In this video, I wanna cover a little bit of an advanced topic, but something that has really interested me in looking at Ubuntu Server and something that has a huge following in the industry. And that's ZFS. Now, ZFS, which stands for Zetabyte file system, is an advanced file system. It has some really interesting features, like copy on write. On most file systems when data is overwritten, it's lost forever. On ZFS, however, the new information is written to a different block on the hard drive. Once the write is completed, the file system's metadata is updated to point to the new info. This ensures that if the system crashes or something else happens, while the write is taking place, the old data will be preserved. It also means that the system does not need to run verifications after a system crash. It has the ability to do snapshots. ZFS uses snapshots to track changes in the file system. The snapshot contains the original version of the file system and the live file system contains any changes made since the snapshot was taken. Snapshot can be mounted as read only to recover a past version of a file. It is also possible to roll back the live system to a previous snapshot. All changes made since the snapshot will be lost. This can be really handy in situations where you get a virus or some sort of crypto infects your machine. So keep that in mind. Another real big advantage of ZFS is it has data integrity verification and automatic repair. Whenever new data is written, it creates a checksum for that data. When the data is read, the checksum is verified. If the checksum does not match, then ZFS knows an error has been detected. It will then automatically attempt to correct that error. So in the next video, we're gonna be looking at how to configure a ZFS RAID. We're gonna use a mirror, so where one disk is mirrored to another one, but there are lots of other different types of ZFS RAIDs available, like RAID Z1, RAID Z2, and RAID Z3. Let's familiarize ourselves with some of the basic concepts of ZFS. So a ZFS pool is a pool collection of one or more virtual disks. A virtual device or a VDEV can be a file, disk, a RAID array, a spare disk, or a log or cache. Log or cache are usually SSDs that are used to speed up the system when you're writing or reading data. And RAID Z is a variation of RAID implemented by ZFS. ZFS is a really deep subject and I could almost make an entire course on it alone. And maybe if that's what you want, drop me a comment to let me know and it's something I may look at doing in the future. But for now, we're just gonna stick to a very basic configuration, which is two disks in a mirrored config. So stick around and I'll see you in the next lecture. Did you know that if you have two hard drives of the same size, you can use RAID 1 to mirror the contents of one disk onto the other. This gives you a redundant copy of your data in case one of the disks was to fail. This is available in Windows, Mac OS, Linux, and on network attached storage devices. Now that we've taken a look at what ZFS is, let's jump into the configuration. By the end of this video, we're gonna have ZFS installed on our Ubuntu server. We're gonna have two hard drives set up in a RAID 1, so a mirrored RAID. And hopefully we're gonna teach you a few tips and tricks. So if you wanna play around with this at home, you can. First thing we need to do is we just need one package to be installed from the Ubuntu repository and that's ZFSUtils-Linux. So we're gonna install that with a sudo app install ZFSUtils-Linux, then we're gonna do a dash y. We'll put in our password and there you go. You can see it's pulling it down from those Ubuntu repositories and installing it on our machine. Now you can run a where is command. To see where it's installed it into. This can be handy if you're needing to troubleshoot or anything like that. Now let's go ahead and jump on over to our hypervisor and we're gonna create two hard disks on the virtual machine that we're gonna set up in a mirror. Now in a real virtual environment, it'd be very unlikely that you're gonna be setting up a mirror where the physical disks are on the same physical hard drive on the server. However, there may be a scenario for virtual machines if you've got multiple disks attached and you're passing those through to the virtual machine, they may set up something like this. So we'll go add new hard drive. We're just gonna call this one ZFS one and let's make it 128 gigabytes. So we know which one it is and it's different from our 32 gig boot drive and our 64 gig drive that we use for mounting our partition. So that's the first one. Let's go ahead and add another one. I'll call this ZFS two. We'll go 128 gigabytes. Next finish, apply. Back into our Ubuntu server. We can check the path of these two hard drives using a command we've seen before, so fdisk-l and there we go. We've got devsdc and devsd, both at 128 gigabytes, both not partitions yet. So now we need to create the Z-Pool, which is essentially creating the rate. In order to do this, it's just one command. So we'll do a pseudo Z-Pool, create. Then we need to give the pool a name. So we'll call this Dan pool one. Next is we need to select what type of raid this is. So there's a lot of different choices here, depending on what configuration you need. We're gonna be typing in mirror, since we're just gonna be mirroring the two disks. But I employ you to go out and look at the different types of ZFS configurations. So raid Z one, which is a replacement for raid five, raid Z two, which is a replacement for raid six, and raid Z three, which has three fault tolerant disks there. Then we need to put the parts of the disk, so SDC and SDD. And finally I'm gonna do a dash F. Now a dash F is force. You don't need to use this, but I typically do, just to make sure it works without a hitch. So we'll hit enter, it'll take a little bit of time, and that's it. To check the status of the Z-Pool, we can go to Z-Pool status, and there we go. We see we have our pool that we created, the state's online, and it will show us the state of the two disks as well. If we do a DF-H, we can see it's automatically mounted it for us. So we've got to mount there in a slash D-Pool one. So if we CD or change directory over to that, and we run an LS, we see nothing's on there. I can simply make a directory and we'll call it sales data, sales. So sudo and do an LS, and there we go. We've now got a folder on that disk drive that we've created. If we go and look at our F-stab file, you'll see that it hasn't appeared in here because ZFS takes care of all of that for us. So if we were to reboot the server, which we'll do now, so that server's been rebooted, and if we do a DF-H, we can see it's still mounted. So we don't need to worry about creating anything in our F-stab file. We don't need to worry about setting any auto mount. ZFS is taking care of absolutely everything for us, and we now have that fault tolerant disk array. So if one of those hard drives was to fail, we could simply just replace it, run a few commands through ZFS to get it to recognize the replacement and continue working. That's it for the ZFS configuration. Like I say, it's something I really employ you to play around with at home. It is a really amazing file system and you can get so much into depth. And I highly recommend you to reach out. If it's something you are interested in learning more about and you want me to create a course on it, please let me know. Your feedback in your comments are always really greatly appreciated in understanding what kind of content people are looking for and what can help you in your IT career. I wanna thank you for watching this video. I'll go ahead and see you in the next one. Welcome back. In this video, we're gonna be taking a look at managing files within Ubuntu Server. I will also post an article with a little bit of a cheat sheet for you so that you can refer back to as you're learning and using these commands. But we'll go through them in these videos and we'll give you a bit of a demo as to what each one does. If we do a CD, which is short for change directory and go over to the damn pools of the ZFS drive I created, we already looked at the MKDIR, which creates a directory. So a directory is just a folder that can contain other directories or can contain files. So let's create another one and we're gonna call it accounting. We'll put in our password there to elevate ourselves so we can create that directory. And if we do an LS, that's short for list. So it's gonna list everything that's currently in there. If we wanted to create a file instead of a folder, we can do sudo touch and then the file's name. So for example, if we did logs.txt and do another LS, you'll see logs is now in there. You can also do an LS-LAH and that'll give you a bit more information about them. And we'll cover off all what this is on the left hand side in a short while. Now, if we wanted to edit that text file, we've already looked at nano and VIM. So you know about both of those already. If you wanna see the contents inside of there, so let's quickly just pop some data in. So we'll go sudo nano logs.txt. And we're just gonna put a bunch of random data in there. In order to read the file, we can do a more and then do logs.txt. And there you go. It's gonna print out everything inside of that file in the shell. This is really only available for things like text files, log files, everything like that, but it's still really handy. Now I've paused the video and gone back into that file and made lots of different lines. And I wanna show you two other commands that will really come in handy. First is the command head, which will only show us the top 10 lines of the file. So if we go sudo head logs.txt, there you can see we're seeing this here. Whereas if we do a tail logs.txt, it'll only print the bottom 10 lines of the file. Tail is extremely useful when you're looking at logs because you may wanna be looking at the logs only in the last few minutes. You only wanna be looking at the recent logs. So by doing a tail, it's only gonna show you the recent ones which are usually time-stamped with the date and time. If we wanna copy a file, we use cp. So let's copy the logs.txt file into the sales folder that we created there. We'll go damper one sales. If we hit enter and do another LS, we can see, okay, the logs are still there. If we cd over to sales and do another LS, it's also there too. So we've copied that through. To remove a file, we're gonna type in rm and put logs.txt to another LS, and that's remove the file. If we wanna go one directory back or one level up, we do a cd with two dots and you can see there we've gone out of the sales file. Let's say instead of copying it, we wanted to move logs.txt into the sales folder. We then just do a mv. So mv logs.txt, then the destination. So damper one sales. We'll do a list directory. We can see it's disappeared, but if we go into the sales directory and do another LS, we've now moved that one successfully in there. So we wanna delete a folder. Well, we can do rm-r, we'll put that pseudo there. And let's say we wanna delete the sales folder. We'll hit enter, do an LS, and as you can see, that sales folder has disappeared. So rm by itself is just gonna remove a file. rm-r is gonna remove an entire directory. It's extremely important that with the rm and the rm-r commands, that you're very, very careful as making a mistake could be very, very detrimental to your system. I implore you, if you are running anything on your Linux servers at home, to look into backup option so that you can back up your data in case of an accidental deletion. Now that we've taken a look at that, I wanna look at understanding file permissions. So first, what we're gonna do is we're gonna go ahead and create a bunch of different data in here. So if we do a sudo touch, logs.txt again, we'll do a logs2, we'll do a logs3, and we'll make a couple of directories. So we'll go make directory sales, we'll make a directory called marketing, and we'll make another directory called engineering. So if we do a lslah, we can see lots of different files, lots of different folders inside here now. Now when it comes to files, there are really three types of actions or privileges that can be assigned. These are read, write, and execute. Additionally, these privileges in Ubuntu server are defined in three different categories, the owner of the file, the group, and other users. We view file permissions by using this ls-lah. You can also just use ls-l, but I like to do the ah, because it makes it a bit better when it comes to the size of the data as well. So the first thing we need to look at is this breakdown here. Okay, so what I'm gonna do is I'm gonna copy it out into Notepad. I'm gonna go through it. So the first letter or the first character in this, so this one here, is what type of file type it is. So d equals directory, if it's a dash, that means it's a file, and if it's an i, that means it's a link to somewhere else. Next up, you'll see we have three characters, then three characters, and then three characters. So we're gonna separate those, and that's essentially how the structure of a Linux file or folder is laid out. So as we've already spoke about, the first character is what type it is, then the next three are what permissions the owner have. The three after that are the permissions, the group now, and the three after that are the other users. Now x is for execute, w is for write, and r is for read. So let's write that out. r equals read, w equals write, x equals execute. And lastly, a dash equals not granted. So in this regard, let's see this one here. The logs.txt, well, we'll use what we've just learned, so we'll put a spacing between what we need to. So the dash means it's a file. The owner has read and write. Now you may be thinking, who is the owner and who is the group? Well, that's these columns here. So the first column is the owner when it comes to a user, and the second column is an owner when it comes to the group. So the owner has read and write, but not execute. The group has read, and other users also have read. If we wanna change the owner on one of these files, we've gotta use the command churn. So we go sudo churn, and let's change it to dan, and we'll go logs2.txt. Do another lsh now. We can see that it's now changed to be dan as the owner. If we want dan's group to also be here, we simply do a sudo chgrp, group dan, and logs2.txt, and if we run the ls again, we can see both of those have changed. In order to change the file permissions, we need to use numeric modes. This means that each privilege is assigned a numeric value, then these privilege values are summed up and represented by a single number. As a result, the permissions options are as follows. Seven equals read, write, and execute. Six for read, write. Five for read and execute. And four for read only access. For no access, we'd simply put a zero. Let's change it so in fact that all of them have L permissions, just as a demonstration. So we'll do sudo chmod, 777, and then logs2.txt. And now if we do an ls, lsh, we'll see that that now has rwx, rwx, and rwx, which corresponds to the seven that we put into that command. Let's change it again so that other users do not have execute, they only have read. So that will be 774, we'll do ls, lsh. We can see there the first three, rwx, so that's the owner. The second is the group, which is Dan, and other users only have read. If we didn't want other users to be able to access at all, we'd simply do a 770, do the ls, lsh again, and we can see all three of the last ones there, which represent the other users now have no permissions. And we'll not be able to access that file. For your records, there are also 321, so three is execute and write, two is write only, and one is execute only. And there we go. That's a summary of the file permissions within Ubuntu, as well as some of the commands you can use to manage files within the Ubuntu server. I hope this has been really informative for you. You may need to watch this once or twice just to get used to the different commands and get used to the different file permissions too. But I'll certainly leave an article with a bit of a cheat sheet for you. So always feel free to refer to that when you need to. In the next lesson, we're gonna be looking at how to transfer files and folders to and from an Ubuntu server, so I'll see you there. Hey, and welcome back. In this video, we're gonna be looking at how to transfer files to and from a Ubuntu server. So we're gonna be using a protocol called scp, which stands for secure copy. And one of the applications that's really popular for this is WinSCP, which you can find by going to winscp.net. We'll click on download now and we'll download the installer. It's only a small installer, so it doesn't take long to download. We'll go ahead and run that. I'm gonna click on install for me only and go through just a typical installation. We'll go to the commander style interface and we'll click install. Just a small disclaimer. It's always crucial to verify that you're downloading software, files, or any other content from a trusted source. Downloading content from an untrusted source or a source that appears to be legitimate but is actually fake can lead to the installation of malware or other harmful programs on your device. I only say this because WinSCP and other programs out there that will sometimes be uploaded to websites that are intended to make you look like you're supposed to trust them. So always make sure you are downloading it from the website or the source that is verified. It's also a good idea to always run an anti-virus scan on the files before opening or executing them. Remember, it's your responsibility to protect your device and personal information from harm. So please take precautions and exercise good judgment when downloading content from the internet. Cheers. Just gonna untick both loads and hit finish. Then if we navigate over to our start menu and open up WinSCP, we'll get a bit of a demonstration as to what it looks like. So the first thing it's gonna ask us is what file protocol we wanna use. We'll change that to SCP. We're gonna put in our host name, which is just the IP address of our server. The port number is the same port we use SSH for. We put in our username and password and hit login. It's gonna come up saying, do you wanna continue connecting to the server if you don't know the server, click cancel. We do know the server because it's ours. I'm gonna go ahead and hit yes. And there we go. So it's automatically opened up the home directory of our user that we've just logged in with. If we go ahead and use these double dots, we can go all the way back to the root directory. And there you go. If we were to do a CD to the root and go to LS, you can see that matches up perfectly. So we've got the bin, the boot, damper one, et cetera. On the left-hand side, that's our Windows machine. So again, if we go doing the double dots up, we can see we're logged into the server as administrator. And there we have all of our directories. So if I was to, for example, go into the downloads folder, you can see the Ubuntu, ISO and the WinFCPs that we downloaded. If I was to jump into damper one and find that logs2.txt, and I wanted to download that into my downloads folder, I could simply just hit download. It's gonna ask us, do we wanna keep the same name and everything? You can click okay. And now if I'm to open up my file explorer and go to downloads, there we go. Logs2 is there. So let's jump into our server and go into the DanPool directory and we'll open up the logs.txt. And we're just gonna put some data in. So we're gonna go hello world, save that, jump on back over to our WinSCP, download it, jump into our folder, open it up, and there we go. Now if we wanted to upload the Ubuntu ISO, for example, let's say let's use this file as an example when we wanted to upload it. We need to make sure that the user has permissions to write into one of these directories. So if we do a sudo chmod 777 on the marketing, and do an LS again to make sure, we jump back in here, we'll hit, we'll go into marketing and we'll hit upload. And there we go. We can see it's now transferring at about 51 megabytes a second. Now you don't need 777, I just use that as an example. It's always best in your environment to make sure you're using the least privileges so that users don't have an attack vector against your environment. Alrighty, now that that's finished uploading, we're gonna go ahead and change directory into the marketing, run an LS, and you can see there that it's been uploaded, the owner and the group are both down because using WinSCP, those are the credentials that we logged in with, and we can see the file is present. So there we go. We've given you a real quick overview as to how to transfer data to and from your Ubuntu server. This comes really handy when you're needing to look over log files and things and you don't wanna use the default terminal. You can download those to your Windows machine, open them up in Notepad, and if you're more comfortable with that, look at it that way. It may also be really handy for you if you're wanting to backup data, although there are better backup methods out there. That's it for this video. In the next one, we're gonna be looking at SAMBA, which is a method of file sharing from Ubuntu server into other Ubuntu servers or even Windows machines. I'll see you there. Now it was time for us to take a look at SAMBA. Now, SAMBA is a free open source software suite that enables file sharing between Linux servers and Windows clients over your network. It provides a way to share files between Linux and Windows systems using the SMB, which stands for server message block, and the common internet file system, otherwise known as SIFS CIFS protocol. SAMBA provides a wide range of features and capabilities for file sharing, including support for user authentication, access control, and encryption. To install SAMBA and configure the shared folder accessible by Windows PCs or Windows servers on Ubuntu, we can follow these steps. Now, I have already got this set up, but I'll still walk you through how you can do it if you're following along at home. First, it's very important that you always try and run a sudo apt-get update and sudo apt-get upgrade before installing anything to make sure you're getting the latest version. Next up, to install the application, we're gonna run a sudo apt-get install SAMBA. Now, it's gonna install anywhere from about 30 to 50 packages. It does have quite a few dependencies and everything, but it's not a large installation and should only take one to two minutes to get up and running. Next, we need to create the path that we want to share. So the directory we wanna share out. Now, you can have multiple. In my case, I have used the partition we created and just created a folder called shared. So I did an MKDIR into the mount, my drive, and then the folder that I created was called shared. Next up, we need to modify the SAMBA configuration file in order to share that one out. So we'll jump in there now and I'll show you what this looks like. So once you're in, we're just gonna scroll all the way down to the very bottom. And you need to add something along the lines of this. So first is the container. So I've just called it shared folder. We need to put the path space equals space and then the path of the shared folder that you want. We need to make it available, yes. We need to make it read only, no. We need to make it browsable, yes. Public, no, writeable, yes. And the valid users that can authenticate in. So we're gonna need to use the credentials of our Dan user in order to jump on in. So just a bit of detail on the parameters we just set. There are lots of different parameters out there. I would ask you to go out to the SAMBA.org documentation and just see how many different parameters you can set. But the ones we set there, so for the available, this parameter that lets you turn off a service. So if available equals no, then all attempts to connect to the service will fail. We of course set that to yes so that we can actually browse it. Read only, if you set this parameter to yes, then users of the service may not create or modify files in the services directory. It's similar to the writeable variable as well. So by writeable equals yes, we allow data to be written into the directory. Browsable means that the share is actually seen in the list of available shares when you're browsing it through your Windows machine. Public, if this is set to yes, then it requires no password in order to access the folder. Of course, we don't want that. We wanna be authenticating with our profiles. So we set public equals no. And valid users is a list of users that should be allowed to log in to the service. Now, one thing that's very important as well is if we head over to the directory that we're sharing. I'm gonna do, sorry, we just wanna go one level up from there and we wanna do an LS-LAH. It's important that the user that you're wanting to log into the Ubuntu server has actually got permissions. So in my case, I just did a C-H-O and a C-H group to change it both to Dan. And then I elevated using the C-H mod. I elevated the permissions to be able to write in there. Once you've configured all that, you do need to restart the service. So you do a sudo systemctl restart SMBD. It's always a good idea as well. Once you've done a restart, just change that into a status to make sure it's running. So as we can see there, it's active running, no errors. So that's all looking good. Now, using our Windows server, we simply can open up a file explorer, browse to the IP address of the Ubuntu server. And there we go. We can see our shared folder. Now I actually did have a problem getting into the folder and I realized I'd missed one step. So what I had to do is I had to do a sudo SMB password dash A and then the user I'm trying to authenticate as. This is gonna set that SMB password. So I had just put a password in there. I used the same one I'm using to log in as the user. And then simply all I did was go back into there, double click on that and enter the username and password that I just created there in order to log in. So now if I go new folder, I can create that. Let's just say one, two, three, four, five. We'll do a CD into the shared, do a list. And as we can see, that file now exists. So just wanna go back and give a bit of a summary about the command that I missed there. So the SMB PAA double SWD command is used to manage passwords for users who need access to SAMBA shares. So the command is used to add a new user to the SAMBA password database. The dash A is for adding a user and it tells the SMB PAA SWD to create a new password entry for the specified user. So just make sure before you're trying to browse, you're not getting the same frustration I was as to wondering why it wasn't working. So now that's it. We've created a file share. We're able to browse to it from our Windows client. So we could be copying data in there or storing data if this was some sort of file server or anything like that. I hope with showing you everything within the file and storage section of this course, I've shown you really how powerful Ubuntu can be. And we've really only just scratched the surface of all the various things that Ubuntu server is capable of. In the next section, we're gonna be looking at applications and software. So I hope you're looking forward to that and I'll see you there. In this video, I wanna talk about applications, specifically in Ubuntu server, the package installation and management. Now we've already seen the apt command, which is a super powerful command line tool which works with Ubuntu's advanced packaging tool system. The commands contained within apt provide the means for installing new software packages, upgrading existing software packages, updating the package list index and even upgrading the entire Ubuntu system. To give a demonstration, let's do a sudo apt install and let's install something called nmap. We'll put in our password. And as you can see, it's reaching out, finding the packages and dependencies. We're gonna hit a Y to confirm and hit Enter. Now it's downloading all of that and giving us a little progress bar down the bottom there to show its status. Now there are absolutely thousands, even tens of thousands of packages that you can install in Ubuntu. To give you a bit of a demonstration, if we go sudo apt get install, type the letter A and then just hit Tab a couple of times. You can see that there are 1,217 possible packages that start with the letter A. So it's asking me, do I wanna display all of these? I'm gonna hit Y and just show you how many there is. So I'm hitting space bar now and that's skipping by the hundreds. And we can see if we scroll up, just how many packages start with the letter A. Let's do it for B, just to give another. So we've got 820 there, we're gonna hit Y. And again, we're gonna scroll through and see all the different packages starting with B. So as you can see, it's an extremely powerful tool to reach out to those repositories and download the required packages depending on your system's needs. There are so many different functionalities and uses for Ubuntu servers and I highly recommend if you're very interested in Linux and you're very interested in the distro to just go out there, find different things to be able to install and play around with yourself. That is how you're gonna get the best experience for your career. Another thing that I wanna mention is that you can install multiple packages at the same time. So if you do a sudo apt install, let's say for example, we wanted to install these two here, so beef and beep. We would just do beep, space, beep. Now with that spacebar, allows us to install two different packages at the same time. Remove of a package is also straightforward. To remove the package we installed in the previous example, we'll simply do apt sudo apt remove nmap. Now if we wanted, we could also add the dash dash purge option and what this would do is this would remove any package configuration files as well. This may or may not be the desired effect, so always use with caution. We're gonna not use it in this instance and just hit enter. And as you can see there, it's gonna show us what packages are gonna be removed. Gonna hit Y and that's now removed it from our system. Another powerful tool is the wget command. So the wget is a command line utility for downloading files from the web. With wget, you can download files using HTTP, HTTPS and FTP protocols. Wget provides a number of options allowing you to download multiple files, resume downloads, limit the bandwidth, do recursive downloads, download in the background, mirror a website and much more. Just to show you, you can do a wget dash dash help and that gives you a lot of details as to what you can do when you're downloading a file. Now as an example, let's go ahead and change directory into our share drive that we used a bit earlier. And we're gonna do a wget and pull down a file from the Ubuntu website. So I'm gonna put the URL in there so we see it's gonna reach out over HTTPS to releases.obuntu.com and it's gonna download this ISO file. So hit enter, it's now reaching out. And you can see it gives us a very nice status bar. So it's telling us it's downloading at about, here we go, five megabytes a second. The ETA is about five minutes. We can see how much of the file has downloaded there so it's gonna give us a little progress bar. So what I'll do is I'll speed up the video to when it's completed and then we'll just take a look at that file to complete the lesson off. Okay, that download has now completed. We're gonna do an LSLAH and there you go. You can see that file has successfully completed. I hope that's given you a good overview of just how powerful the apt and wget commands are and just how many packages are available for installation on an Ubuntu server. I wanna thank you for watching. In the next video, I'm gonna show you how to install an Apache web server. So we're gonna go over the fundamentals of that. I hope to see you there. In this short demonstration, we're gonna be looking at installing the Apache web server. So the Apache web server is probably one of the most widely used web servers in the world. It provides many powerful features and we're gonna go over the fundamentals of installing it. First thing we wanna do is make sure we're updating the local package index to make sure there are no updates available. So we'll do a sudo apt-get update and sudo apt-get upgrade. Put in our password to elevate ourselves and that's gonna reach out and looks like it's found no packages to update, which is great. Next up, we wanna install the Apache package. So the one we need to install is Apache 2. So we're gonna go and do a sudo apt install Apache 2. We'll hit enter. You can see it's going to install 12 new packages. So these are all the dependencies and everything and it's gonna use about eight megabytes of data. So we'll hit yes, confirm that. It's gonna reach out, download and install those on our Ubuntu server. After confirming that's completed, we now wanna go and make sure that the service is actually running. So we'll do a sudo system CTL status Apache 2. There we go. We can see that that one is running. Now that's it. This Ubuntu server is now a fully operational web server. So if we open up our edge browser on our server, you can use any browser and you browse to the IP address. So HTTP and then the IP address of your server. There we go. We can see this is the Apache 2 default page, which means everything we've done has been a complete success. This page is worth a read as it includes some basic information about important Apache files and directory locations. If web servers are something you're interested in running at home or in your lab for development of your career, I highly recommend jumping on to the Ubuntu's documentation and checking it out. There is an absolute wealth of knowledge out there and Apache is one of those subjects that you can get absolutely lost in. You could probably spend a hundred hours going through all the documentations and various videos out there on best configuration and best practices. But at least in this video, we've given you a fundamental overview of what it takes to install something like this and get it set up and running in Ubuntu server. Now in the next section, we're gonna be talking about security and I know a lot of you are gonna get really excited at that concept. We're gonna cover off looking at the Ubuntu server firewall. So that's the inbuilt firewall that you can use to protect your server, as well as looking at some of the best practices in the industry to make sure your Ubuntu server is safe and secure. Thanks for watching this video. I'll see you in the next lecture. Hey there, in this video, we're gonna be talking about the server firewall. Now Ubuntu 2204 comes with UFW, which stands for uncomplicated firewall that protects the server against unauthorized access. Please bear in mind the tutorial is written with IPv4 in mind and we won't be covering IPv6. Now if you're just getting started with your firewall, the first rules to define are your default policies. These rules control how to handle traffic that does not explicitly match any other rules. By default, UFW is set to deny all incoming connections and allow all outgoing connections. This means anyone trying to reach your server would not be able to connect while any application within the server, you'd be able to reach the outside world. Now it's important to differentiate that when we're talking about firewalls, you can be talking about software firewalls and hardware firewalls. Hardware firewalls are the physical devices that you would put inside your network cabinet or your server rack that connect you out to the internet and filters that traffic from your local area network out to the wide area network. Software firewalls on the other hand, are what are built into the operating systems to protect individual devices. First of all, let's run a sudo ufw dash dash help, put in the password. And here we can see all the different commands available to us. So the first thing we wanna check is the status. So if we do a sudo ufw status, we can see it's currently inactive. So by default, Ubuntu server does not have the firewall enabled. To enable the firewall, we wanna run sudo ufw enable. Now please bear in mind that by doing this, we are gonna get those default policies set up. So we're gonna get kicked off of the server because we're gonna have no inbound connections allowed. So we're still gonna run it for the sake of this demo. So there you go. It's warning us that the command may disrupt existing SSH connections and do we wanna proceed with operation? In my case, because I have another way of accessing the server, I am gonna hit yes. However, in other situations, you would want to put in the commands and put in the allow commands before enabling the firewall. So let's go ahead and hit yes, just to see how quickly it stops our connection. Now, interestingly enough, it did not actually kick us off the server even though it gave us that warning. But I'm gonna hazard a yes if we were to try and make a new connection, it's gonna reject it. Yep, and there we go. So if we were trying to make a new connection, so this connection seemed to stay because it was already established. So the firewall rule isn't being hit. But as we can see, if we're trying to make a new connection, so if we were to close down this one and make a new one, we would get rejected. So in order to configure the server to allow for those incoming SSH connections, we can run this command, sudo ufw allow ssh. Now, ufw knows what port ssh means because it's listed as a service in the etc services file. So we'll run that and let's go ahead and do a sudo nano to the etc services file. And here you can see all the different ports and then associated names. So cool thing is we can use a lot of the names. However, if we didn't have a names, let's exit out of that. We could have just done sudo ufw allow 22 as ssh works over tcp port 22. Now that's running, we'll do another status. So ufw status. And we can see that the rules have been created in order to allow that connection inbound. So we've got a port 22 tcp and a port 22 via v6. Now it's allowing it from anywhere. Let's say we wanted to lock it down so that only our server, our windows server here could connect to it. So let's open up command prompt and do an IP config. Alrighty, and we can see the interface IP for the windows server that we've got there is 69.231. So if we wanted to lock down that port, we could do sudo ufw allow from 102.168.29.231 to any port 22. If we hit enter, rule added. Let's do another check of the ufw status. And there we go. Now we can see it's kept the rule, so it's added a new rule to allow it from that IP address, but it's kept the existing rule. So what we can run to get rid of that is sudo ufw delete allow ssh. We were to run that again, fantastic. So now if we open up new putty and we, so one thing that is interesting is we are using a different port, so we'll need to add that rule in as well. There we go. So we can do a ufw status, fantastic. We were to go in here and do the IP address and the port that we specified when we were setting up ssh, fantastic. We've got a login prompt, meaning that's completely allowed. So another port that we need to open because we set this up as an Apache server. So if we was to go to our web browser and try and browse right now, we're gonna get nothing returned. So if we do a sudo ufw allow HTTP, we're gonna allow HTTP from anywhere, fantastic. Now if we go back in here and do a refresh, there we go. You can see that's now loaded up. Now if we, let's go ahead and delete that one. If we wanted to allow it, there we go. We're all deleted so we could do a sudo ufw status. Cool, we've still just got two rules there for allowing 22 and 250. What we'll do is we'll also get rid of the ssh one, delete, fantastic. Brilliant, now we've just got the one rule which is for the 2250, which is the ssh port we use. Now if we can use subnets, we wanna allow an entire subnet of IP addresses. We can use that using the subnet mask. So if we do a sudo ufw allow from 192.168.69.0 slash 24 to any port, let's do port 80, which is the HTTP port. We reload that, we should get connection, fantastic. So in that case, if you've got an entire IP subnet that you wanna allow connection into something, you can use the entire subnet there. One thing to note is when we're putting to any here, that means to any connection on this server, so to any IP address listed on this server. You can lock it down by interface, so you could say only to the IP address of the interface that you've set up, that you want that traffic to allow through to. This can often come in handy for those web servers that you may have external interfaces connecting out to the internet and then internal interfaces connecting into your local LAN. So if we run another sudo ufw status, you can see the two commands we've got there. So currently we're allowing 2250 just from 69.231 and port 80 from everything on the subnet of 69.0 slash 24. Another command we can run is the sudo ufw status numbered. So it's important to note that the higher number gets preference. So if you've got two rules that are conflicting, the highest rule is gonna be taking precedence there. And there we go. We've shown you the fundamentals of the ufw. It's important to keep this in mind if you're ever opening up new applications or new packages that may require inbound connections. We've shown you how to add firewall rules, delete firewall rules and check on those firewall rules. We've shown how to lock down to individual IPs as well as entire subnets. Now it's important to note that these subnets don't have to be private IP addresses. So if you are forwarding supports through your router into the server, you can lock down from public IP addresses as well. And it really ties into just making sure that you've locked this down as much as you can and kept your server as secure as possible. In the next lecture, we're gonna be looking at some best practices when it comes to Ubuntu Server security. I'll see you there. When it comes to Ubuntu Server, keeping it safe and secure is extremely important, not just in your home lab, but when you start to move into your organizations that you're managing as well. Here are some good tips and tricks, as well as some best practices standardized in the industry to help you think in that secure methodology. First of all, always make sure you're using strong and unique passwords and passphrases. That means for everything from creating the user accounts to logging into the Ubuntu server, to setting up the SMB password database, strong and unique passwords are gonna protect your system against those brute force attacks, making it hard for attackers to enter your system. It's always important you keep those passwords securely saved somewhere, so in some sort of password management system, so that you're not forgetting the passwords and you're not getting locked out of your system. Secondly, and we covered this in the SSH lecture, but instead of just using password authentication, it may be prudent for you to look at using the SSH key pair or even using multi-factor authentication to log into the Ubuntu server. Always make sure you're verifying before installing anything and removing unnecessary software that may leave an attack vector on the server. Make sure you're updating often, so we covered this where you're using the sudo apt-get update and sudo apt-get upgrade. Where possible, try and keep these as up to date as you can, so you're always making sure you're installing the latest packages, which will often have later security vulnerabilities patched. In our last lecture, we spoke about UFW or uncomplicated firewall. Make sure you're using this to the fullest advantage, locking down your traffic, so that only the necessary networks and the necessary devices have access to the Ubuntu server. Another solution that's effective and easy to use is something called fail-to-ban intrusion prevention software. The system modifies the firewall rules on an Ubuntu server, so that any address that is tempted to log in a certain amount of times is blocked from accessing the resources on your system. It can be used as a preventative measure against authentication failures, as well as an alert system for administrators who need immediate notification when something goes wrong with their servers. You can install the fail-to-ban software using the command apt install fail-to-ban, and there is a lot of documentation out there on how to use it, so if you've got a server that is gonna be publicly exposed, I highly recommend you look into it. Though as I've already said, leaving servers publicly exposed to the internet is not the best practice, and I highly recommend you having some sort of firewall or some sort of network device restricting that connection inbound. Another good tip is to make sure you're using backups and checking them often. So there are various different ways of backing up, in Ubuntu Server you can use third-party products like Veeam, Altaro, or you can use methods inside of Ubuntu like tar-zipping directories and certain packages designed for backing up. Make sure you're frequently auditing your system and checking for any vulnerabilities and patching them where applicable. And consider using other things like disc encryption, disabling the root user and restricting permissions as much as you can. We spoke about this a lot in the pseudo and root lecture, as well as the users lecture, so make sure you're following those best practices. These are just a few of the tips and tricks out there in order to keep your server protected. Of course, security is its own topic and something we could get really in-depth into, but for the fundamentals, I wanted to just list through these topics and make sure you understand the importance of them, and now you've got the tools to go out and do your own research into how you can best protect your server. In the next section, we're gonna be looking at some monitoring tools and some tips in order to monitor and troubleshoot the Ubuntu server that we've created. We'll be going over topics like how to look at processes, how to look at disk space monitoring, disk performance monitoring, network monitoring, and even the simple network management protocol, or SNMP, for automated monitoring. I'll see you there. Hey, and welcome to the section on monitoring tools and tips. Now, if you're familiar with Windows, you know in order to check on resources, you can simply open up the task manager, go to the performance tab, and you'll see real-time monitoring of your resources like your CPU, your memory, your ethernet, and if there's a graphics card in here, you'd also see that. In Linux, things are a little bit different. You're needing to rely on the terminal commands to monitor, but there are a lot of different tools out there that can help you get real-time statistics of your server to help you troubleshoot in case there's an issue. If we wanted to look at a server's process activity in real-time, there are two commands we can use. So the first is top, which is an older command and comes pre-installed on the next distros. And we can also look at htop, which is newer and adds a bit of color. So I'll show you the difference now. So we'll run a pseudo-top, and then we can see a bit of information about the system in real-time. So we can see the load of the server. So currently we're sitting at zero. And the load is just the, how much of the CPU load is being used by the processes. So here we can see the memory. So we're currently assigned 7,950 megabytes. Now that we've got 7,315 free. So about 290 used, and there's about 345 saved for the cache. Now we're currently not using any swap. So swap is the memory that gets written onto the hard disk. And underneath that, we can see a lot of details about the different processes that are running, how much CPU and memory it's using, the amount of time they've been running for and what command they're related to. So for example, we've got the process ID one here. It's being run by the root. That is, it keeps swapping. It keeps swapping depending on how much usage is being used. But this is much of an older command and quite hard to use. So if we hit Q to get out of that, and then we do a pseudo-H top, you're gonna see this is a much nicer interface. There we go. So it will break down for us each of the cores. We've got four virtual CPU cores assigned to this server. And here you can see them listed zero, one, two, and three. The load we've got over on the right-hand side there was seeing it's still running as zero. So there's not much load going on here. We can see the uptime of the server. So this server's been up for about 28 minutes. There's about 37 tasks running. And if we go ahead and move on over to the left here, we can see the memory. So about 291 megabytes used out of 7.76 gigabytes and zero swap. And then we've got the breakdown of the processes as well underneath that, but in a much more easier to read format in my opinion. You've also got a lot of different shortcut keys. So for example, you can search for different processes. If we were to hit F5, you can see it in a tree format. So each command and each process that has sub-process underneath it are now split up by this tree. And we can hit F5 again to get out of that. You can also kill processes from within here by using the F9 keys. So if there was a process that was for some reason faulty or for some reason causing issues, you can kill it. Now we can use our arrow keys to navigate through. So up and down and we can see here as we scroll a bit down, we can see a lot of processes being used by the WW-data, which is the Apache user. So here we can see all the different Apache processes. And yeah, I highly recommend having a play around in-top and H-top just to see the difference between the two. My personal preference is I always try and use H-top where possible as I just find it a much more need to interface. But they're both powerful tools for monitoring system resources in Ubuntu Server. While top is a basic tool that provides basic information about system processes, H-top is a more powerful and interactive tool that provides more detailed information in real time. In the next lecture, I'm gonna be talking a bit about disk space monitoring. So let's jump into that one and see how we do that. Alrighty, in this lecture, we're gonna be looking at how we monitor the disk space size. So disk is something you never really wanna fill up because it can have detrimental impact to your system's processes. So if we wanna look at how we can monitor disk space usage and the file sizes and directories of an Ubuntu server, we can use some of the following commands. So you're already familiar with DF-H, so if we do a sudo DF-H, we can see it breaks down the file system and it gives us a bit of information about each of them. So for example, our Dan pull one, which we created, which was our Z pull, our ZFS pull, we can see we allocated at 124 gigabytes. It's currently using 1.9, so it's only about 2% full. Up here, we've got Ubuntu LVM, so that's the operating system disk and we're seeing that at about 24% used. This is a really good thing to check from time to time if you're worried about your disk filling up, especially if you haven't got that much storage available. So you know you can always run the DF-H in order to check all of the sizing of those disks, the total sizes, and get an easily readable format. Another really handy command is the du command. So du will print the size of a directory and its contents in a human readable format. So if you specify a directory path, it will show you the size of that directory and all of its subdirectories underneath it. You can also use the dash-esh option to show only the total size of the directory. So if we need to do a sudo do dash-es and look at damper 01 and hit enter, it gives us this figure here. Now that number is kilobytes. So if we were to take and open up a calculator, so let's say for example, we're gonna go kilobytes to gigabytes and we just pop it in there. You can see we've got 1,900,000-ish kilobytes which are totals to 1.9 gigabytes. So this is really handy if you wanna see what directories are using the most amount of data. So if you suspect there's something on there and you wanna be able to check how much it's using, you can run that and then go investigate further and maybe remove some data or move it off to an external hard drive or something like that. Another popular tool that we can look at is ncdu. So if we do a sudo apt install ncdu as it's not come inbuilt into Ubuntu server and then we run the nc sudo ncdu command, we can see it's currently scanning through all of our contents and it's gonna give us a graphical representation of our disk usage. And there we go. So we can see that user is currently using 2.4 gigabytes. We've got 1.8 gigabytes being used by Danpool and this will just give you in a top-down kind of view what directories are using the most amount of disk space and allow you to clean those up. So we just hit a Q to get out of that. So by using these commands, you can easily monitor the disk space usage and the size of files and directories on your Ubuntu server and that can help you keep your system clean, keep it from running out of space and keep it operational. In the next lecture, we're gonna be looking at disk performance monitoring. So that's monitoring how well your disks are performing and the speed that they're running at. So I'll see you there. Disk.io in Ubuntu server refers to the process of reading data from and writing data to a disk or storage device. In other words, it is the transfer of data between the computer's main memory and the hard disk or storage device. It's important aspect of system performance because it can have a significant impact on the overall speed and responsiveness of the system. If disk performance is slow, it can cause a bottleneck and mean that performance is not optimized. Monitoring disk performance in Ubuntu server is important for identifying any issues or bottlenecks that may be impacting system performance. This will be done using various tools like IO stat, VM stat and SAR, which provide detailed statistics on disk IO activity and performance. By monitoring and optimizing disk performance, you can ensure your system is running smoothly and efficiently. So the first one we're gonna look at is IO stat. So if we run an IO stat command, we're gonna see it's not currently installed and we're gonna need to install a package to get it. So sudo app install sysstat. We'll hit yes to install it and we'll watch that run as the progress bar fills up there and installs it on our machine. Fantastic. We run it again. There we can see the output from IO stat. So we can see all the different disk devices. So for example, the SDA is our operating disk. The SDB is our disk that we used for partitioning and SDC and SDC was for ZFS. We can see the current statistics. So how much kilobytes in read and how much kilobytes in write is being used. And we can also see some details at the top here about the average CPU. So here you could really get to grips with if you think that your disk performance is, if your disk is using up a lot of resources and potentially causing the slow server, this is a really handy command to run as it will give you a bit more information about it. Another one we can use is VM stat. So VM stat gives a lot more information than just disks, but there is a section in the middle here for IO. So you have BI and BO, which is for blocks in and blocks out. And what we can do is we can run this command over several seconds and check to see the performance over a period of time. So if we were to do a VM stat, let's check it every one second for 30 seconds. VM stat, space one, space 30, and hit Enter. We can see it's gonna be running every second for 30 seconds and we're gonna be getting details about the IO. So at the moment, we can see for the first second, there was a little bit of activity and then since then there hasn't really been any activity. There we go. So that can be really handy if you wanna be monitoring over a certain period. Of course, 30 seconds was a very short period of time. You could run that over a couple of minutes and see if there's anything that's potentially spiking up that activity. And there we go. We've taken a look at IO stat and VM stat. By using these tools, you can easily monitor your disk performance on the Ubuntu system and identify any bottlenecks that may be impacting system performance. In the next video, we're gonna be looking at monitoring the network. So the network interface cards and the network activity of your Ubuntu server. I'll see you there. Now from time to time, you may run into networking issues on your Ubuntu server. So I wanna show you a couple of commands that are really good to use in order to troubleshoot if a network issue does arise. The first thing we're gonna do is we're gonna go and install a package called inMap. So inMap is a network mapper. It's an open source tool used to scan networks and find open ports on your host. So if we do a sudo inMap localhost, now that that's installed, we can see what ports are currently open on our server. So if we were having problems connecting in, it's likely that by running this command, we could see if that port was showing as open or not. Another command we can run to get a similar result is the sudo lsof space dash lowercase n capital P. That's gonna show us all the ports on the system and what their current status is. Now this is a lot of data. So what we can do is we can use a pipe, grep, and then put it in the capital listen. And that's gonna give us a much easier to read list of all the ports that are currently listening on our server. So you can see there we've got the 2250, which is being used by the SSH process. We've got a bunch of different Apache 2, which is using port 80. And that's being used by the WWData user. If you wanna see how much bandwidth is being used by the server, we can run a command called ifstat. So you may need to install it with a sudo apt install ifstat. In my case, it's already on my server. So if I was to just now type in the word ifstat and hit enter, it's gonna give us a real time input as to how much data is coming in and going out of the server. So as a demonstration, let's open up another paddy and sign in as our user. And we're gonna download something and watch those figures change. So if I log in as Dan, now this will keep running for as long as it can and for as long as it will, and you just hit Q to exit it so we can keep an eye on it there. So if we were to do a W get and reach out to the Ubuntu server to start downloading something, we'll minimize that. And as you can see, these numbers are now changing greatly. So we're getting a lot of kilobytes coming in. So there we're seeing the thousands of kilobytes. So that's about 20, 30 megabits a second. And we can see it's keeping an active track. Now if we would jump back onto the server and do a control C to cancel that download and we'll exit out of that. We can see again, it's gone down. So this is a really handy tool to use to be able to keep track of how much bandwidth your server's using. If you think something's hogging up a bunch of bandwidth, you can run that, check to make sure, check to CNC, yep, okay, there is something hogging up all of my bandwidth and then go check the processes to see what's running. By using these tools, you can easily monitor your network into your Ubuntu server and identify any issues or bottlenecks that may be impacting your network's performance. This can help you keep your system running smoothly and efficiently and are some really handy tools to know for your career. In the next lecture, we're gonna be looking at monitoring processes and some commands you can use in order to manage these within an Ubuntu server. I'll see you there. In Ubuntu server, a process refers to a program or task that is running on the system. The process can be thought of as an instance of a program in execution with its own memory space and system resources. Each process is assigned a unique process ID which can be used to identify and manage the process. The listing process with the PS command is one of the oldest ways to view the terminal running processes. So if we run a sudo PSU, here we can see all the different processes running under the root user. If we did it without sudo, we would see all the processes running under our user. The PID column here is that process ID we spoke about and there's also some more details about how much CPU it's using, how much memory it's using and how long it's been running for. Another really good command is the PSTree command. This is gonna give you a tree overlook of the different processes and what each one is using as a sub process. Another command we can run is sudo LSOF and here we can see all the different processes being used by users and the system itself. Now we already looked at top and H-top but H-top is a really good graphical interface showing all the different processes and it even gives you a few abilities to be able to manage them inside of here. And there we go. Managing processes is an important part of system administration. We can monitor processes, prioritise them, terminate them and adjust their resource usage to optimise the system performance. Now that we've given you an overview of the different network monitoring within Ubuntu Server, in the next lecture I wanna look at SNMP which is a way of automating the network monitoring and the monitoring of your devices. I'll see you in that lecture. Simple network management protocol or SNMP for short is a protocol used to manage and monitor network devices, including servers. Ubuntu Server includes support for SNMP which allows you to monitor system performance, network usage and other system statistics. SNMP consists of three main components. The managed devices, the agents and the network management system. In this lecture we're gonna be focusing on configuring SNMP in the Ubuntu Server to act as an agent. You are gonna need a tool in order to tie into the SNMP and allow it to read that data and put it into a graphical interface that's easy to read. Some popular ones out there are PRTG, Logic Monitor, Cacti and Nagyos. So it's really up to you to go out and find what tool you wanna be using in order to do your network monitoring and get that one all set up. In this video though, I'm gonna show you how you can get the Ubuntu Server to be able to talk to those network monitoring tools and collect that data for automated monitoring of your servers. To configure Ubuntu Server as an SNMP agent, we'll first need to install the SNMP Demon which allows the server to respond to those SNMP queries. We can do this by running sudo apt-get install SNMP bini. Once the installation is complete, you can configure SNMP by editing the SNMPd.conf configuration file. This is located in the ETC SNMP directory. We'll run a sudo nano ETC SNMP SNMPd.conf and there we go, we're now in the configuration file. So in this file, you can configure a variety of settings including system information, security settings, network access. Some important settings to configure include the system location and contact information. So we'll go down here and we'll do system location and we'll put as data center for example and the contact we'll just leave it as me at example.org. Next up, we wanna scroll on down until we see the agent address. If we wanna listen on the interface that we currently have connected out to our network, we can do a UDP colon 192.168.69.235 colon 161. So that's listening on the protocol UDP port 161 on this network interface. Now I'm gonna show you how to set up SNMP version two in this. There are three different versions of SNMP. SNMP v3 is the latest version but it does require you to have usernames and passwords and everything. Whereas SNMP v2, you're just using a shared key between the server that's reading the data and the server that you're monitoring. So we'll scroll on down until we see this section here. We're gonna hash out both of these and create our own community. So we're gonna do our own community. So that's for IP version four. Then the shared key or the community name we're just gonna put as public. And then if we wanted to lock it down. So let's say for example, this Windows server that we're on, the hypervisor server was the one that had the SNMP monitoring tool on it. We can lock it down to its IP address. So we go one and two, one, six, eight, 69, two, three, one. And that means that only this server is gonna be able to communicate with the Ubuntu server to manage that SNMP data. We'll scroll on down but that's really all that's required to configure. So we'll do a control X and a save. Then we need to restart the SNMPD service. So we'll do a sudo systemctl restart SNMPD. It's a good idea to check the SNMP is listening. So we'll run a netstat dash nlpu grep SNMP. Oops. Oh, sorry, we need to do the sudo for that one. There we go. And we can see it's currently listening on the interface we defined at 161. Now something very important is we did earlier on enable our firewall. So if we did a sudo ufw status, we can see it's not currently allowing UDP port 161 inbound. So we'll need to add that in. So we can do a sudo ufw allow from one and two, one, six, eight, six, nine, two, three, one, two, any port 161 proto UDP. And then we can put a comment in there as well. So we can go comment SNMP scan from monitoring server and hit enter. So now if we do another status, we can see, yep, we have that in there. So if the hypervisor server that we're on had an SNMP monitoring tool, it would go ahead and start monitoring that and the Ubuntu server would report back to it, all of the statistics that you wanna keep. For those of you that do wanna learn more about SNMP, I highly recommend checking out something like Nagyos or PRTG, which both have free versions available. You can set up a server and start monitoring things like CPU activity, memory activity, network activity and collect polls every 30 seconds. So you run that over a couple of days and you'll be able to get a historical graph of what your server is doing. Almost every business that I've worked in has some sort of monitoring tool out there. So it's very important that you get the terms with SNMP as it's something I definitely see you using in your IT career. For now though, we looked at the fundamentals of SNMP. We've also taken a look at how you can configure SNMP version two on this Ubuntu server. And in the next lecture, which finishes off our section on monitoring, we're gonna be looking at cron jobs. I'll see you there. Cron jobs in Ubuntu server are scheduled tasks that are run automatically at specific times or intervals. Cron is a daemon that runs in the background and execute commands or scripts at a specified time. They're used to automate repetitive tasks such as backups, system maintenance or other administrative tasks. Cron jobs are defined in the cron tab command which is used to create, edit and view the cron job schedules. The cron job command creates a file that lists the cron jobs and the cron daemon reads this file and executes them at the specified times. The cron job file consists of lines that define the schedule and command to be executed. Each line consists of six fields separated by spaces which specify the minute, the hour, the day of the month, the month, the day of the week and the command to be executed. For example, the following line runs a backup script every day at 2 a.m. So we'll jump into cron tab dash e. We use, it's gonna ask us what editor we wanna use in order to run it. So we'll go one for nano. Then if we go ahead and make our way down, if we did a zero, two, star star, star space, star space, star, space slash, Dan pool, oh one, forward slash backup underscore script dot sh. This line specifies that the backup script should be run at minute zero, hour two, every day of the month, every month and every day of the week. So if we had a script there that was gonna be backing up some data and say moving it off to another server, this would automate that task and we can be confident that our data was being backed up without any human intervention. In summary, cron jobs are a very powerful tool for automating tasks on an Ubuntu server. By setting up cron jobs, you can ensure that repetitive tasks are performed consistently and without manual intervention. In our next section, we're gonna be looking at a brief overview of scripting within Ubuntu server. I hope you're looking forward to that and I'll see you there. Now before we finish this course, I wanted to give you a brief overview of scripting within an Ubuntu server. So there are many scripting languages out there like Python, C++, Ruby on Rails and many others. But the one I wanna focus on in this video is batch scripting. So batch scripting is one of the easiest types of scripting to learn and is best compared to Windows batch scripting if you've ever used that. It's very flexible and has many advanced features that you won't see in batch scripts. During your time as an Ubuntu user, you'll probably see scripts out there that can do tasks such as backing up files, backing up folders, deleting of files or using batch scripting. A batch script is simply a text file containing a series of commands that can be executed as a script. To create a batch script in Ubuntu, you open up a terminal window, use a text editor like nano to create a file with the .sh file extension. So for example, if we make our way over to DanPort01 and we jump into the engineering folder, if we were to do a pseudo nano script .sh, that would open up the nano editor. Now I'm gonna paste in some example data. So there we go. We've got a command here for someone to enter their first name, enter their last name, and then it's gonna echo what they've put in. So we're gonna control X and save that. Now in order to execute the script, you need to make it executable by running the following command. See, pseudo chmod plus X, and then the script itself. So if we do an LSLAH now, we can see that's changed to green, meaning it's available to be run. In order to run it, we simply do a dot forward slash and type the script in. So it's gonna ask us for our first name. It's gonna ask us for our last name. And there you go. It's saying your name is DanMill. This of course is a very simple script. There are lots of other things out there. You can do variables, you can do loops, you can do conditionals, you can do functionals. If you're familiar with programming at all, you'll know just how powerful you can make something like this be. But for the fundamentals, I just wanted to show you first of all, what the scripting language is. Secondly, how you can make a script yourself. And thirdly, how you can execute it. I highly recommend going out and looking at the various documentations and the various demonstrations that you could use in order to get bash scripting if it's something you're interested in. Overall, bash scripting is a very powerful tool for automating tasks and complex operations within Ubuntu server. I hope it's been really informative for you in this section. In the next section, we're just gonna cover off a few extra content like looking at the Ubuntu documentation and looking at what Ubuntu Pro is. That's it for the labs and the demos for now. I really hope that throughout the course, you've been able to learn a lot. And you're gonna be able to take that knowledge, apply it at home and apply it in your IT career. As always, if there's anything further that you wanna see, drop me a review and put in a comment or send me a message. If there's particular content you want released or something that you're more interested in and you want me to release more videos on, definitely let me know. For now though, that's it for this section. I'll see you in the next lecture, what we'll be looking at Ubuntu documentation. I'll see you there. Now, before we end the course, I wanted to give you a bit of a rundown on the Ubuntu website and the documentation available on there. So Ubuntu Server is an absolutely massive operating system and it could take you hundreds of hours to become an absolute pro on it. But one of the tools out there to help you in that journey is the Ubuntu Server documentation. So by heading over to ubuntu.com, forward slash server, forward slash docs, you can see there are lots of tutorials, how-to guides, explanations and references to help you with your projects and to help you set up your Ubuntu Server exactly how you need to. There's also many other websites out there. You've got Discord channels for Ubuntu Server, you've got Stack Overflow subcategories and many other websites that are gonna help you get that information that you need and put it into your server. That's really it for this video. I just wanted to give you a fundamental overview of where you can find some of the information for yourself as with IT, it's not always just about what you know, it's about what you can find out. A good engineer isn't just a good engineer because they have everything in their brain already. A good engineer is someone that can go out and find the information for something they don't know. Having those skills to be able to guide and find the information on the latest and greatest technology, on the newest configuration and on the newest best practices, is what's gonna set you and your fellow colleagues apart. In our last lecture, we're gonna be looking at Ubuntu Pro. I'll see you there. In our last lecture, I wanna talk about Ubuntu Pro. So Ubuntu Pro is a premium version of Ubuntu, designed specifically for enterprise customers who require additional features, security, and support for their mission critical workloads. Ubuntu Pro includes features like hardened kernel, enhanced security updates, live patching for critical security vulnerabilities, and access to monitoring and management tools. It also comes with enterprise grade support from Canonical, the company behind Ubuntu, with guaranteed response times and access to a team of expert engineers. Ubuntu Pro is designed to meet the needs of enterprises that require high levels of security, reliability, and performance from their workloads. It provides a secure and stable platform for running mission critical applications and is ideal for industries such as finance, healthcare, and government, where it's data security and compliance are of utmost importance. While it's not gonna be relevant for you and your homelab and for your training, I just wanted to give you a brief overview of it. As it is something you're likely to come across in the industry if you are using Ubuntu, or you are looking at Ubuntu servers in your environment. That's really it for the fundamentals. If you wanna check out more, you can go to ubuntu.com forward slash pro. You hear you can look at different features available, different pricing structures and everything like that. For now though, that's me gonna be signing off on this course. I really hope that you've learned a lot. As I mentioned a bit earlier, please feel free to reach out if you have some comments around the course or if you wanna let me know what you wanna learn next and what's something you want me to create a course on. Your feedback is invaluable and I always do appreciate it. For now though, pat yourself on the back. Well done for getting through the Ubuntu server fundamentals. Hopefully at home you've now got an up and working Ubuntu server that you can play around with and using the Ubuntu documentation do a lot more with depending on what your interests are. Whether that be programming or networking or system administration, the tools are always there for you to go out and learn more. Thanks again for watching. I'll see you in my next course.